IBM SC41-5210-04 Server User Manual


 
Chapter 12. Defining Query for iSeries report breaks
This chapter describes how you define the report breaks that you want to occur in your query report.
Report breaks are used to break the report into groups of records (or lines) each time the value of a
report break field changes. The second part of this chapter describes how, for each of your report breaks,
you can control report break formatting and define break text messages.
The primary reason for defining report breaks is to provide a basis (along with your selected sort fields) for
Query to create a set of subtotals for each logical group of records in your output. An example of a logical
group of records would be all of the time records for one employee. Another example would be all of the
employee records for an entire department. A third example would be all of the sales activity records for
one inventory item.
If daily time records existed for each employee, at the end of a pay period you could have Query process
all of the records and create two kinds of groups or subtotals. To accomplish this you would have to define
two report break fields (DEPTNO and EMPNO, for example) and select the same two fields as sort fields. If you
assigned a sort priority of 10 to DEPTNO and a sort priority of 20 to EMPNO, Query would arrange the records
in groups so that they would appear on your report by employee number within department number
(starting with the lowest number employees records in the first or lowest department number, followed by
all the remaining in ascending sequence).
If you also defined break level 1 as DEPTNO and break level 2 as EMPNO, Query would create group or level
breaks and would print or display subtotals for each group based on what you specified for your Report
Summary functions (see Chapter 11, Specifying report summary functions in Query for iSeries reports for
details). If you only wanted final totals at the end of the report, you would not have to define any report
breaks in this example.
When a report break occurs for each group of records selected by the query, break text (if any) is shown
following a blank line. The break text is then followed by a separate line for each type of summary function
being used in your query. On each summary function line is the name of the function and all the summary
values calculated at that report break for all the fields using that function.
Defining a Query for iSeries report break
On the Define Report Breaks display, you select each field that you want used as a break field and you
assign to it the break level you want it to control. You can define as many as six break levels (numbered 1
through 6) and you can specify multiple break fields to control any break level, as long as you assign no
more than nine break fields for all the break levels used.
For example, you can have: only one break level with all nine fields defined as break fields for it; three
break levels with three break fields each; or a maximum of six break levels, with one field each used as
break fields for five of the levels and four fields used for one level.
If multiple break fields are defined for the same break level, a change in any one of those break fields
causes a break (or group change) level to occur for the specified break level number. This break level
change causes Query to include the appropriate summary values in your output.
A break at one level automatically causes a break at all lower break levels (the lowest level has the
highest number). For example, if all six break levels were defined, a control break occurring at level 4
would also force breaks at levels 5 and 6, and the break text and summary values for each of those three
levels (6 to 4) would be included at that point in the report.
© Copyright IBM Corp. 2000, 2002 139