Variable key value regex, using Grafana interpolates in dashboard

I am trying to use the value returned by my query as key value
This is the regex i used

But this is only returning the first row only cutting out rest of the rows returned by the query used in the variable

And i have used the variable in my dashboard now, premium is the variable name
When I directly use the variable in panel title it gave the text ${premium}
And When i added it with value ${premium:value} it gave the variable value correctly. Bu then whatever i type after semicolon it returns only value.

But in my case i want to use the percentencode to get the data from data source
so, i want to use two interpolates How do i do that.
And my regex why its not returning all the key value but only returns one row.
/(?.)|(?.)/g whatever comes after the | its is value before that its text. Please check.
image

Please share a raw list of the values before applying the regex

Hi @yosiasz
This can be taken as the example for the input

Then how can we display it as text and value, like premium can a the variable name
then ${premium:text} or ${premium:value} this is could not be achieved even with regex
also i am using an api call to get some data so, i have used
${premium:percentencode} so along with this any way we can do
${premium.text:percentencode} something like this

So if this was a data that leverages SQL it would be

Select text as __text, value as __value

Then you refer to it as you stated above

${premium:text}
${premium:value}

Hi @yosiasz
Updated the query
my actual query will process

But grafana variable is processing the first column only that’s okay

but still could not print the second column with the
${premium:text} → prints text value
${premium:value} → again prints text value

I think this is the issue, out __value first

1 Like

Hi @yosiasz ,
Thanks for the reply it was helpful, And it worked i have can have two capture group, Is there any way we can have one more capture group in variable, I saw there is a doc saying only text and value is supported.
just like text and value,
For example now i combined all three

Using this regex

I could get ${mz:value} - > 1200 , ${mz:text} → Laptop|Electronics

as i use repeat by variable.
This way if there is a set of teams, and there application health will be viewed through dynatrace with their team id, and at that point if we want to have team id (for dynatrace health) and their application deployment link as datalink.

We cannot really have 2 capture group right, so is there a way to get 3 or more capture group for variable, Also chained variable you can think of but if a manager level dashboard is viewed then they have to look as whole teams view so it would be great if we could have one more capture group.

you got a lot going on in that question. what exactly is it you want to do?

you have $price in there, dynatrace, teams, datalink, capture groups (3 or more), you requirement is blurry with all of these details