Go to Home Page
Questions?
Call 1-800-572-5517
 
  Go to Home Page  
  See all products
  See price schedules
  See manuals, tutorials, articles
  Download a free 30-day trial
  See user testimonials
  About Pacific Systems Group
 
  Welcome Rocket Software MXI Users - Learn about Spectrum SMF Writer for MXI
  Choose Spectrum Writer to add 4GL to your product
  Report Writer Speedup Tips Article

Return to list of articles

This excerpt from the Spectrum Writer Reference Manual provides some tips that you may find helpful working with reports that contain multiple control breaks.

Working with Multiple Control Breaks

You may have more than one control break in a report. Spectrum Writer allows an unlimited number of control breaks. Just remember that each of the break fields must be a sort field.

When a report has more than one control break, each break is thought of as having a "level." The order in which the break fields are listed in the SORT statement determines each break's level. The break field appearing first in the SORT statement is considered the "highest" level break field. The break field appearing next in the SORT statement is considered the "next highest" level break field, and so on to the lowest level break field.

For example, consider the following SORT statement:

SORT: REGION(TOTAL) EMPL–NAME(TOTAL) CUSTOMER

This SORT statement contains three sort fields. The TOTAL parm after the first two fields makes them control break fields. REGION is the higher level break field, since it appears first in the SORT statement. EMPL–NAME is the lower level break field.

Even when BREAK statements are used to identify break fields, it is still the order of the fields in the SORT statement that determines the level of the break fields. The order in which the BREAK statements appear is not significant. (All BREAK statements must, however, appear after the SORT statement.) Consider the following statements:

SORT: REGION EMPL–NAME CUSTOMER
BREAK: EMPL–NAME
BREAK: REGION

The preceding statements produce the very same result as the earlier example that used a SORT statement alone. REGION will be the high level break field, and EMPL–NAME will be a lower level break field (due to their relative position in the SORT statement).

Here is why a break's level is important: whenever a control break occurs for a particular break field, all lower level breaks are "forced." That is, a control break is automatically processed for all lower level control breaks, whether or not the contents of those break fields changed value.

For example, consider the report shown in Figure 63 which uses a SORT statement to request two levels of control breaks. By making both REGION and EMPL–NAME break fields, the report shows the totals sales for each employee within a region, as well as for each region.

Consider what happens as Spectrum Writer is printing the report and the REGION field changes value. The control break for REGION must be processed, with region totals being printed. But, there is a lower level break than REGION, namely EMPL–NAME. So, Spectrum Writer will first process the EMPL–NAME control break, printing the sales totals for the last employee within the region. Then the control break for REGION will be processed, with the sales totals being printed for the whole region.

Now consider a place in the report, where the EMPL–NAME field changes, but the REGION field does not change. In this case Spectrum Writer will process only the EMPL–NAME control break, because there are no lower level breaks to be forced.

As a means of helping you visualize the level of the control breaks, Spectrum Writer uses a slightly different total line for each level of control break. For the lowest level control break, the total line begins with three asterisks. The total line for the next higher level break begins with six asterisks. Each higher level control break gets three additional asterisks.

This helps when you are scanning a report for a particular level of break totals. Just scan down the left side of the report looking for the total line with the appropriate number of asterisks.

When more than one control break is used in a report, it is often desirable to use a larger spacing factor for the higher level break(s). For example we might want to just skip 1 line whenever the EMPL–NAME changes, but skip to a whole new page whenever the REGION changes. This would be specified by using a break spacing parm in either the SORT statement or the BREAK statement (see page 178). For example:

SORT: REGION EMPL–NAME CUSTOMER
BREAK: REGION SPACE(PAGE)
BREAK: EMPL–NAME SPACE(1)

Or, to specify the same spacing parms directly in the SORT statement:

SORT: REGION(PAGE) EMPL–NAME(1) CUSTOMER


Copyright 2024.
Pacific Systems Group.
All rights reserved.


Spectrum Writer 4GL - the economical alternative to SAS, Easytrieve, DYL-280...

Home | Products | Prices | Documentation | 30-Day Trials | Customer Reviews | Company
Send Your Comments or Questions