Working with Custom Forms Variables

General

You can use the entire set of variables available in LoanPro in your custom forms.  Most of the variables are straightforward in their usage, but some are less intuitive.  When you insert a variable into a form, the appropriate data from a customer file or customer account will be merged into the form in its place when the form is generated.

For more information regarding custom fields, see Using Custom Fields.

Working with Variables

To access a list of available variables while working with a custom form, click  Help Variables at the top right of the edit area.

You can use the search field to find variables you want to use.  For most variables, you can click the Help Variable ID to insert the variable into the edit area at the position where the cursor is located.

Array-Style Variables

Some variables let your merge data for which there are multiple values.  For example, if you wanted to merge the scheduled interest amount for a single payment into a form, you’d probably want to specify which payment you had in mind.  Since there are multiple scheduled payments on a loan, this variable is an array-style variable.

Array variables also contain all the data for a particular item or transaction.  For example, if you want to include the payment amount from a scheduled payment in a form, use the scheduled-payments variable in this way: [[v(‘scheduled-payments.INDEX.scheduled-payments.amount-principal’)]].  Now, you simply need to replace INDEX with a numeric value for a specific payment like this: [[v(‘scheduled-payments.0.amount’)]].  This will actually show the values for the first scheduled payment because the indexes for array variables start at 0 instead of 1.

You can also use array variables inside of a loop.

For example, if you want to loop through the payment schedule for a loan, you can enter a tag to start the loop like [[BEGIN scheduled-payments]] and a tag to end the loop like [[END]].  Between these two tags, you can use any of the individual properties of the array variable like this [[amount]].  So for example, if we have a payment schedule on a loan of 6 payments of $1,000.00 and 1 payment of $996.00, then we could print the schedule on a form like this:

[[BEGIN scheduled-payments]] 

[[$amount]]

[[END]]

This would output:

1000.00

1000.00

1000.00

1000.00

1000.00

1000.00

996.00

Notice the hard return before the [[END]] tag to make a line break between rows.

Secondary Customers

Because there are usually more than one borrowers per account, extra customer's on an account are considered as an array. This means that when when adding secondary customer information to a custom form, it is important to add the variables with an IF ELSE statement. This is formatted as follows:

[[IF customer.secondary.first-name ]][[v('customer.secondary.full-name')]][[ELSE]][[END]]

The statement above tells the system: If there is a secondary customer first name associated with the account, display the name. If there is no secondary customer first name associated with the account, display nothing.

If the IF ELSE statement is not used for secondary customer variables on custom forms and there is no secondary customer associated with the account for which the form is generated, the variable will display "Array".

Here is a list of commonly used secondary customer variables formatted with IF ELSE statements:

  • Secondary First Name

[[IF customer.secondary.first-name ]][[v('customer.secondary.full-name')]][[ELSE]][[END]]


  • Secondary Middle Name

[[IF customer.secondary.middle-name ]][[v('customer.secondary.middle-name')]][[ELSE]][[END]]


  • Secondary Last Name

[[IF customer.secondary.last-name ]][[v('customer.secondary.last-name')]][[ELSE]][[END]]


  • Secondary Full Name

[[IF customer.secondary.full-name ]][[v('customer.secondary.full-name')]][[ELSE]][[END]]


  • Secondary SSN

[[IF customer.secondary.ssn ]][[v('customer.secondary.ssn')]][[ELSE]][[END]]


  • Secondary Drivers License

[[IF customer.secondary.drivers-license ]][[v('customer.secondary.drivers-license')]][[ELSE]][[END]]


  • Secondary Primary Address

[[IF customer.secondary.primary-address1 ]][[v('customer.secondary.primary-address1')]][[ELSE]][[END]]


  • Secondary Primary City

[[IF customer.secondary.primary-city ]][[v('customer.secondary.primary-city')]][[ELSE]][[END]]


  • Secondary Primary State

[[IF customer.secondary.primary-state ]][[v('customer.secondary.primary-state')]][[ELSE]][[END]]


  • Secondary Zip Code

[[IF customer.secondary.primary-zipcode ]][[v('customer.secondary.primary-zipcode')]][[ELSE]][[END]]



HTML Table

If you want to enter the data into a table, you need a way to put the [[BEGIN]] and [[END]] tags around HTML elements.

