Previous Next

FIRST-OF function
Returns a TRUE value if the current iteration of a DO, FOR EACH, or REPEAT . . . BREAK block is the first iteration for a new break group, and modifies all three block types.
Syntax 
 
FIRST-OF ( break-group )
break-group
The name of a field or expression you name in the block header with the BREAK BY option.
Example 
This procedure generates a report that lists all the item records grouped by catalog page. When the CatPage value changes, the procedure clears the current list of items and displays items belonging to the new catalog page. The FIRST-OF function uses the value of the CatPage field to determine when that value is different from the value during the last iteration.
 
FOR EACH Item BREAK BY Item.CatPage:
  IF FIRST-OF(Item.CatPage) THEN CLEAR ALL.
  DISPLAY Item.CatPage Item.ItemNum Item.ItemName.
END.
Note 
When you calculate in a block use the BREAK option to tell the AVM to calculate when the value of certain expressions changes. The AVM uses default formatting to display the results of these calculations. To control the formatting, use the FIRST-OF function to determine the start of a break group and then change the formatting.
See also 
DO statement, FIRST function, FOR statement, LAST function, LAST-OF function, REPEAT statement

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.