tableFind() function

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

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")



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

Make sure fn parameter names match each specified parameter. To learn why, see Match parameter names.

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


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().