Creating a Report Generator Report - Using Variables and Formulae - Declaring a Variable
This page describes the first step in using a variable in a Report Generator report, which is to "declare" the variable (to name it and give it a type).
---
In order to be able to use a variable in a Report Generator report, you should first to name the variable and give it a type and an initial value. This is known as "declaring" the variable. You should always declare variables at the beginning of a report, so that you can use them at any time in the reporting process. You can use the following methods to declare a variable:
- Use the [Selection] button on the 'Data' card of the Report Definition window both to declare a variable and to place it in the report's specification window.
- Use the [Register] button also on the 'Data' card to declare a variable ready to receive the contents of the register.
- Use the [Variable] button as described on this page when you don't need to place the variable in the report's specification window.
Follow these steps:
- Return to the Report Definition record and go to the 'Data' card.
- Click the [Variable] button above the report display area. The 'Variable' dialogue box opens:
- Variable Name
- Enter a name for the variable. Include at least one alpha character in the name and do not use spaces or punctuation marks of any kind. Use the underscore _ instead of a space. Ideally, the Variable Name should reflect the purpose of the variable. You must include at least two characters in a variable name, up to a maximum of 20.
- If you need to declare several variables that will have the same Type and default value, you can enter several variable names here, separated by commas.
- Type
- Paste Special
Variable Types
- Specify the type of the variable here. This will determine the type of information that can be held in the variable.
- For example, a variable that will be used to keep track of the number of records listed in a report will only ever contain whole numbers, so it should be an integer variable.
- For a list of the various types available, please refer to the Field and Variable Types page.
- Initial Value
- If you want a default value to be placed in the variable, specify that default value here.
- When the 'Variable' dialogue box is complete, click the [OK] button to close it. A "Variable:" line will be added to the report display area, above the primary register line:
After declaring a variable, please follow the links below for more details about:
---
Creating a Report Generator Report:
Go back to: