question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: select key, value pairs in variable queries

See original GitHub issue

First, 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:closed
  • Created 3 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
TimUnderhaycommented, Apr 22, 2021

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!

0reactions
TimUnderhaycommented, Apr 22, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request: select key, value pairs in variable queries #79
I'd like to request a feature, namely the ability to select multiple values in dashboard variable queries, and give the ability to rename...
Read more >
Use a custom-variable in a custom-variable - Grafana
I finally got around to try out the key : value pairs, but struggle to get it to work. Somehow my key value...
Read more >
4. Working with Key/Value Pairs - Learning Spark [Book]
This chapter covers how to work with RDDs of key/value pairs, which are a common data type required for many operations in Spark....
Read more >
How to use Grafana variables to make interactive dashboard ...
Grafana variables allow you to use a drop down menu to select various ... Here, we define four key value pairs to be...
Read more >
Spliting a column that is a variable/value pair, and assigning a ...
So I need to split on the , and then split on the = so somehow get: SET @SomeID = SELECT TypeValue FROM ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found