Language:


Using Variables and Formulae - Declaring a Variable

The first step is 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 printing process. You can use several methods to declare a variable:
  • Use the [Selection] button both to declare a variable and to place it in the report's specification window.

  • Use the [Register] button 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:
  1. Return to the Report Definition record and go to the 'Data' card.

  2. 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.

    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.

    In the example, the variable will be used to keep track of the number of records listed in the report. It will therefore 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.

  3. When the 'Variable' dialogue box is complete, click the [OK] button to close it. A "Variable:" line is added to the report display area, above the Contact register section:

Please click the links below for more details about: