#calc & #var
Perform calculations within templates by using the following data helpers:
- #calc
- #var
#calc
The #calc data helper performs the defined calculation and outputs the result into the template.
The data helper supports addition, subtraction, division, multiplication and ukvatrate.
Addition
Values | Data Marker | Output |
5 7.50 |
| 12.50 |
search.fee = 100.00 land.registration.fee = 7.00 |
| 107.00 |
Subtraction
Values | Data Marker | Output |
12 4 |
| 8.00 |
property.price = 350,000 deposit.amount = 30,000 |
| 320,000.00 |
Division
Values | Data Marker | Output |
6 3 |
| 2 |
deposit.amount = 20,000 |
| 10,000 |
Multiplication
Values | Data Marker | Output |
9 9 |
| 81 |
fees.our.legal.fee = 100 |
| 200 |
UK VAT
settings.ukvatrate can be used to include the current UK VAT rate into calculations
Data Marker | Output |
| The legal fees VAT |
| The legal fee including it's VAT rate |
Australia GST
settings.ausgstrate can be used to include the current Australian GST rate into calculations
Data Marker | Output |
| The legal fees GST |
| The legal fee including it's GST rate |
#var
A #var Data Helper can be used to recall previously defined figures within a template.
To use this:
- Define the conditions of the #var, for example:
{{#var $discount = fees.our.legal.fee * 0.2}}
- Use the newly created var statement to recall the figure
{{$discount}}
will outputfees.our.legal.fee * 0.2
##comments
data helper to add internal notes and commentary. A great way of ensuring calculations are easily understood!I.e. {{#var $total = fees.legal + fees.leasehold}}{{## a combined total of the legal and leasehold fee}}
These comments are only displayed when viewing the calculations within the form or template builder.
#abs
The #abs Data Helper can be used to covert a negative value to a positive.
Values | Data Marker | Output |
$legalfee = -5 |
| 5 |
Greater Than and Less Than Symbols
< / > can be used to define an output depending on the value of a field
Data Marker | Output |
| If the legal fee is more than 0, output: We owe you If the legal fee is less than 0, output: You owe us |