toBool() function

The toBool() function converts all values in the _value column to booleans.


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
  • string: true or false
  • int: 1 or 0
  • uint: 1 or 0
  • float: 1.0 or 0.0



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


The following example uses data provided by the sampledata package to show how toBool() transforms data.

Convert an integer value column to a boolean column

import "sampledata"

    |> toBool()

View input and output

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.