Reputation: 697
I have a simple Custom
variable called route with e.g. this value:
/foo/bar,/foo/baz,/foo/baz/foo
I'm trying to map these values to some more understandable values, e.g. Custom
route_names:
bar,baz,foo
Searching on google resulted in people doing nested variables, but whatever I try in Grafana 5.3.4, I can't get it to work. If I do a Query
variable and use -- Grafana --
as source, I don't know what to put in the query field. route.*
didn't do anything, $route
neither.
What is the correct way of selecting a value from one variable and map it to the other? I.e. What is the query language being used when selecting -- Grafana --
as datasource?
As a side note, I have two datasources at the moment, my actual data source where I get my graph data from and -- Grafana --
.
Upvotes: 2
Views: 5960
Reputation: 21
There are correct answers on the first floor. solve "key/value pairs" by SELECT 'txt1' AS __text, 'value1' AS __value UNION SELECT 'txt2' AS __text, 'value2' AS __value
Upvotes: 2
Reputation: 1500
This is not possible with Custom
template variables (unless smth changed in recent Grafana versions). It can be done with variables coming from mysql, postgres and clickhouse datasource queries. See examples in https://community.grafana.com/t/key-value-style-for-custom-template-variable-configuration-and-usage/3109 thread. Can't tell about this feature support in other datasource types.
Upvotes: 0