Minimum Version Required: 23.01
Pre-Conditions
Required Permission - FusionEdit
Recommended Fusion I/II Certification
Steps
The TO_NUMBER function converts the selected value to a numeric value. If it cannot be converted the result will be an error. The TRY_TO_NUMBER function is similar however, if a value cannot be converted, the result is NULL instead of receiving an error. This is similar to Try_Cast however, with this function, the data type is already defined in the function (Number) so you only need to define the value or expression you want to convert.
TO_NUMBER
Convert the value to a numeric value, if it cannot be converted, it will throw an error
Syntax
TO_NUMBER(Value)
Arguments
Value: The text value to convert to a number
Example
TO_NUMBER('123') = 123
TO_NUMBER('abc') = error, not supported
TRY_TO_NUMBER
Tries to convert the value to a numeric value, if it cannot be converted, returns NULL
Syntax
TRY_TO_NUMBER(Value)
Arguments
Value: The text value to try to convert to a number
Example
TRY_TO_NUMBER('123') = 123
TRY_TO_NUMBER('abc') = NULL