-
What Grafana version and what operating system are you using?
Azure Managed Grafana (Standard) version 10.4.3 -
What are you trying to achieve?
This is a followup on my previous post ( Auto select data in variable based on what user selects in 1st - Grafana / Dashboards - Grafana Labs Community Forums)
I have a custom variable defined with country name & country codes defined in following way:
Afghanistan : AF, Aland Islands : AX, Albania : AL, Algeria : DZ…
Variable has multi-value & include all options selected. I want users to select country name from the drop down and in the dashboard queries should be able to use both selected country name & country codes for various queries.
Everything works as long as only one country is selected from the drop down. If more than 1 selected, country name is returned as
Afghanistan + Aland Islands + Albania
Country codes returns as expected:
AF,AX,AL
Those plus symbols causing queries to fail. I attempted usage of regex but that didnt help
${Country:text} = returns names separated by Plus symbol
${Country:value} = returns comma separated country codes, no issues here
${Country:text.Replace(/\s++\s+/g, ‘,’)} = returns comma separated country codes for some reason
How can I get both name & codes
-
What did you expect to happen?
I want to be able to use both country name & codes. -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
I attempted this with text panel. Using this in actual query returns “no data” as response. -
Did you follow any online instructions? If so, what is the URL?
multiple, dont have them handy now.