Adding Collections (Repeating Sections)
You can create repeating data sections in reports using database collections, which contain the data you are most likely to need access to. For example, you want to report information about customer invoices. To do that:
Step 1:
Select the Report Body section and click the Field Palette toolbar icon to display the Available Fields Palette.
The Database tab always default in the first instance to display Company as the base class, from which you can drill down to find the information you require. The basic principle is that the company owns various collections, such as a collection of branches (allBranches). The company also owns the ARControl (and other module controls), so using a reference to the company's ARControl, a collection of AR customers can be found.
In this example, you must find the AR Control reference (myARControl), which will in turn contain the collection of customers (allCustomersCode) for the company.
Click the allCustomersCode collection within the myARControl reference, then drag and drop the collection into the report body section (blue area).
The ARControl.allCustomersCode collection is imbedded into the Company collection (inherent in Report body section). The Available Fields Palette now displays the database fields for the Customer class.
Each report uses Company (Report body) as it's base
class. If you intend to write a report that has multiple repeating sections,
you can change the base class to be the first collection. In this example,
the Customer class. To do this, when you drag the first class to the report,
drag it directly into the grey area named Report body instead of dragging
it into the blue section area. (The image in Step 2 below reflects this).
When a new section is added, the section name defaults to the database field name (in this example: myARControl.allCustomersCode. You can re-name the section to something more meaningful by accessing the section properties and changing the name.
Step 2:
Since it is ultimately customer invoice information you want to output to the report, the next step is to find the relevant transaction collection within the customer class. This is allARInvoices. Drag and drop the allARInvoices collection into the report section.
The allARInvoices collection is now imbedded within the myARControl.allCustomersCode collection, and the Available Fields Palette displays the Transaction class, which contains data relating to all transactions.
Step 3:
In this example, an additional step is required to limit the Transaction class to a subclass containing AR invoices only. This is because the Transaction class contains data relating to all transactions, not just AR invoices (as all transactions have some common properties).
Information generic to transactions can be accessed using the Transaction class, but to access information specific to AR invoice transactions, you must limit to the ARInvoice subclass. This is done using the Section Properties for the allARInvoices section.
Access the section properties for the allARInvoices section.
In the Type section, change the type from Transaction (class) to ARInvoice (class). This is done by clicking the arrow icon and scrolling down the list of transaction subclasses until you find the one you require. When you select ARInvoice, the Available Fields Palette for the allARInvoices section updates to display database fields specific to the ARInvoice transaction subclass.
When this report
runs, the collection of AR invoiceprint for each customer. Since
the allARInvoices collection is embedded into the allCustomers
collection, the first customer will print, followed by the invoices associated
with that customer. Then the second customer will print, followed by the
invoices for that customer, and so on. The sort order within
sections can be determined using section properties.
Step 4:
When you have created the repeating data sections you require, you can begin adding fields to report sections.
Data can be totalled, sorted and queried within sections and various properties can be assigned.
When you are designing a report, it is a good idea to check the output throughout the process, to ensure you are on the right track. If you make an error, it is easier to check this during the process as you make incremental additions, rather than when the report is complete.