Calling a Function From a DEFINE, COMPUTE, or VALIDATE Command

In this section:

How to:

You can call a function from a DEFINE command or Master File attribute, a COMPUTE command, or a VALIDATE command.


Top of page

x
Syntax: How to Call a Function From a COMPUTE, DEFINE, or VALIDATE Command
DEFINE [FILE filename] 
tempfield[/format] = function(input1, input2, input3, ... [outfield]);
COMPUTE 
tempfield[/format] = function(input1, input2, input3, ... [outfield]);
VALIDATE 
tempfield[/format] = function(input1, input2, input3, ... [outfield]);

where:

filename

Is the data source being used.

tempfield

Is the temporary field created by the DEFINE or COMPUTE command. This is the same field specified in outfield. If the function call supplies the format of the output value in outfield, the format of the temporary field must match the outfield argument.

format

Is the format of the temporary field. The format is required if it is the first time the field is created; otherwise, it is optional. The default value is D12.2.

function

Is the name of the function.

input1, input2, input3...

Are the arguments.

outfield

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

In Dialogue Manager, you must specify the format. In Maintain, you must specify the name of the field.


Top of page

x
Calling a Function With the Define Tool and Compute Tool

How to:

In WebFOCUS Developer Studio, you can add a function to a DEFINE or COMPUTE command using the Define and Compute tools. For more information on these tools, see the Creating Reports With Graphical Tools manual.



x
Procedure: How to Add a Function With the Compute Tool
  1. In the Compute tool, click the Functions button. A list of functions appears.
  2. Click the function you want to use. The function's syntax appears in the window with placeholders for the argument values.
  3. Replace the syntax placeholders with the values you want to use, and click OK.


x
Procedure: How to Add a Function With the Define Tool
  1. In the Define tool, enter the name of the virtual field you are creating in the Field input box.
  2. Enter a format in the Format input box, or click the Format button to specify the field's format. The format must be compatible with the function's output format.
  3. Click the Functions tab. A list of functions appears.
  4. Click the function you want to use. The function's syntax appears in the expressions window with placeholders for the argument values.
  5. Replace the syntax placeholders with the values you want to use, and click Close.

WebFOCUS