Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Calculated merge fields allow you to use a scripting language (PHP) to perform calculations. Creating calculated merge fields is an advanced topic and requires a some understanding of computer programming and in particular PHP.  However it is fairly easy to create simple calculations by performing simple math on variable. 

Note for security reasons only a limited subset of the PHP commands are available.

A calculated merge field is typically used when you need to add a new field to a document that is based on a calculation of existing fields. For example if you have designed a workflow for a property settlement you may need to calculate the rates apportionment on settlement day by dividing the amount already paid by how many days the new buyer will benefit from those rates after settlement day.  This amount usually gets added to the final amount payable at settlement.  This is easily achieved with a calculated merge field.

Creating a new calculated merge field

From the top navigation bar go to Admin / "Document Templates" / "List of Merge Fields". This will show a list of all available merge fields in the system.  

Tip: If you just want to see existing calculated merge fields then filter the list on "Data Source" = "Calculated Field".

Click the "Add Calculated Field" button above the list to create a new calculated merge field.

Testing your merge field

Calculated merge field will inherit the environment in which they run. So for example if they are placed in an action they will have access to the attributes of the action (action ID, action name, participants, custom data, etc). If they are used in an accounting invoice template then they will have access to the invoice details (line items, tax, totals, invoice number, etc).

You can test you merge field by selecting an action ID or sale/purchase ID (invoice) to run it against.

  • No labels