INTEGER function
Converts an expression of any data type, with the exception of BLOB, CLOB, and RAW, to a 32-bit integer value of data type INTEGER, rounding that value if necessary.
expression
A constant, field name, variable name, or expression. If the value ofexpression
is a CHARACTER, it must be valid for conversion into a number (for example, “1.67" is valid, “1.x3" is not). Ifexpression
is an object reference (CLASS), the result is the ABL-generated ID for the class instance. Ifexpression
is a LOGICAL, the result is 0 ifexpression
is FALSE and the result is 1 ifexpression
is TRUE. Ifexpression
is a DATE, the result is the number of days from 1/1/4713 B.C. to that day. Ifexpression
is the Unknown value (?
), the result is the Unknown value (?
).ExampleThis procedure takes the first word (that is, the substring that precedes the first space character) from the Customer
Address
and tries to convert it to an integer (street-number). If the conversion fails (for example, the first word contains non-numeric characters) the procedure displays an error message. Otherwise theCustNum
,Address
, and converted street number are displayed.
See also
OpenEdge Release 10.2B
|