Skip to main content

Simple Math with Merge Fields

Updated over a year ago

Baseline Software offers a powerful feature for doing math directly inside document templates using merge fields. This feature is particularly beneficial for users who need to generate customizable templates using specific loan information.

Merge fields allow users to insert specific data from a loan into a document template. These fields act as placeholders that are replaced with real data when the document is generated. For example, you can include fields like «Loan_Amount», «Interest_Rate», or «Per_Diem» directly in your template.

Performing Calculations within Merge Fields

Baseline Software supports performing calculations using merge fields information within a document. This feature uses a simple notation that is both powerful and user-friendly.

The basic syntax for a mathematical operation within a merge field is:

«= math("expression", "format")»

A wide variety of mathematical expressions are supported such as:

  • Arithmetic operations

  • Matrix operations

  • Unit conversions

The result of the calculation may formate using any of the following:

  • "currency" → $1,000.00

  • "number" → 23,000 or 0.123

  • "percentage" → 15.12%

⚠️ These formatting options are case sensitive, make sure to write them in lower case.

Example:

Suppose you want to calculate the Price per Square Foot on a loan amount. You can use the Address_Purchase_Price and the Gross_Livable_Area_GLA as variables in your calculation and format the result as currency:

«= math("Address_Purchase_Price / Gross_Livable_Area_GLA", "currency")»

The result for this equation considering a Purchase Price of $160,000.00 and a Gross Livable Area of 800 Sq Ft is :

«= math("160000 / 800", "currency")» → $200.00 


Tips for Using Math in Document Templates

  1. Test Your Expressions: Before adding calculations to your template, test the expressions to ensure they return the correct values, using a simple document.

  2. Keep it Simple: While it's tempting to use complex calculations, remember that simpler expressions are easier to maintain and debug.

  3. Create Custom Fields: Create the custom fields in your products needed on your merge fields and expressions beforehand to maintain consistency through the loans.

Sample Document

To illustrate the practical application and the output of our mathematical merge fields, below is a sample document template snippet and an accompanying image showing the result after the document is generated.

Sample Document Template:
This template utilizes merge fields to dynamically insert data into various forms commonly used inside documents.

Displayed Result:

This image should illustrate how the merge fields translate into a finalized document, clearly showing the result of adding the calculations into the documents

Attachment icon
Did this answer your question?