Consultor Eletrônico



Kbase 18812: ADM2 - How to Use GetDataSource Function on Smart.p to Invoke Functions in a SmartDataObject (SDO)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Verified

GOAL:

How to use getDataSource Function in smart.p to invoke functions in a
SmartDataObject (SDO)

GOAL:

ADM2

FACT(s) (Environment):

Progress 9.x

FIX:

The getDataSource function (found in smart.p) will return either the handle to the object that is the source side of a DATA-SOURCE link or the unknown value (?) if there is no link.

This function can be used when you want to invoke functions in a SmartDataObject.

The following sample code shows how to use this function to retrieve the CreditLimit field (a decimal) from a SmartDataObject (and the object which runs this code does not have the CreditLimit field as one of the fields being manipulated or visually displayed).  This code assumes that you have created a getCreditLimit function in the SmartDataObject and that the function returns a decimal data type.

/* The following code displays a message box containing the value   */
/* returned from the getCreditLimit function that exists in a       */
/* SmartDataObject.  Please note that *YOU* would have written the  */
/* getCreditLimit function as it is not automatically generated.    */

DEFINE VARIABLE hdlSource AS HANDLE  NO-UNDO.
DEFINE VARIABLE decLimit  AS DECIMAL NO-UNDO.

ASSIGN hdlSource = DYNAMIC-FUNCTION('getDataSource').

IF hdlSource ? THEN
   DO:
       ASSIGN decLimit = DYNAMIC-FUNCTION('getCreditLimit' IN hdlSource).
       MESSAGE decLimit VIEW-AS ALERT-BOX.
   END.
ELSE
   MESSAGE 'EEK!  I have no data source':U VIEW-AS ALERT-BOX.