Calculation
Elements that allow you to perform calculations among any templates in the same Template Suite using values inserted to TextInputs. Calculation Elements may also perform calculations in relation to one another.
Once a Calculation Element is clicked upon, a field to enter mathematical formulas appears below the top menu. Here the Calculation Element can be related to a TextInput or to another calculation, by using the “@” symbol followed by the System Name of the Element to be used in the calculation. The value may be combined with numbers, the four standard mathematical symbols: +; -; *; /, and parenthesis. Once a Calculation Element is clicked upon, details of the Element can be modified in the top menu with the following new tabs: Conditions; Tags; Warning; Help; and Design.The Help tab lets the template designer add Help text for a user generating a Smart Document from the template. In Document Editor, as the user hovers the cursor over an Element with Help text, a Help bubble will appear on the right column of the Document providing details on the nature of the calculation.If the calculated value falls outside of permissible parameters set by the template designer, then a warning message will appear. Template designers can choose any of the following mathematical expressions to set Warning parameters:
- Higher
- Higher or Equal
- Equal
- Not Equal
- Lower or Equal
- Lower
An example of a Warning, as seen in Task 7 of Lesson 2 in the Document Drafting Automation Basics Course can be to apply a formula that will send a warning message if the value entered into the TextInput (or Calculation) field is higher than the defined number.
List of the mathematical functions available for Calculations and links to their respective documentation:
- Round fractions up (ceil): https://www.php.net/manual/en/function.ceil.php
- Rounds a float (round): https://www.php.net/manual/en/function.round.php
- Round fractions down (floor): https://www.php.net/manual/en/function.floor.php
- Square root (sqrt): https://www.php.net/manual/en/function.sqrt.php
- Exponential expression (pow): https://www.php.net/manual/en/function.pow.php
- Find lowest value (min): https://www.php.net/manual/en/function.min.php
- Find highest value (max): https://www.php.net/manual/en/function.max.php
- Get value of pi (pi): https://www.php.net/manual/en/function.pi.php
- Natural logarithm (log): https://www.php.net/manual/en/function.log.php
Alternatively, you can use Scripts for Tags to create your own mathematical, statistical, or other functions.