Computation Fields
Generate and display dynamic account information, based on your own business logic and needs.
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 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.
Before we get started, Computation Fields require a bit of a background with Clojure rules, so we recommend reading our Clojure article if you aren't familiar with the topic.
Creating Computation Fields
To create a Computation Field, navigate to Settings > Loan > Custom Fields > Computation inside your company account. 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 field output.
- Output format: This is the data type of the Computation Field value. The options are Number, Date, or Currency. If you select an output format that doesn’t match the output your rule provides, your Computation Field will either show nothing, or it will calculate in a way that won’t make sense.
To display text values or a simple “yes” or “no” for Computation Field outputs, 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 the output format is set to 'Number'.
- Display: 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 ‘Account Dashboard’, ‘Loan Settings’, and ‘Insurance Tracking’ pages within a loan.
Computation
Just like rules, Computation Fields use Clojure syntax. With 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.
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.
When you have completed and verified your computation rule, click the blue 'Save' button in the top right corner.
Using Computation Fields in Dynamic Templates
In addition to being displayed on loan accounts, Computation Fields can also be included in your Dynamic Templates. Once you've created your Computation Fields,
- Navigate to Settings > Loan > Dynamic Templates > Dynamic Template Management to create or edit a Dynamic Template.
- Click on an existing Dynamic Template or click 'Add' to create a new one.
- Click the 'Help variables' button located just above the form editor.
- Within the variables menu located on the left, choose ‘Computation Fields’. Here, all of your created Computation Fields will be listed.
- Select a Computation Field from the 'Expected Values' area. Clicking on a Computation Field will add it to the text editor.
Note that this variable will output a string. If you just want to display the value from the computation by itself, you can write it out like this:
(settings-custom-fields-array :id12 :value)
But if you want to perform any other math on the output, you'll need to turn it into an integer.
(-> settings-custom-fields-array :id12 :value v/parse-float)
For more on v/parse-float, check out Clojure.
Was this article helpful?