Consultor Eletrônico



Kbase P17665: How to relay an API call to the AppServer from a thin client in ADM2?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Verified

GOAL:

How to relay/forward a procedure or function override to the AppServer from a thin client in ADM2?

GOAL:

How to relay/forward a procedure or function override to the AppServer with a split SmartDataObject in ADM2?

GOAL:

Sample code to relay/forward an API call to AppServer

GOAL:

How to relay/forward an API call to AppServer?

FIX:

Example to forward an override of addRow() function to AppServer in a SDO:

1) Uncheck DB-REQUIRED so the code is available on both the AppServer side and the Client Proxy side

2) Put the following piece of code:

IF DYNAMIC-FUNCTION('getASDivision':U) = "client":U THEN
DO:
ASSIGN hAS = DYNAMIC-FUNCTION("getASHandle" IN hSDO).
RETURN SUPER(DYNAMIC-FUNCTION("addRow" IN hAS, pcViewColList)).
END.
ELSE
DO: /*Fat client or AppServer*/
{&DB-REQUIRED-START}
[Code to run with connection to DB]
{&DB-REQUIRED-END}
END.

Note the definition of the following preprocessors in /template/data.w:

&GLOBAL-DEFINE DB-REQUIRED-START &IF {&DB-REQUIRED} &THEN
&GLOBAL-DEFINE DB-REQUIRED-END &ENDIF

Note that with Dynamics, the DYNAMIC-FUNCTION calls of getASDivision and getASHandle need to be done IN TARGET-PROCEDURE in order to reach the SDO. For example:

DYNAMIC-FUNCTION('getASDivision':U IN TARGET-PROCEDURE)