Fields and variables in the Report Generator:

A variable differs from a field in that it is temporary. Both the variable itself and the information it contains remain in memory while they are needed, but are lost once they have been used. For example, specification windows of reports, documents and maintenance functions all contain variables. If you are producing a Customer List and you specify that you want to list Customers belonging to the "CUST" Category, you will type "CUST" into a variable in the specification window. This information is retained while the report is on screen or being printed, but is not stored anywhere afterwards.

Variables also differ from fields in that you can create them in the Report Generator. In fact, you will need to create variables to make the most of the capabilities of the Report Generator. Most often, you will need variables if you want to place search criteria in specification windows, keep running totals of any kind, and bring information in from another register.

As with fields, variables have both labels and internal names. A variable must have an internal name, but it only needs a label if it's being shown on screen in a specification window as illustrated below.

When naming variables, it's a good idea to use an internal name that suggests the purpose of the variable. For example, if you design a Customer List report and place a variable in its specification window allowing the user to search for Customers belonging to a particular Category, it is better to name the variable "vsCategory", not "variable1" or "v1". This will make the Report Definition easier to read, understand and edit in future. In these web pages we have used a convention whereby the first character of a variable name is "v" (for variable) and the second character indicates the variable type.


Fields and Variables in the Report Generator:

Go back to: