LAST-OF function

Returns a TRUE value if the current iteration of a DO, FOR EACH, or REPEAT . . . BREAK block is the last iteration for a particular value of a break group.

Syntax

LAST-OF ( break-group )
break-group
The name of a field or expression you named in the block header with the BREAK BY option.

Example

This procedure uses LAST-OF to display a single line of information on each Item.CatPage group in the Item file, without displaying any individual item data. It produces a report that shows the aggregate value OnHand for each catalog page.

r-lastof.p

FOR EACH Item NO-LOCK BREAK BY Item.CatPage:
  ACCUMULATE Item.OnHand * Item.Price (TOTAL BY Item.CatPage).
  IF LAST-OF(Item.CatPage) THEN 
    DISPLAY Item.CatPage (ACCUM TOTAL BY Item.CatPage 
      Item.OnHand * Item.Price) LABEL "Value-oh".
END.

See also

FIRST function, FIRST-OF function, LAST function