Consultor Eletrônico



Kbase P147494: 4GL/ABL: How to invoke a User Defind Functions ( UDF ) whose name is stored in a CHARACTER variable
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   05/06/2009
Status: Unverified

GOAL:

4GL/ABL: How to invoke a User Defined Functions ( UDF ) whose name is stored in a CHARACTER variable or a CHARACTER field or a CHARACTER expression at runtime?

GOAL:

What is the syntax to execute a User Defined Function whose name is stored in a CHARACTER variable or a CHARACTER field or a CHARACTER expression at runtime?

GOAL:

How to run a User Defined Function whose name is referenced by a CHARACTER variable or a CHARACTER field or a CHARACTER expression at runtime?

GOAL:

How to call a User Defined Function whose name is stored in a CHARACTER variable or a CHARACTER field or a CHARACTER expression at runtime?

GOAL:

How to execute a User Defined Function whose name is returned by a CHARACTER variable or a CHARACTER field or a CHARACTER expression at runtime?

GOAL:

How to use the DYNAMIC-FUNCTION function to invoke a User Defined Function whose name is returned by a CHARACTER variable or a CHARACTER field or a CHARACTER expression at runtime?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.1x
OpenEdge 10.x

FIX:

The following sample procedure demonstrates how to invoke a User Defined Function whose name is stored in a TEMP-TABLE field. It uses the DYNAMIC-FUNCTION function to call a User Defined Functions whose names are passed as TEMP-TABLE CHARACTER field values.
Although this sample invokes User Defined Functions whose names are stored in TEMP-TABLE CHARACTER field values, the DYNAMIC-FUNCTION function may also be used to run User Defined Functions whose names are CHARACTER variables and CHARACTER expressions values at runtime:
DEFINE VARIABLE iCounter AS INTEGER NO-UNDO.
DEFINE TEMP-TABLE ttFunctionNames NO-UNDO
FIELD cFunctionName AS CHARACTER.
/* User Defined Function Prototypes Declarations */
FUNCTION 01FunName RETURNS INTEGER (INPUT parm1 AS INTEGER) FORWARD.
FUNCTION 02FunName RETURNS INTEGER (INPUT parm1 AS INTEGER) FORWARD.
FUNCTION 03FunName RETURNS INTEGER (INPUT parm1 AS INTEGER) FORWARD.
DO iCounter = 1 TO 3:
CREATE ttFunctionNames.
ASSIGN
cFunctionName = STRING (iCounter,"99") + "FunName".
END.

/* User Defined Function Definitions */
FOR EACH ttFunctionNames:
MESSAGE DYNAMIC-FUNCTION (cFunctionName, 3)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
FUNCTION 01FunName RETURNS INTEGER (INPUT parm1 AS INTEGER):
RETURN (1 * parm1).
END FUNCTION.
FUNCTION 02FunName RETURNS INTEGER (INPUT parm1 AS INTEGER):
RETURN (2 * parm1).
END FUNCTION.
FUNCTION 03FunName RETURNS INTEGER (INPUT parm1 AS INTEGER):
RETURN (3 * parm1).
END FUNCTION.