Consultor Eletrônico



Kbase P31884: Example of how to do a nested for each loop.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/25/2003
Status: Unverified

GOAL:

Example of how to do a nested for each loop.

FIX:

The following is an example of a simple nested for each statement. It requires the sports2000.db


Sample Syntax;

FOR EACH customer:
FOR EACH order OF customer:
FOR EACH orderline OF order:
FOR EACH ITEM OF orderline:
DISPLAY NAME Item.Itemnum Item.CatDescription
WITH SIDE-LABELS 1 DOWN CENTERED.
END.
END.
END.
END.


This is the same example as above but it's structure has been optimized.
It is better to optimize code blocks where possible to reduce the action code segment size.

FOR EACH customer, EACH order OF customer, EACH orderline OF order, EACH ITEM OF orderline:
DISPLAY NAME Item.Itemnum Item.CatDescription
WITH SIDE-LABELS 1 DOWN CENTERED.
END.