toBool() function
The toBool()
function converts all values in the _value
column to booleans.
Function type: Type conversion
toBool()
Supported data types: Float | Integer | 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.
Examples
from(bucket: "telegraf")
|> filter(fn:(r) =>
r._measurement == "mem" and
r._field == "used"
)
|> toBool()
Function definition
toBool = (tables=<-) =>
tables
|> map(fn:(r) => ({ r with _value: bool(v: r._value) }))
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.