While most reports can be defined using a single detail section having multiple columns and rows of data, others require summary data—such as subtotals. For reports requiring summary data, the report writer supports group sections. Group sections have the following characteristics:
Always associated with detail sections.
Defined by group headers and group footers.
Group headers always print above detail sections.
Group footers always print below detail sections.
Reference database column on which group headers and group footers will break.
Force new group header each time the value of the referenced column changes.
Force a new group footer each time the value of the referenced column changes.
Unlimited allowed.
To add a group section to a report definition, select the Detail section Properties screen. The following screen will appear:
button from theWhen adding a group section to a detail section, you are presented with the following options:
Enter a name to identify the group section.
Specify the name of the database column you want to use from the selected query source. A query source may refer to multiple columns in its SELECT
statement. By indicating a specific column, you instruct the query source to return data only for that specified column. Other columns appearing in the SELECT
statement will be ignored.
For more information on query sources and the link between database fields and report definition objects, please see the Getting Started chapter.
Select to include a group header in the report definition. The group header will print above the Detail section. If not selected, no group header will be included in the report definition.
Be sure to specify a group header and/or a group footer. Without either, no group section will print on the report definition.
Select to include a group footer in the report definition. The group header will print below the Detail section. If not selected, no group footer will be included in the report definition.
When checked starts a new page before the next grouped section. When this option is checked and a group is ending a page break will be created after the group footer, if any. The current record will be moved forward after the current page is completed rendering but before the next page starts rendering.
At the bottom of the screen, the following buttons are available:
Select to save your settings.
Closes the screen without saving any changes, returning you to the Application desktop.
When a group header and group footer have been added using the Section Editor, the report writer incorporates both sections into the report definition, as shown in the following screen:
As you can see, the group header has been added above the Detail section, and the group footer has been added below the Detail section.
To better understand the relationship between detail sections and group headers and group footers, let’s look at a sample report generated from data in an xTuple database. The following sales analysis report is called "Time Phased Sales History by Customer by Item":
The "Time-Phased Sales History by Customer by Item" report contains a detail section with two group sections associated with it. The outermost group section refers to customer information. The second, innermost group section refers to item information. Basically, if you study the report you will see that the sections are printed in the following descending order:
Group header (customers)
Group header (items)
Detail section (dates/amounts)
Group footer (items)
Group footer (customers)
Because the report contains data for two customers, you can see in the screenshot that the sequence of sections repeats itself twice. You can also see that group footers are used to provide both item and customer subtotals. As we mentioned earlier, group sections are commonly used for summary information.
Group headers and group footers are powerful features which enable you to generate reports which provide multiple levels of detail and roll-up values. However, you will find that most report definitions will conform to the following basic structure:
Page header: any page(s)
Detail section
Page footer: any page(s)
The report shown is the actual report printed from data in an xTuple database. The following screenshot shows the report definition used to generate the sample report.
If some aspects of the report definition shown seem confusing, don't worry. We will be covering the mechanics of report writing in subsequent chapters.