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.

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.


Input table. Default is piped-forward data (<-).


The following example uses data provided by the sampledata package to show how getRecord() transforms data.

import "sampledata"
    |> tableFind(fn: (key) => key.tag == "t1")
    |> getRecord(idx: 0)
// Returns {_time: 2021-01-01T00:00:00.000000000Z, _value: -2, tag: t1}

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.