@ToNumber (Formula Language)
Converts a value to a number.
Note: This @function is new with Release 6.
Syntax
@ToNumber( value )
Parameters
value
Text, number, or list thereof. A value that cannot be converted returns the error, "The value cannot be converted to a Number."
Return value
number
Number or number list. The value converted to a number.
Usage
If the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements. A failure occurs if any element cannot be converted.
This function is useful for ensuring that a value has a number data type before using it in functions that require numbers as parameters.
Examples
- This example returns 20 and 40 in a list.
@ToNumber("20" : "40")
- This example results in the error, "The value cannot be converted
to a Number."
@ToNumber("20" : "r")
- This example converts the values in a text field, containing "20,"
and a number field containing 10, into numbers so that they can be
added using the @Sum function, which requires two numbers. The formula
returns 30.
@Sum(@ToNumber(numberField);@ToNumber(textField))