Table of Contents

Search

  1. Preface
  2. Taskflows and linear taskflows
  3. Taskflows
  4. Linear taskflows

Taskflows

Taskflows

toInteger

toInteger

Converts a string or numeric value to an integer. The toInteger syntax contains an optional argument that you can choose to round the number to the nearest integer or truncate the decimal portion. The toInteger function ignores leading spaces.

Syntax

util:toInteger(
value
,
flag
)
The following table describes the arguments:
Argument
Required/
Optional
Description
value
Required
Must be a string or numeric data type. Passes the value that you want to convert to an integer.
You can enter any valid transformation expression.
flag
Optional
Specifies whether to truncate or round the decimal portion. The flag must be an integer literal or the constants TRUE or FALSE:
  • toInteger truncates the decimal portion when the flag is TRUE or a number other than 0.
  • toInteger rounds the value to the nearest integer if the flag is FALSE or 0 or if you omit this argument.

Return Value

Integer.
NULL if a value passed to the function is NULL.
0 if a value passed to the function contains alphanumeric characters.

Example

The following expressions use values from the column IN_TAX:
util:toInteger(IN_TAX, fn:boolean(1))
The following table lists some sample values and return values:
IN_TAX
RETURN VALUE
'15.6789'
15
'60.2'
60
'118.348'
118
NULL
NULL
'A12.3Grove'
0
'    123.87'
123
'-15.6789'
-15
'-15.23'
-15
If a bigint column is mapped to a column with integer data type, an issue occurs.
To avoid this issue, you must have the data type of the column same throughout the mapping. If you need to assign bigint to the integer column, ensure that the data being passed does not exceed the range of integer.
Bigint range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Integer range: -2,147,483,648 to 2,147,483,647

0 COMMENTS

We’d like to hear from you!