Creating Flux variable on grafana 10 dashboard

Hello,

I am using Grafana 10 and Influxdb 2.7.4.

I use below query to create variable on grafana.

from(bucket: "VFBckStrg")
  |> range(start: -30d) 
  |> filter(fn: (r) => r._measurement == "VMwareRawData14")
  |> map(fn: (r) => ({ Schedule_Type: string(v: r.Schedule_Type) }))
  |> distinct(column: "Schedule_Type")
  |> keep(columns: ["Schedule_Type"])

When i run query i get None.
But when i try this on influxdb data explorer i get below on data explorer.

There should be 2 Schedule_Types as variables but i get None.
There should be “Snapshot” and “Full Backup” but i get none on Grafana.

Instead of a query, can you use something like this?

import "influxdata/influxdb/schema"
schema.tagValues(
    bucket: "VFBckStrg",
    tag: "Schedule_Type"
)

See the variables created in this dashboard: Grafana

1 Like

Thanks alot @grant2. I didn’t know this kind of usage is available in query area.
It is also fast.