Documentation

getColumn() function

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.

Function type signature
(<-table: stream[A], column: string) => [B] where A: Record
For more information, see Function type signatures.

Parameters

column

(Required) Column to extract.

table

Input table. Default is piped-forward data (<-).

Examples

Extract an array of column values from a table

import "sampledata"

sampledata.int()
    |> tableFind(fn: (key) => key.tag == "t1")
    |> getColumn(column: "_value")// Returns [-2, 10, 7, 17, 15, 4]

Extract an array of column values and display them in a table

import "array"
import "sampledata"

columnData =
    sampledata.int()
        |> tableFind(fn: (key) => key.tag == "t1")
        |> getColumn(column: "_value")

array.from(rows: [{_value: display(v: columnData)}])

Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.