content/flux/v0/stdlib/universe/getcolumn.md
getColumn() extracts a specified column from a table as an array.
If the specified column is not present in the table, the function returns an error.
(<-table: stream[A], column: string) => [B] where A: Record
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
({{< req >}}) Column to extract.
Input table. Default is piped-forward data (<-).
import "sampledata"
sampledata.int()
|> tableFind(fn: (key) => key.tag == "t1")
|> getColumn(column: "_value")// Returns [-2, 10, 7, 17, 15, 4]
import "array"
import "sampledata"
columnData =
sampledata.int()
|> tableFind(fn: (key) => key.tag == "t1")
|> getColumn(column: "_value")
array.from(rows: [{_value: display(v: columnData)}])