Consultor Eletrônico



Kbase P43560: How To Change The Base Query of a Dynamic Lookup
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

GOAL:

How To Change The Base Query of a Dynamic Lookup

FIX:

In this example we want to use the return value from getpropertylist api in the session manager to set the base query string our lookup uses.
The following code should be placed in the constructObject procedure of the viewer which contains the lookup:

DEFINE INPUT PARAMETER pcProcName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER phParent AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER pcPropList AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER phObject AS HANDLE NO-UNDO.

RUN SUPER
(INPUT pcProcName,
INPUT phParent,
INPUT pcPropList,
OUTPUT phObject).

DEF VAR myco AS CHAR.
IF phObject:TYPE = "PROCEDURE" THEN DO:
IF LOOKUP("getSDFFileName", phObject:INTERNAL-ENTRIES) <> 0 THEN DO:
IF DYNAMIC-FUNCTION("getSDFFileName":U IN phObject) = "salesrep1":U
/* the name of the lookup */
THEN DO:
myco = DYNAMIC-FUNCTION('getpropertylist' IN gshsessionmanager,
'currentOrganisationCode',
NO).
/* In this example we use currentorganisationcode */

DYNAMIC-FUNCTION("setBaseQueryString":U IN phObject,
INPUT "FOR EACH salesrep WHERE salesrep.compcode = '" + myco +
"' NO-LOCK").
/* Changes the base query to use the return property from the getpropertylist api */
END.
END.
END.
END PROCEDURE.