This example introduces the notation used to perform simple Math and Logic calculations in the templates.
It explores how to call Math functions and format the results that are displayed in the finished document.
It is best to view the TEMPLATE and OUTPUT files side-by-side to understand the calculations being performed.
Math calculations
You can perform Math within your template by enclosing the expression in curly brackets.
For example: << { 10.0 * 5.5 } >> will display 55.0 in the finished document.
Math can be performed on the data being inserted in to the template.
Formatting
The results of calculations may need to be formatted using other functions to achieve the desired result in the finished document.
For example: << { round ( 10.0 * 5.5 ) } >> will round the result and display 55 in the finished document.
For a complete discussion on formatting please see the Format-Numbers example.
Logic calculations
You can perform Logic operations such as comparisons ( less than, greater than, equal to ) as well as AND/OR within the template, which is most useful in Conditional Sections.
Try changing the data value for "length" so that it is greater than and less than 1000 to see the effect in the finished document.
Math functions
For a full list of Math Functions see the Template Guide.