@TextToNumber (Formula Language)
Converts a text string to a number, where possible.
Syntax
@TextToNumber( string )
Parameters
string
Text or text list. The string you want to convert to a number. If the string contains both numbers and letters, it must begin with a number to be converted properly. For example, the string "12ABC" converts to 12, but "ABC12" produces an error.
Return value
number
Number or number list. The string, 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.
This function is useful for converting a number in a text field to a number that can be used for computation in a number field.
You can't use @TextToNumber to convert special text (such as that returned by @DocChildren or @DocDescendants) to a number.
@TextToNumber returns an error If you try to pass anything besides a string into it.
Examples
- This example returns 123 as a number.
@TextToNumber("123")
- This example returns 123 and 456 as a number list.
@TextToNumber("123" : "456")
- This example returns @ERROR if the contents of the field named
Cost cannot be converted to a number.
@TextToNumber(Cost)