[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: For Each with Where and Break By

Status
Not open for further replies.
P

Patrice Perrot

Guest
Hi , A little more explanation on the word "packet" , i am not using it for the packet send/recived in this case. When you are using a Break by / First-Of / Last-Of , your query know the "next" record to evaluate the "Last" , i am using the word "packet" for the records that your query "know". I think it will be more understandable with the exemple below , on the second disp there is NO "LAST-OF". DEF TEMP-TABLE tt-test FIELD id AS CHAR FORMAT "X(5)" FIELD customer AS INT FORMAT ">>9" FIELD info AS CHAR FORMAT "X(35)" INDEX i1 id customer . DEF VAR ii AS INT NO-UNDO. DEF VAR jj AS INT NO-UNDO. DO ii = 97 to 99 : DO jj = 1 to 4 : CREATE tt-test . ASSIGN tt-test.id = CHR(ii) tt-test.customer = jj . CASE jj : WHEN 1 THEN tt-test.info = "First" . WHEN 3 THEN tt-test.info = "Before last => After delete LAST" . WHEN 4 THEN tt-test.info = "Last" . END CASE . END. END. FOR each tt-test BREAK BY id : disp tt-test.id tt-test.customer tt-test.info FIRST-OF (id) LAST-OF (id) . END. PAUSE 5 . DEFINE BUFFER b-del FOR tt-test . FOR each tt-test BREAK BY id : IF tt-test.customer = 3 THEN FOR EACH B-del WHERE b-del.id = tt-test.id AND b-del.customer = 4 : delete b-del . END. DISP tt-test.id tt-test.customer tt-test.info FIRST-OF (id) LAST-OF (id) . END.

Continue reading...
 
Status
Not open for further replies.
Top