Consultor Eletrônico



Kbase P112576: Adding records in a child SDO does not propagate foreign field values from the parent record selecte
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/22/2009
Status: Verified

SYMPTOM(s):

Adding records in a child SDO does not propagate foreign field values from the parent record selected in the parent SDO.

Running with a thin client session (ICFRUNTIME)

Child SDO is initialized at later point than parent SDO (it is on a different page or in a child container)

ForeignValues property is not set in child SDO when it is initialized

FACT(s) (Environment):

ForeignValues property is set in child SDO after parent SDO has been navigated
The problem does not happen in a database-bound session
Progress 9.1D
Progress 9.1E
Dynamics 2.1B
OpenEdge 10.0A
OpenEdge 10.0B
All Supported Operating Systems
Dynamics

CAUSE:

Bug# OE00121417

FIX:

Upgrade to OpenEdge 10.1A or later
Upgrade to OpenEdge 10.0B05 or later
Upgrade to Dynamics 2.1B02 or later

Possible workarounds:

1. Work around the problem locally in the child SDO initializeObject override with the following code:


RUN SUPER.
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE cForeignValues AS CHARACTER NO-UNDO.
DEFINE VARIABLE lOpenOnInit AS LOGICAL NO-UNDO.

{get DataSource hDataSource}.
{get OpenOnInit lOpenOnInit}.
{get ForeignValues cForeignValues}.
IF VALID-HANDLE(hDataSource) AND lOpenOnInit AND cForeignValues = ? THEN
RUN dataAvailable IN TARGET-PROCEDURE ("").


2. Alternatively a more generic solution is to add the following code in a datacustm.p AddRecord override:

RETURNS CHARACTER
(INPUT pcViewColList AS CHARACTER) :

DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE cForeignFields AS CHARACTER NO-UNDO.
DEFINE VARIABLE cForeignValues AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTrueForeignFields AS CHARACTER NO-UNDO.
DEFINE VARIABLE iForeignField AS INTEGER NO-UNDO.
DEFINE VARIABLE eForeignField AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTrueForeignValues AS CHARACTER NO-UNDO.
DEFINE VARIABLE iNumForeignfields AS INTEGER NO-UNDO.

&SCOPED-DEFINE xpDataSource
&SCOPED-DEFINE xpForeignFields
&SCOPED-DEFINE xpForeignValues

&SCOPED-DEFINE xp-assign
{get DataSource hDataSource}
{get ForeignFields cForeignFields}
{get ForeignValues cForeignValues}
iNumForeignfields = NUM-ENTRIES(cForeignfields).
&UNDEFINE xp-assign

IF VALID-HANDLE(hDataSource) AND cForeignValues = ? THEN
DO:
DO iForeignField = 1 TO iNumForeignfields BY 2:
eForeignField = ENTRY(iForeignField,cForeignfields).
IF NUM-ENTRIES(eForeignField,".") > 1 THEN
eForeignField = ENTRY(2, eForeignField, ".").
cTrueForeignFields = cTrueForeignFields + "," + eForeignField.
END.
ASSIGN cTrueForeignFields = SUBSTR(cTrueForeignFields, 2) /* remove first ',' */
cTrueForeignValues = DYNAMIC-FUNCTION('colValues' IN TARGET-PROCEDURE,
cTrueForeignFields)
cTrueForeignValues =
SUBSTR(cTrueForeignValues, INDEX (cTrueForeignValues, CHR(1)) + 1) /* remove rowIdents at the beginning of the list */
cTrueForeignValues = REPLACE(cTrueForeignValues, CHR(1), ",").
{set ForeignValues cTrueForeignValues}.
END.