Hi ! I’m new to Flux and I don’t understand how to return the value of a variable !
I read the doc Query using conditional logic in Flux | InfluxDB OSS 2.6 Documentation for the 0.5 Flux version and I want to return the hour
value.
Here is my code, but I think it doesn’t work as well…
My code
transformHour = (number=<-) => {
number
|> hour:
if number._value >= 60 then number._value / 60
else if number._value >= 3600 then number._value / 3600
else number._value
}
from(bucket: "test/autogen")
|> range(start: dashboardTime)
|> filter(fn: (r) => r._measurement == "my_measurement" and (r._field == "my_field"))
|> count()
|> transformHour()
This is what I obtain:
That’s not what I want.
The visualization mode is Single Stat.
I just would like to understand how to return
hour
value.
Thank you in advance
Nico