Documentation

toInt() function

The toInt() function converts all values in the _value column to integers.

Function type: Type conversion

toInt()

Supported data types: Boolean | Duration | Float | Numeric String | Time | Uinteger

For duration and time values, toInt() returns the following:

Input typeReturned value
DurationThe number of nanoseconds in the specified duration
TimeA nanosecond epoch timestamp

To convert values in a column other than _value, define a custom function patterned after the function definition, but replace _value with your desired column.

Examples

from(bucket: "telegraf")
  |> filter(fn:(r) =>
    r._measurement == "mem" and
    r._field == "used"
  )
  |> toInt()

Function definition

toInt = (tables=<-) =>
  tables
    |> map(fn:(r) => ({ r with _value: int(v: r._value) }))

Used functions: map(), int()


New! Cloud or OSS?

InfluxDB OSS 2.0 release candidate

InfluxDB OSS v2.0.rc includes breaking changes that require a manual upgrade from all alpha and beta versions. For information, see:

Upgrade to InfluxDB OSS v2.0.rc