Calling a Function

How to:

You can call a function from a COMPUTE, DEFINE, or VALIDATE command. You can also call functions from a Dialogue Manager command, a Financial Modeling Language (FML) command, or a MODIFY command. A function is called with the function name, arguments, and, for external functions, an output field.

For more information on external functions, see Types of Functions.

Syntax: How to Call a Function

function(arg1, arg2, ... [outfield])

where:

function

Is the name of the function.

arg1, arg2, ...

Are the arguments.

outfield

Is the field that contains the result, or the format of the output value enclosed in single quotation marks. This argument is required only for external functions.

In Dialogue Manager, you must specify the format.

Syntax: How to Store Output in a Field

COMPUTE field/fmt = function(input1, input2,... [outfield]);

or

DEFINE FILE file
field/fmt = function(input1, input2,... [outfield]);

or

-SET &var = function(input1, input2,... [outfield]);

where:

DEFINE

Creates a virtual field that may be used in a request as though it is a real data source field.

COMPUTE

Calculates one or more temporary fields in a request. The field is calculated after all records have been selected, sorted, and summed.

field

Is the field that contains the result.

file

Is the file in which the virtual field is created.

var

Is the variable that contains the result.

fmt

Is the format of the field that contains the result.

function

Is the name of the function, up to eight characters long.

input1, input2,...

Are the input arguments, which are data values or fields used in function processing. For more information about arguments, see Supplying an Argument in a Function.

outfield

Is the field that contains the result, or the format of the output value enclosed in single quotation marks. This argument is required only for external functions.

In Dialogue Manager, you must specify the format.