You won’t be able to simply enter the tags as you did in the editor.  In the HTML they must be entered as HTML comments.  So, if we want to output the payment schedule in a table, we can enter <!–[[BEGIN scheduled-payments]]–> as the begin tag and <!–[[END]]–> as the end tag.  The you can reference the properties of the array variable by entering the individual property into the table (e.g. [[period]]) once you’ve added the begin and end tags to the HTML.  The HTML above will output a form similar to this:

Additional Examples

Example #1

Payment History:

<table><tbody>

<tr>

<th>Date</th>

<th>Amount</th>

<th>Method</th>

<th>Confirmation #</th>

</tr>

<!–[[BEGIN payments]]–>

<tr>

<td>[[payment-date]]</td>

<td>[[payment-amount]]</td>

<td>[[payment-method]]</td>

<td>[[display-id]]</td>

</tr>

<!–[[END]]–>

</tbody></table>

Note: When using recursive loops inside of HTML tables, the [[BEGIN]] and [[END]] statements must be encapsulated in HTML comment tags. See above.

This example will loop through the payments logged on the loan and output the loan payment history in a table format. Similar to the following:

Payment History:

Date Amount Method Confirmation #

2015-03-23 250 Cash 5941

2015-03-23 300 Cash 5943

Example #2

Loan Portfolios: [[BEGIN portfolio]] [[title]][[if($_last,”,’,’)]] [[END]]

In this example we are only displaying a simple list of portfolios associated to the loan, but it also shows the use of an IF statement along with the special variable of $_last to determine if we need to show the comma in the current iteration. If it is the last iteration of the array then we don’t want to display the comma character.

Special note on IF statements: There are other predefined special loop variables: $_first, $_total, $_num, $_even, $_odd. $_last is a special variable, equal to 1 when the loop is on its last iteration and 0 otherwise.  $_total is the number of iterations in an array variable.  $_num is a current iteration number starting with 1.  $_even and $_odd are 1 or 0 depending on if the current iteration value is even or odd.

With the IF statement we get the following result:

Loan Portfolios: Test Portfolio, Another Portfolio, Secondary Portfolio

Without the IF statement (ie. [[BEGIN portfolio]] [[title]], [[END]]) then our results would look like this:

Loan Portfolios: Test Portfolio, Another Portfolio, Secondary Portfolio,

Example #3

Loan Payment Schedule:

<table><tbody>

<tr>

<th>Period</th>

<th>Payment Amount</th>

<th>Payment Date</th>

<th>Principal Remaining</th>

</tr>

<!–[[BEGIN scheduled-payments]]–>

<tr>

<td>[[period]]</td>

<td>$[[formatNumber(‘amount’, ‘2’, ‘.’, ‘,’, $_num,’scheduled-payments’)]]</td>

<td>[[formatNumber(‘date’, ‘2’, ‘.’, ‘,’, $_num,’scheduled-payments’)]]</td>

<td>$[[formatNumber(‘principal-balance’, ‘2’, ‘.’, ‘,’, $_num,’scheduled-payments’)]]</td>

</tr>

<!–[[END]]–>

</tbody></table>

This example will iterate the scheduled payments on the loan from the loan transactions report, and will display a list of payment due dates and amounts. The example above would output something similar to the following formatted inside of a table using HTML:

Scheduled Payments:

Period Payment Amount Payment Date Principal Remaining

1 $439.58 10/01/2015 $4,602.09

2 $439.58 11/01/2015 $4,200.86

3 $439.58 12/01/2015 $3,796.29

4 $439.58 01/01/2016 $3,388.35

5 $439.58 02/01/2016 $2,977.01

6 $439.58 03/01/2016 $2,562.24

7 $439.58 04/01/2016 $2,144.01

8 $439.58 05/01/2016 $1,722.30

9 $439.58 06/01/2016 $1,297.07

10 $439.58 07/01/2016 $868.30

11 $439.58 08/01/2016 $435.96

12 $439.58 09/01/2016 $0.00

Note: When using formatting functions inside of recursive loops the loop variables must be formatted inside double brackets like this: [[variableName]] rather than just using the variable name. Note the example above. This is ONLY required for recursive variables.

Note 2: When using recursive loops inside of HTML tables, the [[BEGIN]] and [[END]] statements must be encapsulated in HTML comment tags. See above.

Formatting with Functions

