I’d wish to post my last measurement data to an external web service.
That web service requires a date in YYYYMMDD format and the time in HH:MM format.
How to retrieve these two items from the _time column of a query in flux?
And how to debug the output before http posting it? (An example how to stream a variable as data will help).
Would this flux code below do the job?
import "strings"
datetime = from(bucket: "dsm")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["equipment_id_electricity"] == "${ID_ELECTRICITY_6}")
|> last()
|> schema.fieldsAsCols()
|> limit(n: 1)
|> keep(columns: ["_time"])
d=strings.replaceAll(v: strings.substring(v: string(v: ${datetime}), start: 0, end: 10), t: "-", u: "")
t=strings.substring(v: string(v: ${datetime}), start: 11, end: 5)
Thanks in advance.