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.
Parameters
idx
Index of the record to extract.
table
Input table.
Default is piped-forward data (<-
).
Example
The following example uses data provided by the sampledata
package
to show how getRecord()
transforms data.
import "sampledata"
sampledata.int()
|> tableFind(fn: (key) => key.tag == "t1")
|> getRecord(idx: 0)
// Returns {_time: 2021-01-01T00:00:00.000000000Z, _value: -2, tag: t1}
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.