Hey,
i have a table which returns all the data for the trucks leaving from the production site like how much produce should be on the truck and how much is actually inside.
I have build a query which works fine as long as one truck leaves the site within the last 24h.
My problem is, that i dont get a field when no truck left. In this case i want to get a text like “no Data to show” or “no production”.
Is this somehow possible to get this in case there is no data returned by my query?
I use InfluxDB 2.0 and Grafana 7.5 to visualize my data.
My Query looks like this:
from(bucket: "myBucket")
|> range(start: -24h)
|> filter(fn: (r) =>
r._measurement == "MyMeasurement" and
r.short == "target" or
r.short == "delivered" or
r.short == "ID" or
r.short == "group"
)
|>keep(columns:["_time","short","_field","_value"])
|>toFloat()
|> pivot(
rowKey:["_time"],
columnKey: ["short","_field"],
valueColumn: "_value"
)
|> filter(fn: (r) =>
r.group_value_str==250
)
|> map(fn:(r)=>({
_time:r._time,
"newColumn":(r.delivered_value/r.target_value-1.0)*100.0
})
)
|>mean(column:"newColumn")
Thank you for your help in advance