MAXIMUM function

Compares two or more values and returns the largest value.

Syntax

MAXIMUM ( expression , expression [ , expression ] ... )
expression
A constant, field name, variable name, or expression. If there is a mixture of decimal and integer data types, decimal type is returned.

Example

In this procedure, if the CreditLimit value is under 20,000, the procedure adds 10,000 to that value. Otherwise, the procedure sets CreditLimit to 30,000. The MAXIMUM function determines the greater of the original CreditLimit value and the new cred-lim2 value.

r-maxmum.p

DEFINE VARIABLE cred-lim2 AS DECIMAL NO-UNDO FORMAT ">>,>>9.99".

FOR EACH Customer NO-LOCK:
  cred-lim2 = IF Customer.CreditLimit < 20000 THEN
    Customer.CreditLimit + 10000 ELSE 30000.
  DISPLAY Customer.CreditLimit cred-lim2
    MAXIMUM(cred-lim2, Customer.CreditLimit) 
      LABEL "Maximum of these two values".
END.

Notes

See also

MINIMUM function