PreviousNextIndex

IF...THEN...ELSE function

Evaluates and returns one of two expressions, depending on the value of a specified condition.

Syntax

IF condition THEN expression1 ELSE expression2 

condition
expression1
expression2
Example

You can use the IF . . . THEN . . . ELSE function when you want to sort records in an unusual order. In this example, the Customers are sorted so that those with a Balance greater than $10,000 appear first, then those with Balances between $1,000 and $10,000, and finally those with Balance of $1,000 or less:

r-ifelsf.p
FOR EACH Customer NO-LOCK BY IF Customer.Balance > 10000 THEN 1 
  ELSE (IF Customer.Balance > 1000 THEN 2 ELSE 3) BY Customer.SalesRep: 
  DISPLAY Customer.SalesRep Customer.Balance Customer.Name. 
END. 


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex