what's the difference between two function FIRST and FIRST-OF

plant

New Member
what's the difference between two function FIRST and FIRST-OF when used with BREAK BY phrase?

Thanks
 

bendaluz2

Member
FIRST Function

Returns a TRUE value if the current iteration of a DO, FOR EACH, or REPEAT . . . BREAK block is the first iteration of that block.

SYNTAX

-----------------------------------------------------------
FIRST(break-group)
-----------------------------------------------------------

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)
-----------------------------------------------------------


plant said:
what's the difference between two function FIRST and FIRST-OF when used with BREAK BY phrase?

Thanks
 

Jenie888

Member
plant said:
what's the difference between two function FIRST and FIRST-OF when used with BREAK BY phrase?

Thanks

FOR EACH customer BREAK BY location:

IF FIRST(location) THEN
DO:
// This code will be executed on the first record in the loop.
// Will only fire one time.
END.


IF FIRST-OF(location) THEN
DO:
// This code will be executed on the first record of each location.
// Therefore if there is 30 locations, then it will fire 30 times, on the first
// customer record for each location.
END.


END.
 
Top