getRecord() function

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)

Use tableFind() to extract a single table

getRecord() requires a single table as input. Use tableFind() to extract a single table from a stream of tables.



Index of the record to extract.

Data type: Integer


r0 = from(bucket:"example-bucket")
    |> 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

Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: