Consultor Eletrônico



Kbase P74995: Dyn: Same lookup used in 2 SDV's dataTarget of an SBO. The 2nd is always display same value as the
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/10/2005
Status: Unverified

FACT(s) (Environment):

Dynamics 2.1A

SYMPTOM(s):

Same lookup used in 2 SDV for 2 different tables

Datasource is an SBO

The viewers were built against SDO's

Saving one record in a viewer updates the lookup located in the other viewer

Dynamics 2.1A01

CAUSE:

Known issue. The right value of the lookup is saved into the database, but the display mechanism fails by showing the same value as the lookup of the first viewer.

At some point, the lookup calls columnValue in the SBO without providing the SDO name as prefix in the fieldName input param. The reason is that viewer was designed against a SDO, and is used now with a SBO.  It should actually find out that it is being used against an SBO and use SDOName.FieldName when calling API's in the dataSource.

FIX:

The following work around has been tested successfully in Dynamics 2.1A01.  The trick is to change the fieldName of lookups that make problem (the ones that exist in more than one SDV that are dataTargets of the SBO) to prefix it with the SDO name, like if the viewers were built against an SBO. Note that this solution does not work with dyn combo's

Implement the following code before RUN SUPER in intializeObject of the SDV's.DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.

{get dataSource hDataSource}.

IF DYNAMIC-FUNCTION('instanceOf':U IN hDataSource , "SBO") THEN DO:

/*OK, the data source is a SBO, lets rename the fieldname property of the SDF's
with SDOName in prefix, so we will avoid interferences with same SDF used in another
viewer that would be also a data target of this SBO */

/*Sample with one lookup (salesrep_obj) used in 2 SDV that are datatarget of the SBO
You may want to go through all the fields to detect the SDF's and run the
following code for all of them*/

DEFINE VARIABLE hSDF AS HANDLE NO-UNDO.
DEFINE VARIABLE cNameWithSDO AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDataSourceNames AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCurrentFieldName AS CHARACTER NO-UNDO.

hSDF = widgetHandle("salesrep_obj").

{get fieldName cCurrentFieldName hSDF}.

IF NUM-ENTRIES(cCurrentFieldName,".") = 1 THEN DO:
{get dataSourceNames cDataSourceNames}.
cNameWithSDO = cDataSourceNames + "." + cCurrentFieldName.
{set fieldName cNameWithSDO hSDF}.
END.
END.

RUN SUPER.

END PROCEDURE.