DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Gen3 Dashboard Variables - Display label different from value in Query-type variables

VictorRuiz
Guide

Hi Community,
I'm working with Gen3 Dashboards and I'm facing a challenge with Query-type variables where I need to:

  • Display a human-readable name to the user (e.g. SERVICE-BPM-Procesar)
  • Use the entity ID in tile queries (e.g. SERVICE-E43178F49BBABF09)

Context
I have a variable SVC_2 with this query that returns both value (SERVICE-ID) and label (service name):


fetch dt.entity.service
| fields value = toString(id), label = entity.name
| dedup value, label
| append [data record(value = "ALL", label = "ALL")]
| sort label asc


The query returns the correct structure:


{
"value": "SERVICE-E43178F49BBABF09",
"label": "ATRIA-BPM-Procesar"
}

 

The Problem
No matter what I try, the variable always interpolates the display name instead of the ID into tile queries.


Attempt 1 - Direct interpolation with quotes:


| fieldsAdd selected_service = "$SVC_2"


Generates:


| fieldsAdd selected_service = ""SERVICE-BPM-Procesar""


Double quotes break the DQL parser.


Attempt 2 - Without quotes using :noquote:


| filter service_id == $SVC_2:noquote


Generates:


| filter service_id == SERVICE-BPM-Procesar


Spaces and hyphens in the name break the DQL parser.


Attempt 3 - Using data record + parse to extract ID from concatenated value:

Variable returns:SERVICE-BPM-Procesar [SERVICE-E43178F49BBABF09]


data record(raw = $SVC_2)
| parse raw, "LD '[' LD:extracted ']'"

Parse works correctly and extracts SERVICE-E43178F49BBABF09
But when used inside a tile with join:

timeseries now = avg(dt.service.request.failure_rate, default:0),
by: { dt.entity.service }
| fieldsAdd service_id = toString(dt.entity.service)
| join [
data record(raw = $SVC_2)
| parse raw, "LD '[' LD:extracted ']'"
| fields extracted
],
kind: inner,
on: { left[service_id] == right[extracted] },
fields: { extracted }

Returns 0 records even though the service has data.
What DOES work - but only with pure SERVICE-ID:


| fieldsAdd selected_service = $SVC_2
| filter selected_service == "ALL" or service_id == selected_service

Works perfectly when the variable returns only SERVICE-E43178F49BBABF09 But then users can't identify services by name in the dropdown.

The Question
Is there any supported way in Gen3 Dashboards to:
1. Show a human-readable label in the variable dropdown
2. Have the variable pass the entity ID to tile queries
Specifically:

  • Is the value/label field separation supported in Query-type variables?
  • If so, how do you configure it in the UI?
  • Is there any workaround to parse the entity ID from a concatenated string within a timeseries pipeline?

Any help would be appreciated!
Victor

1 REPLY 1

Omkar_B
Dynatrace Enthusiast
Dynatrace Enthusiast

Hey @VictorRuiz,

Instead of showing both value and label, you can just display the label in the variable and use that same label to apply the filter in the tile.

Here’s an example:

Omkar_B_0-1780966559351.png

I think you may have added "ALL" to the list to allow filtering across all services. Instead, you can use the multi-select option.

In the tile, you can directly use the service name or entity name for filtering. Also, use the 'in' filter instead of '==' or 'contains' so that it works properly with multi-select values.

Example : 

Omkar_B_1-1780966780001.png

Featured Posts