Consultor Eletrônico



Kbase P109912: FILL() method for a ProDataSet pulls unexpected data.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.0x

SYMPTOM(s):

FILL() method for a ProDataSet pulls the wrong data.

In the destination TEMP-TABLE, unexpected field(s) pull data from unexpected source table field(s).

When attaching the data source via the ATTACH-DATA-SOURCE() method, the "field-mapping" option contains unqualified field names.

Fields in the destination TEMP-TABLE have the same name as fields in the data source table.

CAUSE:

This is a known issue.

To date, the documentation sets wrong expectations as to how ATTACH-DATA-SOURCE() should interpret the fields listed, because it looks like OpenEdge should resolve the first item in a pair-list as a field in the database buffer, while it should resolve the second item as the field in a TEMP-TABLE.

This is not how it ATTACH-DATA-SOURCE() was designed, though.

There is no assumption that the source is the first member of the pair, and in fact the first member and second member of the pair are both looked up in the dataset buffer. If either one matches, OpenEdge then looks the other one up in the TEMP-TABLE.

The following exemplifies the behavior described (you need to be connected to a copy of the sports database):

DEFINE TEMP-TABLE ttCust NO-UNDO
FIELD Name AS CHARACTER
FIELD Address AS CHARACTER.

DEFINE DATASET ds FOR ttCust.

DEFINE DATA-SOURCE dsCust FOR customer.

BUFFER ttCust:ATTACH-DATA-SOURCE(DATA-SOURCE dsCust:HANDLE, "Name,Address").

MESSAGE BUFFER ttcust:DATA-SOURCE-COMPLETE-MAP
VIEW-AS ALERT-BOX.

The DATA-SOURCE-COMPLETE-MAP attribute reveals that field customer.Address was mapped to field ttCust.Name.

FIX:

Full-qualify the field names in the "field-mapping" option, that is:

BUFFER ttCust:ATTACH-DATA-SOURCE(DATA-SOURCE dsCust:HANDLE, "customer.Name,ttCust.Address").