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(fn: (key) => key._field == "fieldName")
Parameters
Make sure fn
parameter names match each specified parameter.
To learn why, see Match parameter names.
fn
A predicate function for matching keys in a table’s group key.
tableFind
returns the first table that resolves as true
.
Expects a key
argument that represents a group key in the input stream.
Data type: Function
Example fn function
(key) => key._field == "fieldName"
Example
t = from(bucket:"example-bucket")
|> 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()
.
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.