Converts a number in character format into numeric format.
Must be a Character Expression.
Objects: Procedure, Transaction, Web Panel
Generators:.NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
This function converts the numbers of a character expression into a numeric type. It processes the numbers in the character expression from left to right until a non-numeric character is encountered. If the first character of the character expression is not a number, the result of Val function will be 0.
&Result = Val('-123.35') // Result is -123.35
&Result = Val(STR(123.35, 6, 2)) // Result is 123.35
&Result = Val('ABC') // Result is 0 (*)
&Result = Val('12A') // Result is 12 (*)
&WebSesNbr = Val(&SessionId) // where &WebSesNbr is N(10.0) and &SessionId is C(30)
(*) Converting alphanumerics to numerics is not supported when the method is evaluated in the DBMS (see Server Side Functions/Methods or SAC 42709).