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

Status
Not open for further replies.
J

jcant

Guest
In the code example below, why does the id = 4 record continue to appear, knowing that in the where there is a clause deleting records with added <> "S"? If I remove the break by clause, then the record does not appear, but I need break by to use the last-of, and I need the last-of to be true in the id = 3 record. def temp-table tt-test field id as int field customer as int field added as char. create tt-test. assign tt-test.id = 1 tt-test.customer = 100 tt-test.added = "". create tt-test. assign tt-test.id = 2 tt-test.customer = 100 tt-test.added = "". create tt-test. assign tt-test.id = 3 tt-test.customer = 100 tt-test.added = "". create tt-test. assign tt-test.id = 4 tt-test.customer = 100 tt-test.added = "". def buffer b-tt-test for tt-test. for each tt-test where tt-test.added <> "S" break by tt-test.customer: if tt-test.id = 2 then for first b-tt-test where b-tt-test.id = 4: assign b-tt-test.added = "S". end. disp tt-test.id tt-test.added last-of(tt-test.customer). end.

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