Reporting information from two tables
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
The next step is to look at the orders for each selected
customer. This information is in the Order table.
Another FOR EACH inside the first
accomplishes this task. For each iteration of the outer block, the
inner block finds all the related information. The WHERE clause
establishes the relationship between the two tables.
The code from i-10-07.p shows the nested FOR EACH blocks.
i-10-07.p
|
The following output shows how the related information ends up grouped together:

Notice that for a single iteration of the Customer data, there may be several iterations of Order data. Earlier you learned that the default frame of an iterating control block is a down frame. When you nest control blocks, only the innermost block uses a down frame. The other blocks execute one iteration at a time. This default behavior lets the related information group together naturally with the iteration of the blocks.