Consultor Eletrônico



Kbase P9809: How to retrieve the content of a record in a parent SDO of a
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/03/2003
Status: Unverified

GOAL:

ADM2: in a Visual Smart Object, how to retrieve the content of a field in a parent SDO?  (SDO data-linked to SDO of the Visual Smart Object)?

FIX:

1) The following piece of code might take place in a widget trigger or in any procedure or function of the Visual Smart Object:DEFINE VARIABLE hSource1 AS HANDLE NO-UNDO.
DEFINE VARIABLE hSource2 AS HANDLE NO-UNDO.
DEFINE VARIABLE ReturnedValue AS CHARACTER NO-UNDO.

hSource1 = DYNAMIC-FUNCTION('getDataSource':U).

IF VALID-HANDLE(hsource1) THEN
hSource2 = DYNAMIC-FUNCTION('getDataSource':U IN hsource1) NO-ERROR.

IF VALID-HANDLE(hsource2) THEN
ReturnedValue = DYNAMIC-FUNCTION('getCurrentMyField':U IN hsource2) NO-ERROR.

/* Now let's display ReturnedValue it in a widget of handle hMyWidget */
IF NOT ERROR-STATUS:ERROR THEN DO:
/* Needed if you want the following to be taken as an update
DYNAMIC-FUNCTION('setDataModified':U,
INPUT NOT hMyWidget:SCREEN-VALUE = ReturnedValue).*/
hMyWidget:SCREEN-VALUE = ReturnedValue.
END.
2) Add a User Defined Function in the Parent SDO called getCurrentMyField that does the following: IF AVAIL rowObject THEN RETURN rowObject.MyField.
ELSE RETURN "No Rowobject Available!".
END FUNCTION.