Hello,
i have bucket with operating data from vehicles. This bucket have short retention period and i want store unique vehicleIDs in another bucket without retention period.
So i created a query:
actual_vehicle_list = from(bucket: "vehicle_list")
|> range(start: -1y)
|> findColumn(
fn: (key) => key._field == "vehicleid",
column: "_value"
)
from(bucket: "operating_data")
|> range(start: -1y)
|> group(columns: ["vehicleid"])
|> distinct(column: "vehicleid")
|> map(fn: (r) =>
({
_time: now(),
_measurement: "vehicle_list",
_value: r.vehicleid,
_field: "vehicleid"
}))
|> filter(fn:(r) =>
contains(value: r._value, set: actual_vehicle_list) == false)
|> to(bucket: "vehicle_list")
This query works well in Data Explorer, but when pasted into the task, an error shows up: invalid options: error calling function “findColumn” @5:5-6:49: no execution context for tableFind to use
Is there a better (or more correct) way, to achive this or where could be problem? I’ve just started learning Flux and i’m new to community so sorry if posting this wrong.
Thanks!