Utility Functions

  • Updated

This page outlines all the utility functions that are available in NetScript.

to_string(input)

This function returns the input cast to string. Input can be any value.

Function: to_string(input)

Data Type: string

Example:

to_string(5)

Result:

"5"

to_int(input)

This function returns the input cast to integer. Input can be any value.

Function: to_int(input)

Data Type: string

Example:

to_int(10.1) 
to_int('10')

Result:

"10"
"10"

to_boolean(input)

This function returns the input cast to boolean. Input can be any value.

Function: to_boolean(input)

Data Type: boolean

Example:

to_boolean('true') 
Result:
"true"

to_float(input)

This function returns the input cast to float. Input can be any value.

Function: to_float(input)

Data Type: float

Example:

to_float('10.5') 
Result:
10.5

to_timestamp(input)

This function returns the input cast to timestamp. Input can be any value.

Function: to_timestamp(input)

Data Type: timestamp

Example:

to_timestamp(dateColumn) 
Result:
"2024-01-01 08:00:00"

coalesce

This function returns the first non-null value in the list of 2 or more arguments.

Function: coalesce

Example:

coalesce(null, 1)
Result:
1