PreviousNextIndex

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
Example

This 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 the CustNum, Address, and converted street number are displayed.

r-intgr.p
DEFINE VARIABLE street-number AS INTEGER NO-UNDO LABEL "Street Number". 
FOR EACH Customer NO-LOCK: 
  ASSIGN street-number = INTEGER(ENTRY(1, Customer.Address, " ")) NO-ERROR. 
  IF ERROR-STATUS:ERROR THEN  
    MESSAGE "Could not get street number of" Customer.Address. 
  ELSE  
    DISPLAY Customer.CustNum Customer.Address street-number. 
END. 

See also

DECIMAL function, STRING function


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex