Create Computation Field

Computation fields are only intended to be used for the UI and are not intended to be used for reports or other processes that allow you to pull these fields. We do not recommend using computation fields in Custom Query or Special Reports with any volume over 1000 records or multiple computation fields selected. If these recommendations are exceeded, the desired report may take longer than the standard allotted 24-hour time period to generate, and thus will automatically be deleted before completion.


Audience: Upper Management, Developers, Loan Servicing/Collections Managers, Administrator


Your lending practices are unique to your business, and you may need to track information that isn't native to LoanPro's LMS (Loan Management System). But calculating a bunch of values manually for each loan can become tedious, and it probably isn't how you want to allocate your time. This is where computation fields come in. Computation fields allow you to create customizable fields of information for your loans so you can monitor the information that's most important to you. They even update automatically and dynamically for each loan—set a field up once, and it can be displayed on each account.

In this article, we'll explain how to create computation fields and use them with your loans. Then, we'll cover some common questions and use cases.

Before we get started, computation fields require a bit of a background with Clojure rules, so we recommend reading our Clojure 101 article if you aren't familiar with the topic.

Creating and Using Computation Fields

Like we mentioned above, computation fields allow you to create customizable fields to track specific loan information. To create a computation field, navigate to Settings > Loan > Custom Fields > Computation inside your company account.

To create a new computation field, click 'Add' in the top right corner. You will be taken to a page where you can enter the computation field's information.

Basic Information

Begin by entering the basic information for the computation field. This information includes the following:

  • Name – This is the name of the field. This name should distinguish it from other fields, and it will be displayed with the computation output.
  • Output format – This is the data type of the computation field value. The options are Number, Date, or Currency.
What do output formats do? And which one should I choose?
Clojure rules can be written to output numerical values, dates, and even strings of text. But LoanPro's computation field output formats put some validation constraints on whether certain output types can be formatted in certain ways. The output format that you select here is crucial to ensuring the value of your rule is displayed correctly. If you select an output format that doesn't match the output your rule provides, your computation field will either show nothing (or, more accurately, just a dash); or, it will calculate in a way that likely won't make much sense.

Using the three available format options of number, date, or currency is self-explanatory—outputs that match those formats will work, and formats that don't match won't. For example, you won't be able to use a number output to display the date format, and you won't be able to use a date output with the currency format.

But what about displaying strings of text? Some users choose to display text values or a simple "Yes" or "No" for computation field outputs. If this applies to you, select the Number format; it will treat your string of text normally and display it like you'd expect it to.
  • Round result – This determines the number of decimal places the field value should be rounded to. This option is only shown if output format is set to 'Number'.
  • Display – This option determines whether the field value should be displayed inside customer accounts, and if so, in what area. There are a few different places within the UI that you can display your computation field such as the Loan Summary, Loan Settings, and Insurance pages within a loan. Here's an example of computation fields displayed on the Loan Summary page of a loan:

After you enter the basic information for the computation field, you can enter the computation that will be used to compute the field value.


Just like rules, computation fields use Clojure syntax. And, using the formula editor, you can use variables in your computation as well as static values to compute fields that are specific to each customer account.

As you can see above, Clojure rules can get very complex if you are proficient with the language.

Clojure Examples

Here are some examples of how Clojure can be implemented to calculate different values:


Output Format


(+ status-payoff (* status-perdiem 10))


This rule calculates a 10-day payoff for a loan.

(let [dnt (clojure.string/split loan-create-time (re-pattern " "))

justdate (first dnt)

splitdate (clojure.string/split justdate (re-pattern "-"))]

(str (second splitdate) "/" (last splitdate) "/" (first splitdate)))


This rule takes a date that's currently in datetime format and reformats it in MM/DD/YYYY.

(condp =

(let [m (+ (mod (+ (if (= (u/parse-int (subs current-date 5 7)) 1) 13 (if (= (u/parse-int (subs current-date 5 7)) 2) 14 (u/parse-int (subs current-date 5 7)))) 9) 12) 3)

y (- (if (or (= (u/parse-int (subs current-date 5 7)) 1)(= (v/parse-int (subs current-date 5 7)) 2))(- (u/parse-int (subs current-date 0 4)) 1) (u/parse-int (subs current-date 0 4)))

(quot (- m (if (= (v/parse-int (subs current-date 5 7)) 1) 13 (if (= (u/parse-int (subs current-date 5 7)) 2) 14 (u/parse-int (subs current-date 5 7))))) 12))

J (quot y 100)

K (mod y 100)

q (u/parse-int (subs current-date 8))]

(mod (+ q (quot (* 26 (inc m)) 10) K (quot K 4) (quot J 4) (* 5 J)) 7))

0 "Saturday"

1 "Sunday"

2 "Monday"

3 "Tuesday"

4 "Wednesday"

5 "Thursday"

6 "Friday"



This scary wall of text can calculate which day of the week it is and will output the date as a string.

After you have written a Clojure statement, click 'Validate this rule' to make sure your syntax is correct. You won't be able to create a computation field with an invalid rule.

Please note that while the system checks for invalid syntax, it can't check for accurate logic. In other words, you can easily create a correctly written rule that doesn't do what you want it to do. Thus, make sure to validate your rules as well as read through them yourself to make sure they are accurate.

When you have completed and verified your computation rule, click the blue 'Save' button in the top right corner.

Using Computation Fields in Custom Forms

In addition to being displayed on loan accounts, computation fields can also be included in your custom forms. Once you've created your computation fields, navigate to Settings > Loan > Custom Forms > Form Management to create or edit a custom form. Then, click on an existing custom form or click 'Add' to create a new one. Next, click the 'Help variables' button located just above the form editor.

Within the variables menu located on the left, scroll to the 'Computation Fields' section and click on it. Here, all of your created computation fields will be listed. After selecting the computation fields section, you can select a computation field from the 'Expected Values' area. Clicking on a computation field will add it to the text editor.

Common Uses & Questions

The beauty of computation fields is that they can be customized to fit any lender's needs. While your computation fields themselves may differ from another user's, it's common to create computation fields for use in custom forms. For example, if you're a lender who offers same as cash loans with promotional payoff terms, you could create computation fields that calculate a loan's promotional payoff amount. When a borrower qualifies for the promotional offer, a custom form can be sent out to provide the information to the borrower automatically.

In addition to creating fields specific to their business, lenders also use computation fields to display information to their servicers on the Loan Summary page. Some common examples of this are displaying a borrower's last four digits of their social security number so servicers can easily verify they're speaking to the correct person. Similarly, some lenders choose to use a computation field to display the last four digits of the borrower's primary payment profile.

Are computation fields different than custom fields? Yes. Custom fields allow you to create a new field where you can input data yourself. Computation fields create a new field and then automatically fill in the data using a Clojure rule.

Does the database store my computation fields? The database stores the fields, but it doesn't store the values that your rules output. Storing all of the values that are calculated on all of your loans would hinder the system.

If you're interested in computation fields, you may also want to learn how to set up custom fields. Computation fields also work great within custom forms, so we suggest reading about that topic as well.

What’s Next

This is the end of our material on computation fields, but we have more information for users who want to take a deeper dive into writing Clojure rules. If you're interested, check out our Creating Temporary Variables to learn how to simplify long Clojure statements. Special Operators for Computation Rules is also a great resource for expanding your Clojure skills.

How did we do?

Powered by HelpDocs (opens in a new tab)