Language:


Adding a Secondary Register - Linking the Primary and Secondary Registers

When you first add a secondary register to the report, its entire contents will be in the current selection for that register. Therefore, if the report is left as it is now, it will follow this pattern:
Customer 1
All Invoices in the database
Customer 2
All Invoices in the database
Customer 3
All Invoices in the database
After each Customer is printed in the report, the current selection of Invoices (i.e. all Invoices) is printed. The next step is to reduce the current selection of Invoices to those Invoices made out to the Customer on the line above (the current Customer). This is the result being aimed for:
Customer 1
Customer 1's first Invoice
Customer 1's second Invoice
Customer 1's third Invoice
Customer 2
Customer 2's first Invoice
Customer 2's second Invoice
Customer 2's third Invoice
Customer 3
Customer 3's first Invoice
Customer 3's second Invoice
Customer 3's third Invoice
To achieve this, you need to search for Invoices with the Customer Number of the current Customer. Follow these steps:
  1. Click on the line in the report display area marked "Register: Invoices..." to signify that the search is to be carried out in the Invoice register.

  2. Click the [Selection] button. The 'Selection' dialogue box opens. Enter a Formula as shown below:

    The Formula is:
    vrInvoice.CustCode==vrCustomer.Code
    This Formula contains three elements: vrInvoice.CustCode, == and vrCustomer.Code.

    The expression "vrInvoice.CustCode" refers to the Customer Number field in the Invoice register. The expression is in two parts: the first part ("vrInvoice") is the name of the variable containing the Invoice register. This name was given to the variable in the 'Register' dialogue box as described here. The second part ("CustCode") is the internal name for the Customer Number field in the Invoice register. The two parts are separated by a full stop. The expression is case sensitive, so you must use "CustCode" and not "custcode". Similarly, the expression vrCustomer.Code means "the Customer Number of the Customer record that is currently in the vrCustomer variable" i.e. "the Customer Number of the current Customer". The == symbol means "is equal to". Note: do not use = instead of ==.

    Therefore, this Formula states that there will be a search in the Invoice register for Invoices that have the same Customer Number as the current Customer. Invoices that meet this condition will be printed in the report.

    There is no need to enter an Input Label, Variable Name or Paste Register, because there is no need to place a variable in the specification window.

  3. Click the [OK] button. A new "Selection:" line representing the search is added to the Invoice register section in the report display area: