TO_INT
Description
TO_INT
is a row function that converts Text
,
Boolean
, Integer
, Long
, or
Double
values to Integer
(whole number) values.
When converting Double
values, everything after the decimal will be
truncated (not rounded up or down).Syntax
TO_INT
(expression
)Return Value
Returns one value per row of type
Integer
.Input Parameters
- expression
- Required. A field or expression of typeText,Boolean,Integer,Long, orDouble. If aTextfield contains non-numeric characters, the function returns NULL.
Examples
Convert the values of the
average_rating
field to an Integer field type:TO_INT([average_rating])
Convert the
flight_duration
field to an Integer field type, but first transform
the occurrence of any NA
values to NULL values using a CASE
expression:TO_INT(CASE WHEN [flight_duration]="N/A" then NULL ELSE [flight_duration]
END)