How to get Grafana dashboard variables into flux query?


in influxdb 1.x I used a dashboard variable to repeat a row of a dashboard.
In influxdb 1.x during creation of the query I got a popup window to choose variable from.

Now in influxdb 2.0 and flux queries I don’t know how to access the dashboard variables to get repeated rows as well:


If I try this:


I get this error:


Can someone please tell me how to get the variable into my flux query?

Thanks a lot…

Meantime I found it by myself, instead of:

|> filter(fn: (r) => r["host"] == ${myvariable})

it shoud be:

|> filter(fn: (r) => r["host"] == "${myvariable}")

So I just missed the quotes - hope that helps someone

1 Like