tableFind() function

The tableFind() function extracts the first table in a stream of tables whose group key values match a predicate. If no table is found, the function errors.

Function type: Stream and table

tableFind(column: "_value")

Parameters

fn

A predicate function for matching keys in a table’s group key. tableFind returns the first table that resolves as true. It expects a key argument which represents a group key in the input stream.

Data type: Function

Example fn function
(key) => key._field == "fieldName"

Example

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

// t represents the first table in a stream whose group key
// contains "_field" with a value of "usage_idle".

You can use t from the example above as input for getColumn() and getRecord().

This documentation is open source. See a typo? Please, open an issue.


Need help getting up and running? Get Support