Declare a Variable
In use or preview mode, only numbers and no letters can be entered in the text input fields associated with the variables. Point and comma are reserved as decimal separators for numerical input, so the calculation function only recognizes them as such. Therefore, you cannot use periods or commas as thousand separators.
Tip
If you have a text field in which the user should only enter numbers, you can enter the variable in the text field as a command. You do not need a calculation function for this.
Then link the variable as a placeholder on the text page.
Determine a Calculation
On the text page (right side in the application), the calculation function can be inserted at the desired position. Type in the calculation operator ::calc [calculation with the previously defined variables] (you can also type ::c[ ]). Within the square brackets, you can perform the desired calculations with the variables defined previously. To do this, only the name of the variables must be entered.
The following operators can be used:
+ for the addition
– for subtracting
/ for dividing
* for multiplying
% to get the modulo when dividing two variables (e.g. 12 % 5 = mod 2, 12 % 11 = mod 1, 12 % 3 = mod 0)
** to exponentiate a variable (e.g. 2**3 = 8, 3**2 = 9)
The "dot before dash"-principle applies. The calculation operator is automatically highlighted in green. In use or preview mode, the result is displayed directly instead of the calculation operator. You can of course also add brackets and numbers to the calculations to create even more complex calculations.
Subsequent Editing of Calculation Function
Move the cursor to the desired paragraph. Use the left/right key to move the cursor to the calculation function highlighted in green. As soon as the outline appears, you can use the backspace key on the keyboard to convert the function to plain text and edit it. When you have finished editing, the calculation function or operator should be highlighted green again.
Options for the Calculation Function
For the calculation function (on the text page), options can be entered within the square brackets to format/modify the desired result. Use the left and right keys for subsequent editing (see Subsequent Editing of Calculation Functions).
fraction(2) - number of decimal places
Tip
You can use "fraction(0)" to command that the number is rounded.
decimal(comma/point) - decimal separator comma or point
thousands(comma/point/space/apostrophe/prime) - Representation of the separation of thousands sections - NOTE: Numbers in the questionnaire must always be entered without thousands separators. Only the output is formatted.
words(12) - Display the number in words up to a maximum number. The language depends on the language selected in the template.
Example 1: ::calc[a/b decimal(comma) thousands(point) fraction(3)]
Example 2: ::calc[a words(10000000)]
Editor:
Preview:
How to display the euro and cent amounts separately for monetary amounts:
Preview:
How to declare a variable within a calculation:
Tip
You can also simply display the "intermediate result" again at another point. To do this, declare:
::calc[result1]
Serial Calculation
The calculation with serialized variables is of course also possible. First, create the variables and the calculation as described above. Link the text fields containing the serialized variables to the serial question. Then link the paragraph containing the calculation to the same serial question.
Then the serialized calculation will be executed in the document to be created.
Tip
You can also use serialized and non-serialized variables mixed in these calculations.
Attention
Please do not combine the calculate function with the result as a variable (::calculate [a+b variable(result1)] with the other options shown.