grafanagrafana-variable

grafana variable regex : grouping for name and value


My grafana uses a mysql datasource.
A table WORK contains a column id (numeric) and wname (work name, varchar).
My variable $wo has this query :

select concat ("WORK ", wname, ", work-", id) from work order by wname

A single row example is

WORK-painting, work-722

I would like to set the text of $wo to WORK-painting and its value to work-722.
I use the regex :

/(?<text>.*),(?<value>.*)/

The button run-query valorize the section "Preview of values" with :

WORK-painting  WORK-playing etc ./..

Where are my values work-id ? And when I use the variable $wo in a panel, I still get the name instead of the value. Help please :)


Solution

  • It's not well defined in the documentation
    You can access the value with this syntax :

    ${variable_name:raw}