Try OpenEdge Now
skip to main content
Programming Interfaces
Input/Output Processes : Creating Reports : Generating reports from multiple tables : Reporting information from one table
 
Reporting information from one table
First, the accounting department needs to sort out which customers have exceeded their credit limits or those who are close to exceeding the limits. All Around Sports wants Accounting to look at all customers that have balances equal to or greater than 85 percent of their credit limits. All of this information is in the Customer table.
A single FOR EACH with a WHERE clause is what you need to gather this information. The following code fragment from i-10-06.p shows this structure.
i-10-06.p
...
FOR EACH Customer NO-LOCK
  WHERE Customer.Balance >= (Customer.CreditLimit * .85) WITH STREAM-IO:
  DISPLAY
    Customer.Name FORMAT "x(20)"
    Customer.Contact FORMAT "x(15)"
    Customer.Balance
    Customer.CreditLimit
    WITH NO-BOX.
END.
...
The WHERE clause selects just the customers over the 85 percent threshold, and the DISPLAY statement outputs the key information about these customers. Running this procedure yields the following output: