Function: Val
Description
Converts a string to a number. The string must begin with a numeric character or a negation sign. If the string contains any non-numeric characters (apart from a decimal point) the function will convert the numeric portion of the string up to the first non-numeric character it encounters.
Syntax
Val(string)
Arguments
string is the string to convert. This argument can be a constant, a character field, an expression that results in a string or a function that returns a string.
Return value
This function returns a number.
Calculated field example
If the Prod_code field contained the value of PZ-123B, the following calculated field expression would return 123: Val(Substr(Prod_code,4,3))
Filter/Find example
Records with a Prod_code field value of TC-789A or RB-800C can be selected or found using the expression: Val(Substr(Prod_code,4,3))>=789
Note: These examples incorporate the Substr function to extract a substring from a string.
© 2024 Altair Engineering Inc. All Rights Reserved.