Related Information Examples & Tutorials
Not sure what new and improved features are in the latest software? Just contact us to find out!
“ Hosted Collect! has saved us time, money, and worry on IT. We no longer have to concern ourselves with keeping a server up and running, replacing aging hardware, managing database backups and facilitating remote access for management/offsite employees. Maintaining a stable internet connection is all that is needed to keep our agents connected and productive. ” John Y.

How To Assign And Calculate Using Variables


This topic discusses some of the details of using variables in report writing.


- Experience using the Report Writer in Collect!

Top of page.


Using variables in reports gives great flexibility and power to report design. Complex calculations and tallying of totals can be accomplished by assigning values to variables that you create. Please refer to How To Use Variables if you are new to this area of report design.

Top of page.

Assigning To Variables

Assigning values to variables can be simple or complex. You can assign a value from a numeric database field, add values -- including database fields and other variables, and perform math functions on variables.

The line on which you are assigning the variable MUST start with the @ symbol and the variable identifier.

Top of page.

Data Type For Printing

Collect! knows the data type of database fields. It uses this information to format printed output of reports. When you create variables, Collect! needs to be told what type of data this variable will hold to format your variable for printing. Use the data type symbols when you create your variable.

[ # ! % $ * ]

These are described in How To Use Variables.


@varPrincipal$ = 0.00
@varPaid$ = 0.00
@varString1* = " "

When you assign values to your variables in your report body, if at least one of the assignments to a variable is a database field or variable that has previously been assigned a database field, Collect! can determine the format of the variable's printed output.


@varPrincipal = @(
@varPaid = @(
@varString1 = owes less than $100.00

If you are unfamiliar with different types of math operators, please review How To Use Arithmetic Operators.

Top of page.

Math With Variables

You can use math with variables just as you do with database fields. For basic information on using math, see How to Use Math With Database Fields.


Outstanding = @(varPrincipal-varPaid)

One third of a variable = @(varAmount/3)

Owing minus Debtor's fees = @(varOwing-de.fe)

Owing times 10% = @(varOwing*0.10)

Top of page.

Using Variables For Totals

When variables are used to tally running totals, such as a total amount of all cash taken in daily transactions, you will want to use static variables to ensure that totals are calculated correctly. Please refer to How To Use Static Variables for details.

Top of page.


This topic just scratches the surface of an immense area. It is meant to introduce you to the use of variables in more complex situations.

tip.gif Whenever you use variables in calculations, you will have to test the output of your reports to ensure that the variable "formulas" are performing as you expect them to.

Many reports that ship with Collect! use variables. Review them for additional examples. Also, you may use the Index to look up the topic, "Variables."

Top of page.

See Also

- How To Use Static Variables
- Report Sample to view sample reports and letters
- Report Topics Index for a list of all report and letter topics
- How To Use Arithmetic Operators

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments:

RMA RMA Canada ACA Member