It is possible to define one or more variables in the InterFormNG2 designer. The advantage is, that you can use variables e.g. to add up all the detail lines of a page and output the page total in the footer.
You can also use variables in normal XPath functions.
Another kind of variable is the workflow variable, which can be used for sending variables/information from the workflow to the template.
You can create or update a variable in the designer if you first click the plus icon (+) in the top and then the (x) icon as marked below:
After adding a variable element you will see this:
The parameters are:
Name
Here you should state the name of the variable. The variable name should be written as a plain text (not an Xpath expression) and the variable name is written without an initial dollar sign. The variables in InterFormNG2 are case sensitive. A hyphen inside the variable name is allowed (from version 4.0.2).
Please note, that the name of a variable is not allowed to start with a number, it cannot contain a dollar sign and the variable names are case sensitive.
Expression
Here you should state an Xpath expression which returns the value, that you want to assign to the variable. Since this is an Xpath expression you will need to single (or double) quotes around a fixed text if you want to use that. You refer to variables with a preceding $-sign.
This element will assign the text, Hello world to the variable, MyVar:
In a repeat loop you can also use a variable to keep track of the iterations by adding 1 to the variable inside the repeat like below:
You can use this to output the numbers 1 to 10 in this small template:
Here the Counter variable is first set to the initial value of 1, then a repeat of 10 is run and inside the repeat the current value of the variable is output via a text element (referrring to the Counter variable) an then the value of the Counter is increased.
Description
This parameter is an optional description of the element. It does not influence the functionality.
This video introduce the use of variables in the designer:
You can define two kinds of variables in your templates: A normal variable, which is defined and used only within the template. A workflow variable, which can be used for e.g. for sending user defined variable information from the workflow to a ...
You can use a table element to insert design elements in organized rows and columns. Each cell in the table can be surrounded by a border and/or filled out with a color. You can even create a dynamic table with a row for each detail line in the input ...
For more complex scenarios, XPath provides regular expressions, variable assignments, and special functions to manipulate and evaluate XML data dynamically. This section covers these advanced features. Working with regular expressions in XPath Using ...
You can make InterFormNG2 repeat a selection of elements in a sub-folder. The repeat element repeats e.g. the elements a number of times, where this number can be either fixed or found via an Xpath expression, but it can also repeat the sub-folder ...
If you want to insert any kind of text in InterFormNG2, then you should use the text element. You can insert a new text element if you click on this icon: The data, that you can output as text are these types: A text constant Drag nodes from an input ...