TO_BOOLEAN
Description
TO_BOOLEAN
is a row function that converts TEXT
, BOOLEAN
, INTEGER
, LONG
, or NUMERIC
values to BOOLEAN
.Syntax
TO_BOOLEAN
(expression
)Return Value
Returns one value per row of type
BOOLEAN
.Input Parameters
- expression
- Required. A field or expression of typeTEXT,BOOLEAN,INTEGER,LONG, orNUMERIC.The function converts these values to true:1, 1.0, "true", "t", "yes", "y", "1"The function converts these values to false:0, 0.0, "false", "f", "no", "n", "0"The function converts all other values to NULL.
Examples
Convert the values of the
is_contingent
field to a Boolean:TO_BOOLEAN([is_contingent])
These expressions return true:
TO_BOOLEAN("TRUE")
TO_BOOLEAN("1")
TO_BOOLEAN(1.0)
These expressions return false:
TO_BOOLEAN("False")
TO_BOOLEAN("0")
TO_BOOLEAN(0.0)
These expressions return NULL:
TO_BOOLEAN("correct")
TO_BOOLEAN("1.0")
TO_BOOLEAN(1.1)