How to use query result in range()

Hello @cville

Hey, I know a way to do this but instead of the result that you show you will only get a single row. Then, you can pull the column that you want in another query:

charging_sessions = from(bucket: “test”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “charging_sessions”)
|> filter(fn: (r) => r[“_field”] == “session_start_dts”)
|> aggregateWindow(every: 1d, fn: last, createEmpty: false)
|> keep(columns: [“_field”, “_value”])
|> last()
|> findRecord(fn: (key) => key._field == “fieldName”,idx: 0,)

from(bucket: “test”)
|> range(start: v.timeRangeStart, stop: charging_sessions ._value)

They mention this topic here also, if you want to check it out: