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.
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.
Example fn function
(key) => key._field == "fieldName"
tables
Input data.
Default is piped-forward data (<-
).
Example
The following example uses data provided by the sampledata
package
to show how tableFind()
transforms data.
import "sampledata"
t = sampledata.int()
|> tableFind(fn: (key) => key.tag == "t2")
// t represents the first table in a stream whose group key
// contains "tag" with a value of "t2".
You can use t
from the example above as input for getColumn()
and getRecord()
.
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.