The Function
Editor
The
function editor contains normally 4 panels. If
the template does not define parameters, or input matrices or output
matrices, the related panel is missing.
Here
are
the panels:
Template Info Panel
It
contains some
information about the template from which the function is
built. It shows the fields:
- Info:
a description of the
function
- Input
matrices: the minimum and maximum amount of input matrices.
The minimum amount of matrices defines the number of mandatory
matrices. The matrices over the minimum to the maximum amount are
optional.
- Output
matrices: the minimum and maximum amount of output matrices.
Input Matrices Panel
It contains a table where you can enter the matrices that are required as input of the
function. For example, in case of the plus (+) function, you need as
input the two matrices to sum. When the editor for a new function is
opened, the list contains a line for each needed input matrix.
Foe
each line (each input matrix) the first two columns show: a name
that identifies the matrix in the function (for example
“addendum1” in the plus function) and the required type
of the matrix and.
The type of the required matrix can be NUMERIC, TEXT, DATE, BOOLEAN or
ANY.
ANY
means that that input matrix can be of any type but you need to choose
one when creating the function. ANY is used when the template is
generic, can work with any type of matrix, for example the
“tostring” template which converts a matrix of any
type to a text matrix.
To see a description of the
function in the selected row click on the Description
button. A message box with the description appears.
To set an input matrix you select the matrix
and click on the Set
Matrix button, which opens the matrix selection dialog.
Double-clicking
on a table row has the same effect of the Set Matrix button.
Alternatively
you can drag&drop the matrix from the
matrices tree view in
the project: select the matrix in the matrices
tree view with the left button of the mouse and, keeping the
mouse
button pressed, move the cursor to the line of the input matrices panel
that you want to fill, and release the left mouse button.
In
both cases the matrix fills the line: the “Chosen
Matrix” column of the line, which was initially empty, is
filled with the name and the package of the chosen matrix.
Clicking
the Clear Row button the selected row is cleared:
any matrix that was set for this row with the Set Matrix button is
removed from it, leaving the “Chosen Matrix” field
of the row empty.
It is not told
that all the input matrices lines need to be filled. Some of the
matrices can be optional. For example you could
make a function that sums all the input matrices, being them a number
between 2 and 32. In this case the first 2 matrices are mandatory (need
to be filled) but the last 30 are optional. You
can know which matrices are mandatory and optionals looking at the
minimum-maximum amount of input matrices in the Template Info panel.
When you save the function, the input matrices list must contain at
least the minimum number of matrices, at most the maximum. The input
matrices lines can be filled in any
order, but at the end the list of filled matrices must be consecutive,
without holes.
The Output Matrices Panel
It contains a table where you can enter the matrices required as the result of the
function. To fill the output
matrices lines you need to select the line to fill and click on the Set
Matrix button.
This is what happens if you are entering a standard
output matrix (callback column empty), clicking on the Set
Matrix button:
If the matrix definition type is ANY, the
actual type of the matrix is requested through the matrix type dialog.
After
that you need to give a name-package to the matrix using the name-package dialog.
Since these matrices are the
result of the function, Matrex verifies that they don't exist
when the function is built (if they exist they have been produced by
another function or with the matrix editor). If everything is ok they
are created when the function is saved.
If the callback column contains the value "Yes", the output matrix is callback.
In this case, the matrix needs to be already in the project when the
function is added, and it must be a base matrix (not output of any other function).
The Set Matrix button opens the matrix
selection dialog
to select the callback matrix: since the matrix must be already in the
project, it must be selected from the base matrices of the project.
Also
here you have mandatory
and optional
matrices. You can know which matrices are mandatory and optionals
looking at the minimum-maximum amount of output matrices in the
Template Info panel. The same considerations seen for the optional
input matrices can be done here.
Parameters
Panel
It Contains
some constant
parameters to the function. Differently from the input matrices, they
are simple fields, not matrices and they don't change during the life
of the function. Also
the parameters can be of different types, NUMERIC, TEXT, DATE or
BOOLEAN.
Some parameters are entered as text, other are selectable in
a dropdown list.
When the parameter if of TEXT
type you can use the ...
button to open a special editor to enter it.
The editor type depends by how this parameter is declared in the
template:
- If it is declared as NORMAL_TEXT, the editor is a
multiline text box, that simplifies editing
small texts.
- If it is declared as FILE, it is assumed that the text must
be the path of a file, so you can select it in an Open File dialog.
The tooltip of the text box shows
anyway the whole text.
Parameters of DATE
type can be entered in the text box in the format decided in the GUI
settings, or, by clicking on the ... button, with the help of the date/time picker dialog.
Parameters can be selected from a dropdown list
instead of being entered in a text box, if the template requires it.
The dropdown list looks like this:
Like
with the input and output matrices, some parameters are mandatory, some
are optional.
You can distinguish an optional parameter because the background of its
text is gray, not white.
To close the editor, you can:
- click on
the Cancel button on the bottom of the editor. In
this way you close the editor without saving the content of the
function (you need to confirm this choice).
- click
on the Save button on the
bottom of the editor. In this way you save the content of the function
and close the editor. To do that, you need to enter the name and the
package of the new function in the name-package
dialog, in the same way
as with the matrices.
Only if the function is complete (all
the
mandatory input matrices, output matrices, parameters have been set),
it is possible to save. If these conditions are not satisfied an error
appears (“Not enough...”) and it is possible to fix
the problem.
When you save it, the
function is calculated and all the output matrices are created (or
overwritten if you edited an existing function with the same output
matrices).