Creating a Report Generator Report - Adding a Secondary Register - Printing Information from the Secondary Register

This page describes adding fields to a Report Generator report so that information from the secondary register will be included in the report output.


Having added a secondary register to a Report Generator report and linked it to the primary register, you now need to specify what information from the secondary register is to be printed in the report. In the example Customer List that we are using in this documentation, we need the Invoice Number and Date, Due Date and Total to be printed, and we will also add the Customer Number from each Invoice as a check that the report is working correctly.

  1. In the Report Definition window, change to the 'Layout' card:

    When you add a secondary register to the report, four new sections will automatically be added to the report layout. These new sections will allow you to print information from the secondary register (in the example, from the Invoice register).

    The ten sections will be printed in this order:

    Contact Header
    Contact Before
    Invoice Header
    Invoice Before
    Invoice After
    Invoice Footer
    Contact After
    Contact Footer

    The Contact Before and Contact After sections will be printed once for each Customer, thus building up the list of Customers. The Invoice Header and Invoice Footer sections will also be printed once for each Customer, while the Invoice Before and Invoice After sections will be printed once for each Invoice. The other sections will be printed once per report.

    The new Invoice Header, Invoice Before, Invoice After and Invoice Footer sections are connected to the Invoice register. You can place fields from the Invoice register in these sections, but not fields from any other register.

  2. The next step is to add the column headings that will identify the Invoice information. Click on the Invoice Header section (marked "Invoices vrInvoice Header" in the example) and then use the [Text] button as described here to add the column headings:

    You can also increase the Line height as described here to increase the space given to the Invoice column headings: this has been done in the next illustration.

  3. Now add to the report the fields that contain the information that you want to be printed in the report. Click once on the Invoice Before section (marked "Invoices vrInvoice Before" in the example) so that it changes to a darker shade of grey. Then use the [Field] button as described here to add the appropriate fields from the Invoice register to that section:

    "Sum1" is the internal name for the field in the Invoice register that contains the Invoice Total (excluding VAT). This figure has been right justified.

  4. Now you can use the [Total] button to ensure an Invoice Total for each Customer will be printed in the report. This total figure should go in the Invoice Footer section, as this is printed once per Customer (the Invoice After section is printed once per Invoice). Click on the Invoice Footer section (marked "Invoices vrInvoice Footer" in the example) to select it, and then click the [Total] button. The 'Total' dialogue box opens:

    Paste Special    Fields in the register
    Choose the field that you want to be totalled. The 'Paste Special' list will show all the fields in the register you are working with (in this case, the Invoice register).

    You can also enter "1" here. Instead of totalling a field, this will cause the total to count the number of records printed in the report. This is described in more detail here.

    Clear on print
    Select this option if you do not want the total to be cumulative (i.e. if you want the total to be set back to zero each time it is printed). In the example, we will need to select this option as we need to print a total for each Customer.

    Specify here where the left-hand edge of the total is to appear on the page, by entering a number of pixels from the left-hand edge of the page. If you're not yet sure where you want the total to appear, don't change the default. You will be able to change the position of the total later. To align the total with the field being totalled, enter the same left and right measurements here as you did for the field.

    Specify here where the right-hand edge of the total is to appear on the page, by entering a number of pixels from the left-hand edge of the page.

    Paste Special    Styles setting, System module or Style register, Report Generator module
    Use this field to assign a font and font style to the total. If you do not enter a Style, the font and font size specified in the Company Info setting in the System module will be used.

    Variable Name
    The total figure will be calculated and printed, but it will not be stored anywhere. This means you cannot use the figure elsewhere in the report. If you want to use the figure elsewhere, you need to copy it into a variable. Specify the variable here. The variable must already exist i.e. you must have "declared" it as a decimal or integer (depending on the field being totalled) on the 'Data' card. Declaring a variable is described here.

    Subject to the Only On Print option immediately below, every record printed in the report will contribute to the total. You can use this field to specify that a record will only contribute to the total if it meets a certain condition. For example, you may not want Invalidated Invoices, Invoices that have not been marked as OK or Credit Notes to contribute to the total. Please refer to the Printing Elements with Red Line Overstrikes page for an example.

    An example situation where this field will be useful is in a list of Invoices. Credit Notes will be shown in such a list with positive values. So, if the list has a single total figure with no Condition, Credit Notes will be added to the Customer's total Invoice value when they should be subtracted. To avoid this problem, one option is to use the Condition to calculate separate totals for Invoices and Credit Notes, then copy the two totals into variables as described under Variable Name above, and finally use the [Formula] button to subtract one from the other to display a turnover figure.

    Only on print
    At the moment the example report lists every Invoice belonging to each Customer. Therefore, every Invoice contributes to the total. However, you may choose to change the report so that some Invoices are not printed. For example, you may put in a condition that an Invoice is only printed in the report if its value is greater than 100.00. You can do this using the [Print If] button on the 'Data' card. This option allows you to specify whether the Invoices that are not printed in the report (those whose value is less than 100.00) should contribute to the total. In the example report illustrated at the bottom of this page, Customer 001 has two Invoices whose values are greater than 100.00. The total value of these two Invoices is 1109.00. The total shown in the report for Customer 001 will be 1109.00 if you use the Only On Print option, and 1239.90 if you do not use this option.

    You can have the total printed with a red line drawn through it, depending on a condition that you enter here. This is described in more detail on the page.

    Use these options to choose whether the figure is to be left- or right-justified. Usually figures should be right justified.

    If you want to round the total to a particular number of decimal places, enter that number here.

    When you click [OK], the total will be placed in the correct position in the report. In the illustration, we have also added some identifying text and an empty Line (in which we have selected the Always Print option) underneath the total:

    This is the resulting report. We have added an accumulated total to illustrate the effect of not using the Clear On Print option in the 'Total' dialogue box:

For more information about totals and break points, please refer to the Break Points, Subtotals and Totals page. Please follow the links below for more details about:

Creating a Report Generator Report:

Go back to: