Unable to query data header with double quotes using flux

Hello,
I am collecting data from multiple CNC machines that is being sent to an influx v2 database in the form of a dataframe, with the headers and values as strings. Unfortunately it is not possible for me to change the code for data collection or the code that sends the data to influx at the moment. Using the following flux query, I am able to see the data as a table and plot it on the influx UI/grafana (image attached)

from(bucket: “fanuc”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “axis”)
|> filter(fn: (r) => r[“_field”] == “load”)
|> map(fn: (r) => ({
r with
_value: float(v: r._value),
_time: time(v: r._time)
}))

- plot on grafana dashboard

I would like to display the data from only one of the axis on the graph (I would like to select the data from one of the columns for display on the dashboard instead of displaying 8 parameters at once). How can I modify my flux query to achieve this?

Thanks in advance for your assistance!
Adi

- dataframe on grafana -

I found a workaround to solve this issue. Although tortuous, it worked.

On grafana, I am able to go into the override options and select the individual series by name and using the “hide in area” option, I am able to hide all the series I don’t want to show on the dashboard.

If there’s a better way to directly incorporate the selection through the flux query, I would love to hear about it.

image

You can try adding another filter to your flux query that contains variables coming from Grafana:

 |> filter(fn: (r) => r["axis"] == "${axis:doublequote}" and r["machine"] == "${machine:doublequote}")

Variable ${machine} could be declared somehow like that:

import "influxdata/influxdb/schema"

schema.tagValues(bucket: "fanuc", tag: "machine")

${axis} could be a custom variable: