Feature request: select key, value pairs in variable queries
See original GitHub issueFirst, thank you @marcusolsson for this fantastic plugin. Top notch!
I’d like to request a feature, namely the ability to select multiple values in dashboard variable queries, and give the ability to rename their values to __value and __text, so that the selection may be a key / value pair. Currently, only a single value is selectable in the variable query options, i.e. the + / - buttons are missing.
Scenario: My JSON query returns an array of key / value pairs, such as [ { "mykey": "somekey", "myvalue": "somevalue"} ]
. I want my dashboard selector to show “somevalue”, but when I select a value, I want __value to be set to “somekey”. Grafana supports this for values named __value
and __text
.
Which enters the second part: once I’ve defined my field, the ability to rename it is required, ideally to some arbitrary value of my choosing (similar to a SELECT mykey as __value, myvalue as __text
).
Please see this blog post for how this scenario is accomplished using mysql: https://grafana.com/blog/2019/07/17/ask-us-anything-how-to-alias-dashboard-variables-in-grafana-in-sql/
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (11 by maintainers)
Sorry, I wasn’t using the feature properly – was trying to set the field names using alias – I found the settings under experimental tab. Seems to be working!
@sasha-blip time range isn’t the issue here – maybe you meant to comment in #98. It’s the variable extraction or return that appears not to be working.