Language:

HansaManuals

Creating a Report Using the Report Generator
Creating a Report Generator Report - Specifying the Primary Register
Creating a Report Generator Report - The Appearance of the Report
Creating a Report Generator Report - Choosing a Print Destination
Creating a Report Generator Report - The Width of the Report Window
Creating a Report Generator Report - Printing the Report
Creating a Report Generator Report - Adding White Space
Creating a Report Generator Report - Adding Searches
Creating a Report Generator Report - Adding a Secondary Register
Creating a Report Generator Report - Using Variables and Formulae
Creating a Report Generator Report - Printing Information from Matrices
Creating a Report Generator Report - Bringing Information in from Other Registers
   - Linked Registers and Calculations
Creating a Report Generator Report - Page Breaks
Creating a Report Generator Report - Filtering Records (Print If)
Creating a Report Generator Report - Adding Check Boxes to the Specification Window
Creating a Report Generator Report - Adding Radio Buttons to the Specification Window
Creating a Report Generator Report - Searching for Records within a Period
Creating a Report Generator Report - Break Points, Subtotals and Totals
Creating a Report Generator Report - Blocks
Creating a Report Generator Report - Syntax
Creating a Report Generator Report - Useful Functions
Example Reports - Listing Sales Figures
Creating a Report Generator Report - Common Error Messages

Tutorials for Standard Accounts

Creating a Report Generator Report - Using Variables and Formulae - More Examples

This page contains some suggestions for using variables in Report Generator reports. Please follow the links below for more details about:
---
  1. As well as counting the number of records in the primary register in the report, you can count the total number of records in the secondary register in the report, or the number of secondary records for each primary record. For this example, we will illustrate the last of these by counting the number of Invoices for each Customer in our Customer List report:

    As before, we have declared the new variable viInvCount as an integer in a "Variable:" line at the beginning of the report (second line in the report display area).

    The value of the viInvCount variable should be increased by one each time an Invoice is printed. We have therefore placed the following code in the Invoice register section (final line in the report display area):

    code: viInvCount=viInvCount+1

    Because we are counting the number of Invoices for each Customer, we need viInvCount to be set to zero each time the current Customer changes. We have therefore placed code to this effect in the Contact register section:

    code: viInvCount=0

    When the first Customer is printed, viInvCount is set to zero. As that Customer's Invoices are printed, viInvCount will keep count. The count figure will be printed after the list of Invoices, in the Invoice Footer section. When the second Customer is printed, viInvCount is set to zero once again, and so on.

  2. The report already contains total figures showing the Invoice Total for each Customer. We can now add a variable to show the Invoice Total for the whole report. We have to do this using a variable if we want the total to be printed at the end of the report in the Report Footer. The Report Footer is not related to a register, so it cannot contain fields. Therefore, we cannot use the method that we used in the Invoice Footer section (placing in the footer an overall total for the Sum1 field from the Invoice register). Instead, we can use one of two methods:

    1. We can declare a new decimal variable at the beginning of the report and quote that variable in the Variable Name field in the 'Total' dialogue box that controls printing the Invoice Total for each Customer. Each time a total figure is printed in the report, that figure will be copied to the new decimal variable. If this variable is to contain the Invoice Total for the whole report, we should not select the Clear On Print option in the 'Total' dialogue box. This method requires us to print accumulated totals throughout the report. If we have not been doing this (i.e. if we print totals using the Clear On Print option), the new decimal variable will contain the Invoice Total for the last Customer. If we do not print totals at all, no value will be copied to the new decimal variable.

    2. If we do not want to print accumulated totals throughout the report, a more flexible but more manual method is to declare a new decimal variable at the beginning of the report instead, and increment it for each Invoice using code on the 'Data' card. In the example illustrated below, we are using the vdInvTotal variable for this purpose:

      This variable is a decimal variable, because Invoice Totals can contain decimal figures.

      The code that increases the value of the vdInvTotal variable by the Total for each Invoice is placed in the Invoice register section, so it will be used once for each Invoice. The code is:

      code: vdInvTotal=vdInvTotal + vrInvoice.Sum1

      The expression "vrInvoice.Sum1" uses the same structure as the vrContact.Code expression described here and means "the Total of the Invoice record that is currently in the vrInvoice variable" i.e. the Total of the Invoice currently being printed. The expression is case sensitive, so you must use "Sum1" and not "sum1".

      On the 'Layout' card, since the variable is a decimal variable, we can specify in the 'Formula' dialogue box that it should be printed rounded to a particular number of decimal places. To do this, set the Data Type to Value and enter the number of decimal places in the Decimals field:

Please follow the links below for more details about:
---

Creating a Report Generator Report:

Go back to: