How to get Grafana dashboard variables into flux query?

Hi,

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:

Grafana_InfluxDB20_repeatrows

If I try this:

GrafanaFlux_Query

I get this error:

GrafanaFlux_Query_Variables_Error

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

Thanks a lot…

2 Likes

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

9 Likes

This topic was automatically closed after 365 days. New replies are no longer allowed.