# Using Variables in Computation Rules

### Introduction

Usually when creating computation rules, the goal is to create a useful computation based off of the values of a given loan. These values often change, and most people probably don’t want to update the computation rule each time a value changes. We also want the same rule to apply to multiple loans simultaneously. To achieve this, LoanPro has built-in variables which will be automatically replaced with the latest values for a given loan each time the rule is evaluated. This article will go over variables and how to use them in a Computation Rule.

Do not attempt to use a computed value in a computation rule. Using computation fields inside of other computation fields will significantly increase the time it takes to pull custom queries, generate forms and several other system tasks that use the nested computation field.

### Adding a Variable a Rule

We will start off by either creating a new computation field or editing an existing one; this can be done anywhere a computation can be entered. For the purpose of this example, we will navigate to Settings > Loans > Custom Fields > Computation. Click the 'Add' button at the top right corner to enter the Formula editor and choose 'Initial Setup' as the display value.

Start by entering “(+ 200 ” into the text box, but leave it at that for now. (Please note that there is a space after the 200; that space is required for this to work properly.)

We’ll be using the bottom-most section of the formula editor to get variables. This section allows us to look for different variables that are built in to LoanPro and easily add them to our current formula.

Try typing “loan amount” in the search box. There should be a result that says 'Total Loan Amount'. Click that and the 'Info' section will change to show information about that variable.

The 'Info' section will show the ID of the variable, which is how LoanPro identifies which variable you want. The formula ID shows how to use it in a rule; this is important since sometimes certain variables work differently than others. It will also show the 'Name' of the variable, which is how it shows up in the search. Finally, it shows the format of the variable, which describes what kind of information is stored in the variable. For the “Total Loan Amount” variable, the format is currency, which means that it represents an amount of money.

The value in the ID field will be blue. Go ahead and click on the text and it will add the variable to the formula. Your formula should now look like this:

( + 200 setup-loan-amount)

Go ahead and add a closing parenthesis to the formula and click 'Save', then open a loan and go to the 'Initial Setup' tab. Your computation field should be there and it should equal the loan amount plus 200.