How to: |
You are able to create your own functions by using the Define Function Wizard. The Define Function Wizard assists in the creation of a user function. The created functions can later be retrieved through the Function Arguments dialog box using the Retrieve User Functions button. Click Retrieve User Functions so that your created functions will be available for use.
To create a user defined function:
The Add Procedure dialog box opens.
Note: You can also select Define Function from the component connector, however, the user functions created through this method will only be applicable to that specific procedure. User Functions created through the Add Procedure dialog box will be available for use by all procedures within the APP PATH.
The Define Function Wizard opens, as shown in the following image.
The Name part of the Define Function Wizard is displayed, as shown in the following image.
The Parameters section of the Define Function Wizard is displayed, as shown in the following image.
You can rename the parameters by double-clicking on the name column. For each parameter, clicking the ellipsis button in the Format column will open the Format dialog box, allowing you to edit the format of that parameter. Double-clicking in the Description column for each parameter will allow you to edit the description for parameter.
The Defined Fields section of the Define Function Wizard is displayed. One defined field (with the same name as your function) is already entered, as shown in the following image.
A function is comprised of expressions that returns a value to the caller of the function.
You can rename the fields by double-clicking on the name column. For each field, clicking the ellipsis button in the Format column will open the Format dialog box, allowing you to edit the format of that field. Clicking the ellipsis button in the Expression column will open a dialog where you can edit what the function will do.
Note: The last defined field must have the same name as the function. This is why one defined field is already entered with the same name as the function. If multiple expressions are present, then the defined field with the same name as the function must be in the last position, as shown in the following image. If no defined field has the same name as the function or if the defined field is not in the last position, you will be unable to progress to the next window.
The Complete the Define Function Wizard window is displayed. The function, as well as its parameters and logic, are displayed before completion, as shown in the following image.
The Define Function Wizard opens to a new window, as shown in the following image.
If there are no more functions you want to create, clicking OK will close the Wizard with all functions created.
This can be done as many times as needed, allowing you to create multiple functions in the procedure, without having to exit and repeat certain steps.
Select a function and click Edit to open the Define Function Wizard. Here you can change any part of the already created function by going through each window.
Select a function and click Delete to delete the function.
The Define tool opens.
The Function Arguments dialog box opens.
Note: The Function Arguments dialog box can also be accessed from the Report Options Compute tab and the Expression Builder.
The functions you created using the Define Function Wizard are available for use, as shown in the following image.
Once the user functions have been loaded, the Retrieve User Functions button becomes the Refresh User Functions button. Click this button to refresh your user functions and show any new user functions that have been added.
WebFOCUS |