The Function Tree

Function Tree

Add a function

To add a function, click on the Functions tree with the right mouse button. A pop up menu appears. In the menu select the New Function choice. This opens the template selection dialog, in which you select the template for your function. For example, if you want to sum two numerical matrices together, you can select the plus template.

The function editor window opens up. Here you set up input and output matrices and parameters of the function.
Once the function is saved, it appears on the function tree view in the project toolbox, in the same way as seen for the matrices. Its output matrices appear on the matrix tree view.

Edit a function

Right click with the mouse on the function name in the tree and select the Edit Function menu. The function editor opens, with the entered input matrices, output matrices and parameters in place. You can change them and save the function again.

Remove one or more functions

To remove one or more functions:
At this point, the system tries to remove all the selected matrices.
The only possible reason why you cannot remove a function is that a timer executes it. In this case a message like the following is showed:

Remove function error

In this case, to be able to remove the function, first remove the timer, then the function.

If it is possible to remove the functions, you need to confirm.

When you remove a function, the output matrices of the function are saved with the last content they assumed before the function was removed.
After the function has been removed they can be edited (they are base matrices).

View a function

Right click with the mouse on the function name in the tree and select the View Function menu, which opens the Function Viewer. You can also open the viewer double-clicking on the function's name.

Rename a function

Right click with the mouse on the function name in the tree and select the Rename Function menu. The name-package dialog appears. Set the new name and package and click OK. The function is renamed, both in the project toolbox and in the file system.

Move one or more functions

Right click with the mouse on the function name in the tree and select the Move Functions menu. Select the package where you want to move the function to using the choose package dialog. If you select more functions all will be moved to the final package.

Comment a function

Right click with the mouse on the function name in the tree and select the Comment Function menu. Then you can write your comment in the comment dialog.

Force a function recalculation

Right click with the mouse on the function name in the tree and select the Force Recalculation menu. The function is recalculated and its output matrices assume the newly calculated values.
It should be never needed to manually recalculate a function because a function is recalculated automatically when one of the input matrices changes its content.
In some specific cases, however, it can be useful, for example:

Get some information about a function

Right click with the mouse on the function name in the tree and select the Info Function menu. The function information view appears.

Duplicate a function

Right clicking with the mouse on the function name in the tree and selecting the Duplicate Function menu the function editor is opened to create a function that has the same content of the duplicated function: same input matrices and same parameters. Only the output matrices are not assigned, because clearly they must be created with the function.
A typical reason to duplicate a function is when you need to create several functions with the same template and parameters of another one(for example different queries with the same JDBC parameters).

Start the Expression Parser

In the popup menu that appears right clicking on the tree select the Expression Parser menu. In this way you open the Expression Parser wizard, used to write text expressions that are transformed in functions and matrices.