InfluxDB Docs

toFloat() function

The toFloat() function converts all values in the _value column to floats.

Function type: Type conversion


Supported data types: Boolean | Integer | Numeric String | Uinteger

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.


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

Function definition

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

Used functions: map(), float()

New! Cloud or OSS?