Utility functions

  • Updated

Outlines the utility functions that are available in NetScript.

to_string(input)

Use this function to convert any input value to a string.

Function

to_string(input)

Data type – string

Example

to_string(5)

Result

"5"

to_int(input)

Use this function to convert any input value to an integer.

Function

to_int(input)

Data type – string

Example

to_int(10.1) 
to_int('10')

Result

"10"
"10"

to_boolean(input)

Use this function to convert any input value to a boolean.

Function

to_boolean(input)

Data type – boolean

Example

to_boolean('true') 

Result

"true"

to_float(input)

Use this function to convert any input value to a float.

Function

to_float(input)

Data type – float

Example

to_float('10.5') 

Result

10.5

to_timestamp(input)

Use this function to convert any input value to a timestamp.

Function

to_timestamp(input)

Data type – timestamp

Example

to_timestamp(dateColumn) 

Result

"2024-01-01 08:00:00"

coalesce

Use this function to return the first non-null value in a list of two or more arguments.

Function

coalesce

Example

coalesce(null, 1)

Result

1