This is from CR's Help file....
How to use variables in formulas
Variables can be used to solve many formula problems, but they have two primary uses:
1. streamlining formulas, and
2. expanding formula capabilities.
Unlike a constant value which is fixed and unchanging, a variable can be repeatedly assigned different values. You assign a value to a variable and the variable maintains the value until you later assign a new value. Then the variable maintains the new value until you later assign a newer value, etc.
Using variables to streamline formulas
Using variables, you can write formulas much more efficiently than you can without them. For example, to evaluate the {customer.FAX} field to determine if the area code is for Washington state (206, 360, 509) or British Columbia, Canada (604, 250), without the benefit of variables, you must write a formula similar to the following:
If {customer.FAX}[1 to 3] = "604" or
{customer.FAX}[1 to 3] = "250"
Then
"BC"
Else
If {customer.FAX}[1 to 3] = "206" or
{customer.FAX}[1 to 3] = "509" or
{customer.FAX}[1 to 3] = "360" Then
"WA"
Else
""
See How to create If-Then-Else formulas.
You have to write out the instructions for extracting the area code from the telephone number field ({customer.FAX} [1 to 3]) every time you want the formula to use the area code from the current record.
By using a variable (for example, AreaCode), you write those instructions one time. Using those instructions, the program automatically extracts the area code from the {customer.FAX} field, and stores it in the variable each time it reads a new record. You simply reference the variable AreaCode whenever you want to use the area code from the current record in your formula. Here's an example of the formula using a variable:
StringVar AreaCode:={customer.FAX}[1 to 3];
If AreaCode = "604" or AreaCode = "250"
Then
"BC"
Else If AreaCode = "206" or AreaCode = "509" Then
"WA"
Else
""
Not only does the streamlined version take less time to write, but it takes less time to process as well, so your report prints more quickly.