TO_LONG
Description
TO_LONG
is a row function that converts TEXT
, BOOLEAN
, INTEGER
, LONG
, DECIMAL
, DATE
, or DOUBLE
values to LONG
(whole number) values. When converting DECIMAL
or DOUBLE
values, everything after the decimal will be truncated (not rounded up or down).Syntax
TO_LONG
(expression
)Return Value
Returns one value per row of type
LONG
.Input Parameters
- expression
- Required. A field or expression of typeTEXT(must be numeric characters only, no period or comma),BOOLEAN,INTEGER,LONG,DECIMAL,DATE, orDOUBLE. When aTEXTfield value includes a decimal, the function returns a NULL value.
Examples
Convert the values of the
average_rating
field to a Long field type:TO_LONG([average_rating])
Convert the
average_rating
field to a Long field type, but first transform the occurrence of any NA
values to NULL
values using a CASE
expression:TO_LONG(CASE WHEN [average_rating]="N/A" then NULL ELSE [average_rating] END)