Creating Your First Computation Rule
Computation rules are used inside LoanPro for automated triggers, such as rules applied and flags. A computation rule is an expression (e.g. 4 < 6, 11 + 5) that evaluates to a number, date, or a simple true or false. Rather than writing these expressions in standard mathematical notation, however, we write them in Clojure, a programming language.
This article will go over the basics of computation rules with an example showing how to compute the total payoff and interest for the next 10 days.
How to Create a New Computation Rule
Rules can be created in several places inside LoanPro. Settings > Company > Rules Manager > Rules Manager is the area where all your company rules can be found. In other areas that ask for rules, you will be able to create a new rule or use one that already exists here for your company. In this article, we will use a rule to create a computation field that will be shown in the summary of each account. Navigate to Settings > Loan > Custom Fields > Computation.
Next, click 'Add' the top right corner. This brings up a window where you can name the computation field, select where it's displayed, and choose whether it will be displayed as currency, a date, or a plain number.
Go ahead and enter the name for your new computation field in the Name field. For this example, we want to create a computation field that will tell us what the payoff and interest will be for the next 10 days. We'll name the field '10 Day Payoff', display it on the loan summary, and select Currency as our output.
Below, you'll find the Formula Editor section, where you'll enter your Clojure rule. For this example, enter (+ status-payoff (* status-perdiem 10)) in the text box. To find variables like "status-payoff", you can use the search bar just beneath the Formula Editor. We also keep a full list in our article Available Variables.
Once you're done, click the 'Save' button.
You’ve now created your first computation rule. Since we set this field to display in loan summary, navigate to the summary tab and expand your computation fields; you should see a table with a row where the left column is the name of your computation field and the right column is the value.
To learn more about how computation rules are formatted, read How Computation Rules Work.