getColumn() function

The getColumn() function extracts a column from a table given its label. If the label is not present in the set of columns, the function errors.

*Function type: Stream and table*

  1. getColumn(column: "_value")

Use tableFind() to extract a single table

getColumn() requires a single table as input. Use tableFind() to extract a single table from a stream of tables.

Parameters

column

Name of the column to extract.

*Data type: String*

Example

  1. vs = from(bucket:"example-bucket")
  2. |> range(start: -5m)
  3. |> filter(fn:(r) => r._measurement == "cpu")
  4. |> tableFind(fn: (key) => key._field == "usage_idle")
  5. |> getColumn(column: "_value")
  6. // Use column values
  7. x = vs[0] + vs[1]

Related articles