toUInt() function

Flux 0.7.0+

The toUInt() function converts all values in the _value column to UIntegers.


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.

Supported data types
  • bool
  • duration
  • float
  • int
  • string (numeric)
  • time

toInt() behavior depends on the _value column data type:

_value typeReturned value
bool1 (true) or 0 (false)
durationNumber of nanoseconds in the specified duration
floatUInteger equivalent of the float value truncated at the decimal
intUInteger equivalent of the integer
stringUInteger equivalent of the numeric string
timeEquivalent nanosecond epoch timestamp



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


The following examples use data provided by the sampledata package to show how toUInt() transforms data.

Convert a float value column to a uinteger column

import "sampledata"

  |> toUInt()

View input and output

Convert a boolean value column to a uinteger column

import "sampledata"

  |> toUInt()

View input and output

Convert a uinteger value column to a integer column

import "sampledata"

  |> toUInt()

View input and output

Function definition

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

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.