docs-v2/content/influxdb/v2.0/reference/flux/stdlib/contrib/tickscript/compute.md

1.8 KiB

title description menu weight related
tickscript.compute() function The `tickscript.compute()` function is an alias for `tickscript.select()` that changes a column's name and optionally applies an aggregate or selector function to values in the column.
influxdb_2_0_ref
name parent
tickscript.compute TICKscript
302
/influxdb/v2.0/reference/flux/stdlib/contrib/tickscript/select/
/{{< latest "kapacitor" >}}/nodes/query_node/

The tickscript.compute() function is an alias for tickscript.select() that changes a column's name and optionally applies an aggregate or selector function.

import "contrib/bonitoo-io/tickscript"

tickscript.compute(
  column: "_value",
  fn: sum,
  as: "example-name"
)

TICKscript helper function

tickscript.select() is a helper function meant to replicate TICKscript operations like the following:

// Rename
query("SELECT x AS y")

// Aggregate and rename
query("SELECT f(x) AS y")

Parameters

column

Column to operate on. Default is _value.

Data type: String

fn

Aggregate or selector function to apply.

Data type: Function

as

({{< req >}}) New column name.

Data type: String

Examples

For examples, see tickscript.select().

{{% note %}}

Package author and maintainer

Github: @bonitoo-io, @alespour
InfluxDB Slack: @Ales Pour {{% /note %}}