jcant
New Member
First of all I'm sorry for the confusing title. Summarizing my need, what I need is that in the example below the last-of of break by is the record of id 3, not the record of id 4.
The record of id 4 should not appear.
What I think is that when the break by clause is used, all records are thrown into memory, and if I update some record brought in for each, the where filter is not applied.
My name is Jonas and I'm Brazilian.
The record of id 4 should not appear.
What I think is that when the break by clause is used, all records are thrown into memory, and if I update some record brought in for each, the where filter is not applied.
My name is Jonas and I'm Brazilian.
Code:
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.