1.6 KiB
1.6 KiB
title | description | aliases | menu | weight | flux/v0.x/tags | related | introduced | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
findColumn() function | The `findColumn()` function returns an array of values in a specified column from the first table in a stream of tables where group key values match the specified predicate. |
|
|
102 |
|
|
0.68.0 |
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.
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.
column
Name of the column to extract.
tables
Input data.
Default is piped-forward data (<-
).
Example
{{% flux/sample-example-intro %}}
import "sampledata"
sampledata.int()
|> findColumn(fn: (key) => key.tag == "t1", column: "_value")
// Returns [-2, 10, 7, 17, 15, 4]