findColumn() function
The findColumn()
function returns an array of values in a specified column from the
first table in a stream of tables where the group key values match the specified predicate.
The function returns an empty array if no table is found or if the column label
is not present in the set of columns.
Function type: Stream and table
findColumn(
fn: (key) => key._field == "fieldName",
column: "_value"
)
Parameters
fn
A predicate function for matching keys in a table’s group key.
Expects a key
argument that represents a group key in the input stream.
Data type: Function
column
Name of the column to extract.
Data type: String
Example
vs = from(bucket:"example-bucket")
|> range(start: -5m)
|> filter(fn:(r) => r._measurement == "cpu")
|> findColumn(
fn: (key) => key._field == "usage_idle",
column: "_value"
)
// Use column values
x = vs[0] + vs[1]
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.