Calculations

There are some Data Helpers that allow calculations to be done during the document creation process. This article will explain and provide examples of Data Helper's different functions regarding mathematical Calculations and how they could apply to your document. 

To learn more about how Data Helpers are used within the templating process, please refer to Data Helpers


'#calc' Data Helper

When used within an email or document template, '#calc' will perform a calculation at the point the email or document is generated. The Data Helper supports addition, subtraction, division, multiplication and ukvatrate. See below for examples of each of these:

Addition

{{#calc 5 + 7.50}} - Outputs 12.50.

{{#calc search.fee + land.registration.fee}} - If the search fee was 100.00 and the land registration fee was 7.00, then the output would be 107.00.

Subtraction

{{#calc 12 - 4}} - Outputs 8.

{{#calc property.price - deposit.amount}} - If the property's price was 350.000 and the deposit amount was 30.000, then the output would be 320.000.

Division

{{#calc 6 / 3}} - Outputs 2.

{{#calc deposit.amount / 2}} If the deposit amount was 20.000, then the output would be 10.000.

Multiplication

{{#calc 9 * 9}} - Outputs 81.

{{fees.our.legal.fee * 2}} - If your legals fees were 100, then 200 would be outputted.


UK VAT

If your document operates within the UK's VAT rate then this Data Helper will help. This Data Helper will keep on top of any changes to VAT within the UK for you. Here's how it works:

{{#calc fees.our.legal.fee * settings.ukvatrate}} - This will ouput the calculation of the legal fee's VAT 

{{#calc fees.our.legal.fee + fees.our.legal.fee * settings.ukvatrate}}- This will ouput your legal fee and the tax on top of it 

Australia GST

If your document operates within Australia's GST rate then this Data Helper will help. This Data Helper will keep on top of any changes to GST within Australia for you. Here's how it works:

{{#calc fees.our.legal.fee * settings.ausgstrate}} - This will ouput the calculation of the legal fee's GST

{{#calc fees.our.legal.fee + fees.our.legal.fee * settings.ausgstrate}}- This will ouput your legal fee and the GST on top of it


'#var' Data Helper

If you are doing numerous calculations in a document you may want to use '#var'. This enables you to give the calculation a name and then use that named calculation again in the document elsewhere. If you wanted to find out what the calculation of Our Legal Fee x 2 would be, you could use the '#calc' Data Helper. If you wanted to find out what this amount was and then show this figure numerous times within the document you would use a '#var'. 

#Var

  {{#var $legalfee=fees.our.legal.fee * 0.2}} {{$legalfee}}  - {{$legalfee}} now outputs the calculated figure when used anywhere else in the document.


'#abs' Data Helper

Occasionally you do a calculation and the figure will be a negative one. You may still like to show the figure as a positive number. In these scenarios you can use '#abs' before any figure.

#abs

{{#abs $legalfee}}- If the $legalfee total was a negative it will now be displayed as a positive.


Using greater than and less than symbols

Occasionally in a completion statement money is due to the Client and sometimes money is due from the Client. The < and > symbols can be used to change the wording around to ensure the correct statement is given.

<>

{{#if $legalfee > 0}} We owe you {{$legalfee}} {{#else}} you owe us {{$legalfee}}{{#endif}}

This example shows that if the legal fee calculation is greater than 0, the sentence will be 'We owe you' and then the legal fee amount. If the legal fee is less than 0, the sentence will be 'you owe us' then the legal fee amount.


Still need help? Contact Us Contact Us