This article will cover the use of functions to format merged variables in your templates.  When using a function, enter the function name followed by parentheses (e.g. functionName()).  You should then enter parameters for the function (specific information for this use of the function) inside the parentheses (e.g. functionName(parameter1, parameter2).  Functions are designed to accept specific parameters.  Parameters should be separated by commas.  If there is a default value for a parameter, you are not required to enter a value for that parameter, but you can if you want to use a value other than the default.

ZIP Code Formatting

By default all ZIP code values are merged into your templates in the format in which they are saved in the database, which saves numeric values ONLY. When nine-digit ZIP codes are merged into your template, they are less readable because they aren’t formatted with a dash.  You can tell LoanPro to format ZIP codes by using the formatZipcode function.

formatZipcode(variableName, length=9)
The available parameters for the formatZipcode function are:
  • variableName – The context variable name (ie. tenant-zipcode)
  • length – Length of the ZIP code.  Valid values are 5 or 9. (Default: 9)
Here are some examples of the use of this function:

Example #1

This usage will format the ZIP code with the default length of 9, unless the saved ZIP code is only 5 digits. Assuming our saved ZIP code is 844140123, this example would return a result of 84414-0123. If the saved ZIP code is 84414, then the formatted result would be 84414.

Example #2

This usage will force the format the ZIP code to 5 digits, regardless of the saved value. Assuming our saved ZIP code is 844140123, this example would return a result of 84414.

Phone Number Formatting

By default, when phone numbers are merged into your templates, they are merged in as a numeric value with no formatting.  To format the merged value you can use the formatPhoneNumber function.

formatPhoneNumber(variableName)
Available parameters for the formatPhoneNumber function:
  • variableName – The context variable name (ie. company-phone-primary)
Examples:

Example

When you use this function, phone numbers will be formatted differently depending on their length. If the saved phone number is 7 digits with a value of 7827199 then it will formatted 782-7199. If the saved phone number is a 10-digit US number with a value of 8017827199, then the resulting format will be (801) 782-7199. If the saved phone number is an international number, longer than 10 digits, with a value of 445568721234 then the resulting format will be “44 (556) 872-1234.

Currency Formatting

By default, currency values are merged into your templates as a numeric value with no formatting, meaning a value of 1,101.99 would be merged as 1101.99.  You can format the merged value using the formatNumber function.

formatNumber(variableName, decimals=2, decimalPoint=”.”, thousands=”,”)
Available parameters for the formatNumber function:
  • variableName – The context variable name (ie. setup-loan-amount)
  • decimals – The number of decimal places the value should be rounded to (Default: 2)
  • decimalPoint – Character to use for decimal point (Default: period)
  • thousands – Character to use for thousands separator (Default: comma)
Examples:

Example #1

$[[formatNumber(‘setup-loan-amount’, ‘2’, ‘.’, ‘,’)]]

This usage will format the number as currency. Assuming our loan amount is 95999.11, this example would return a result of 95,999.11.

Example #2

This usage will strip the decimal places from the number (rounding to the whole number) and will strip all thousands-separation characters. Assuming our loan amount is 1,500.91, this example would return a result of 1501.

Formatting Currency as Words

You also have the ability to format the currency as words for use in templates for printed checks or contracts. There are two separate functions available for this.

  • formatNumberAsText – This function will format the entire currency value as words including the decimal/cent values.
  • formatNumberAsCheck – This function will format the dollar amount as words, and will format the decimal/cents as a fraction in check format (i.e. 51/100).
formatNumberAsText(variableName)
Available parameters for the formatNumberAsText function:
  • variableName – The context variable name (ie. setup-loan-amount)
Examples:

Example – formatNumberAsText()

Assuming our loan amount is 95999.11, this example would return a result of “Ninety-five thousand nine hundred ninety-nine dollars and 11 cents“.

formatNumberAsCheck(variableName)
Available parameters for the formatNumberAsCheck function:
  • variableName – The context variable name (ie. setup-loan-amount)
Examples:

Example – formatNumberAsCheck()

Assuming our loan amount is 95999.11, this example would return a result of “Ninety-five thousand nine hundred ninety-nine dollars and 11/100“.

Formatting Date & Time Fields

You have the ability to format date and/or time fields in a number of different ways. You can do this by using the formatDateTime() function or the companyFormatDateTime() function.

[[formatDateTime(‘variableName’,’formatString’,’interval’)]]

This function lets you choose how to format your date and subtract date intervals. For example:

[[formatDateTime(‘loan-create-time’,’m/d/Y’, ‘-2 days’)]] (this will give you 2 days prior to the loan creation date formatted as MM/DD/YYYY.

[[companyFormatDateTime(‘variableName’)]]

This function works like the formatDateTime() function, but dates will always be formatted according to your company date setting selection.

Available parameters for the formatDateTime function:
  • variableName – The context variable name (ie. status-next-payment-date).
  • formatString – The format option you want to use (Defaults to “Y-m-d”). See examples 1-4 below.
  • interval – This parameter lets you add or subtract from dates. This parameter is a text string that indicates an amount and unit of time that will be either added or subtracted from variableName parameter. You can use the following units of time: seconds, hours, days, weeks, months, and years. See examples 5 & 6 below.

Available parameters for the companyFormatDateTime function:

variableName – The context variable name (ie. status-next-payment-date).

interval – This parameter lets you add or subtract from dates. This parameter is a text string that indicates an amount and unit of time that will be either added or subtracted from variableName parameter. You can use the following units of time: seconds, hours, days, weeks, months, and years. See examples 5 & 6 below.

Building your Format String

The format string can be built using the following special characters. For examples of commonly used strings, see below.

Day

Character

Description

Example Results

d

Day of the month, 2 digits with leading zeros

01 to 31

D

A textual representation of a day, three letters

Mon through Sun

j

Day of the month without leading zeros

1 to 31

l (lowercase ‘L’)

A full textual representation of the day of the week

Sunday through Saturday

S

English ordinal suffix for the day of the month, 2 characters

st, nd, rd or th. Works well with j

Month

Character

Description

Example Results

F

A full textual representation of a month, such as January or March

January through December

m

Numeric representation of a month, with leading zeros

01 through 12

M

A short textual representation of a month, three letters

Jan through Dec

n

Numeric representation of a month, without leading zeros

1 through 12

t

Number of days in the given month

28 through 31

Year

Character

Description

Example Results

Y

A full numeric representation of a year, 4 digits

Examples: 1999 or 2011

y

A two digit representation of a year

Examples: 99 or 11

Time

Character

Description

Example Results

a

Lowercase Ante meridiem and Post meridiem

am or pm

A

Uppercase Ante meridiem and Post meridiem

AM or PM

g

12-hour format of an hour without leading zeros

1 through 12

G

24-hour format of an hour without leading zeros

0 through 23

h

12-hour format of an hour with leading zeros

01 through 12

H

24-hour format of an hour with leading zeros

00 through 23

i

Minutes with leading zeros

00 to 59

s

Seconds, with leading zeros

00 through 59


Examples:

Example #1

This usage will format the number with the default format of YYYY-MM-DD. Assuming our next payment date is July 1st 2015, this example would return a result of 2015-07-01.

Example #2

This usage will rearrange the format of the date and use dashes instead of forward slashes. Assuming our next payment date is July 1st 2015, this example would return a result of 07/01/2015.

Example #3

You acquired a loan from Acme Lending Inc on [[formatDateTime(‘setup-contract-date’, ‘l F jS \\o\\f Y’)]].

This is a more complex example used to output a more elaborate date. Assuming our loan contract date is 04/28/2015, this example would return the following result: “You acquired a loan from Acme Lending Inc on Tuesday April 28th of 2015

Note: In this example that we used characters that were not part of the date format to make the word “of”. When we do this we must escape each individual character using a double backslash (\\). This is good way to format your date without having to use the formatDateTime function twice.

Example #4

This is an example formatting a time value. This will format the time in 12 hour format appending AM or PM. In this example, if the current time was 17:05:31, the resulting output would be “5:05 PM“.

Example #5

This example shows how to add 3 days to the first payment date the result will be formatted as 09/09/1999 or based on your company date settings depending on the function you use.

Example #6

This example shows how to subtract 6 days from the first payment date. The result will be formatted as 09/09/1999 or based on your company date settings depending on the function you use.

Formatting Country Variables

To properly format the display of country variables, use the function formatCountry(VariableName).

Example

When using this function in a form, it should be formatted like this: [[formatCountry(‘customer.primary.primary-country’)]]. The double square brackets let the form know you are entering something that shouldn’t be treated like plain text. The output of this function will be either USA or Canada depending on the country the variable represents.


How did we do?


Powered by HelpDocs (opens in a new tab)