Consultor Eletrônico



Kbase P18859: Last record created not returned by a FOR EACH with BREAK BY option
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/22/2010
Status: Unverified

SYMPTOM(s):

The last record is not returned by a FOR EACH with BREAK BY option.

Following code returning 2, 3 instead of the expected 1, 2, 3 :

DEF TEMP-TABLE tt_temp NO-UNDO
FIELD field1 AS INTE
FIELD field2 AS INTE
INDEX tt_temp_u1 IS PRIMARY UNIQUE field1 field2.

CREATE tt_temp.
ASSIGN tt_temp.field1 = 2.

CREATE tt_temp.
ASSIGN tt_temp.field1 = 3.

CREATE tt_temp.
ASSIGN tt_temp.field1 = 1.


FOR each tt_temp
break BY tt_temp.field1:
disp tt_temp.field1.
END.

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

CAUSE:

This behavior is caused by Progress delayed indexing and the way BREAK BY works. See the note below for detailed technical analysis.

FIX:

Use the statement:

VALIDATE tt_temp.

or the statement:

RELEASE tt_temp.

after the last ASSIGN to get the expected behavior.