Dear all!
I am using a custom function, to find minimum inside custom start, stop interval.
functionToFindMinimum = (start, stop) => {
dataStream = from(bucket: "bucket")
|> range(start: start, stop: stop)
|> filter(fn: (r) => r["_measurement"] == "measurements")
|> filter(fn: (r) => r["deviceId"] == "did123")
|> filter(fn: (r) => r["_field"] == "Curr")
|> drop(columns: ["_start", "_stop", "_time", "_field", "_measurement", "deviceId"])
|> min()
|> toInt()
return dataStream
}
functionToFindMinimum(start: -2d, stop: -1d)
The result is a stream with single _value
How can i call this function inside map() …
......
|> map(
fn: (r) => (
{
d_minValue: functionToFindMinimum(start: r._FromTime, to: r._ToTime)
}
),
)
I do not know how to return single decimal/integer value from the function. Whatever i am trying it is always returning stream, so i am getting the following error:
runtime error @43:8-52:6: map: map object property "d_minValue" is stream type which is not supported in a flux table


