Consultor Eletrônico



Kbase P107382: How to get an ADM2 SmartDataBrowse name and handle?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/15/2007
Status: Unverified

GOAL:

How to get an ADM2 SmartDataBrowse name and handle?

FIX:


Execute the following code from the trigger of sibling object. For example the following was placed behind a button on a SmartDataViewer.

DEFINE VARIABLE cTargets AS CHARACTER NO-UNDO.
DEFINE VARIABLE cType AS CHARACTER NO-UNDO.
DEFINE VARIABLE h_SDO AS HANDLE NO-UNDO.
DEFINE VARIABLE cSource AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE cName AS CHARACTER NO-UNDO.
DEFINE VARIABLE h_obj AS HANDLE NO-UNDO.
DEFINE VARIABLE h_SDB AS HANDLE NO-UNDO.

/* get SDO handle */
{get DataSource cSource}.
h_SDO = WIDGET-HANDLE(cSource).

cType = DYNAMIC-FUNCTION('getObjectType':U IN h_SDO).
MESSAGE cType.

/* get the data targets of the SDO */
{get dataTarget cTargets h_SDO}.

/* Find out which of the data targets is the SDB */
DO i = 1 TO NUM-ENTRIES(cTargets):
h_obj = widget-handle(ENTRY(i,cTargets)).
cname = DYNAMIC-FUNCTION('getObjectName':U IN h_Obj).
MESSAGE cname.
IF cname = "bCustomer" THEN
DO:
h_SDB = h_obj.
END.
END.