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 '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?