Consultor Eletrônico



Kbase P130204: FIND with OF does not find a joined record related to a temp table record.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/06/2010
Status: Verified

SYMPTOM(s):

FIND with OF does not find a joined record related to a temp table record.

FIND statement with the OF keyword does find the expected record in the database table, but fails with a temp table.

FACT(s) (Environment):

The temp table is defined LIKE a database table.
In the following code there is a primary unique index in table2 on the fields field1+field2+field3, but even though the temp table record (and fields are available) the table2 record is not found.:

DEFINE TEMP-TABLE TT_Table1 LIKE Table1.
FIND LAST Table1 WHERE Table1.field1 > '' NO-LOCK.
BUFFER-COPY Table1 TO TT_Table1.

FIND table2 OF TT_Table1 NO-LOCK NO-ERROR.
MESSAGE 'tmp OF' SKIP
AVAIL table2 SKIP
TT_Table1.field1
TT_Table1.field2
TT_Table1.field3
VIEW-AS ALERT-BOX INFO BUTTONS OK.
With a database table, the following does find the associated record:

FIND LAST Table1 WHERE Table1.field1 > '' NO-LOCK.

FIND table2 OF Table1 NO-LOCK NO-ERROR.
MESSAGE 'DB OF' SKIP
AVAIL table2 SKIP
Table1.field1
Table1.field2
Table1.field3
VIEW-AS ALERT-BOX INFO BUTTONS OK.
All Supported Operating Systems
OpenEdge 10.x
Progress 9.x
OpenEdge Category: Language (4GL/ABL)

CAUSE:

This is expected behavior. The OF phrase is not reliable when there are multiple indexes with lead fields in common, or fields that can be abbreviated to other fields.

FIX:

Use a WHERE clause and explicitly specify the table join fields.