getRecord() function

Warning! This page documents an earlier version of Flux, which is no longer actively developed. Flux v0.50 is the most recent stable version of Flux.

The getRecord() function extracts a record from a table given the record’s index. If the index is out of bounds, the function errors.

Function type: Stream and table

getRecord(idx: 0)

Parameters

idx

The index of the record to extract.

Data type: Integer

Example

r0 = from(bucket:"telegraf/autogen")
    |> range(start: -5m)
    |> filter(fn:(r) => r._measurement == "cpu")
    |> tableFind(fn: (key) => key._field == "usage_idle")
    |> getRecord(idx: 0)

// Use record values
x = r0._field + "--" + r0._measurement