Bring the "_time" data

Hi I am new in with influxDB and I need to bring the value in _time column.

What else do I need to add in order to get that value? I do not need the whole table, just that value.

This is my query.
from (bucket: “jmeter”)
|>(start: v.timeRangeStart, stop: v.timeRangeStop)
|>(fn: (r) => r.[“_measrurement”] == “requestsRaw”)
|>group(columns: [“_start”])
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)

Thank you

Hi @Diego_Navea,
So you could use the get column function like so:

timeArray = from (bucket: “jmeter”)
|>(start: v.timeRangeStart, stop: v.timeRangeStop)
|>(fn: (r) => r.[“_measrurement”] == “requestsRaw”)
|>group(columns: [“_start”])
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> getColumn(column: "_time")

time = timeArray[0]

Hi @Jay_Clifford ,

Thank you for replying. I did not know that you can use arrays but when I run the query I am getting the error " An internal error has occurred"

When I tried to display the graph replacing the v.TimeRangeStart for the value in the array (time) is shows this error, " type error @5:29-5:30: record is missing label windowPeriod"

No idea what that means…

My final goal is to replace the v.timeRangeStart with whatever value is in _time
Also, can I apply conditions statement (such as an if) at the moment to select the _time?

Thank you in advance.

Hi @Diego_Navea,
Oh, in that case, I would just use a map()
Like this:

from(bucket: "global")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r._measurement == "machine_data")
    |> filter(fn: (r) => r._field == "load")
  |> map(fn: (r) => ({ r with _time: r._start }))    
    |> yield(name: "_editor_composition")

You also run conditional statements like so:

from(bucket: "global")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r._measurement == "machine_data")
    |> filter(fn: (r) => r._field == "load")
  |> map(fn: (r) => ({ r with _time: 
  if r._value > 200  then
    "FAULT"
else if r._value == 0 then
    r._start 
else
   r._time
}))    
    |> yield(name: "_editor_composition")