19 Building a Report that Renumbers Pages by Repeating Frame

In this chapter, you will learn about reports that resets page numbers based on data shown. By following the steps in this chapter, you can generate the report output shown in Figure 19-1.

Figure 19-1 Pages renumbered by repeating frame report output

Description of Figure 19-1 follows
Description of ''Figure 19-1 Pages renumbered by repeating frame report output''

This example numbers pages using the format "Page X of Y". The first number (X) corresponds to the current page for each parent record (that is, each sales representative). This page number is reset to "1" for each sales representative, thus tracking the statistics of each representative separately.

The second number (Y) is the total pages required to display the customer information for each sales representative. This field is also reset with each new parent record.

Important Note: The steps in this chapter explain how to produce the "Page X of Y Pages" for the paper layout and have no effect on the Web source, because the Web source does not have pagination.

Concepts

  • The Page Numbering dialog box enables you to specify that the page number either reset at a particular repeating frame or increment over the entire report.

  • However, if you decide to use a page total that repeats on several pages, as with the second number in the example report, you need to be aware of certain rules that apply when formatting a field that contains a count of other objects. To be able to display such a value, called a page–dependent reference, on the first page—or any page prior to the final page—of the report, Reports Builder must format the field that will contain the value before it knows the value. As a result, any field displaying a value of this type must be fixed, so that Reports Builder knows how much space to reserve for it when formatting the report. Even if you set the Horizontal Elasticity property or Vertical Elasticity property to Expand, Contract, or Variable for such a field, Reports Builder considers it fixed. When you create such a field, you must ensure that it is large enough to contain the value.

  • An alternative is to hide the field and reference it from a boilerplate object. When using this method, the field can be variable, but the boilerplate remains fixed, so be sure to create a boilerplate object of sufficient size to hold the field.

  • Some values that are treated in this fashion by Reports Builder are &TOTAL LOGICAL PAGES, &TOTAL PANELS, and &TOTAL PHYSICAL PAGES, and any summaries or formulas that reference them. Summaries with either a Compute At property or Reset At property setting of Page and formulas that reference them are also considered page–dependent references. For a complete list of such values and a comprehensive discussion of Reports Builder's treatment of them, see the topics "Vertical Elasticity property" or "Horizontal Elasticity property" in the Oracle Reports online Help.

Data Relationships

As illustrated in Figure 19-1, this report contains both a master/detail relationship and a break. This results in two levels of data differentiation. The top level (the break) will determine when page numbers reset.

Layout

This report uses the master/detail layout style, with modifications. In addition, you will create two hidden fields for the page numbers, then reference them in a boilerplate object. This will ensure that the field displaying the total number of pages is the proper size. Then you will check the Maximum Records Per Page property setting for the break group's repeating frame to ensure that your pages are numbered correctly.

Example Scenario

In this example, you will create a page number in the margin of a report in the format "Page X of Y Pages". The page number X is incremented for each page produced by customer sales for one sales representative at a time. Y represents the total number of pages for the sales representative of that sales grouping and is reset for the next sales representative.

As you build this example report, you will:

To see a sample report that renumbers pages by repeating frame, open the examples folder named pagenum, then open the Oracle Reports example called pagenum.rdf. For details on how to open it, see "Accessing the Example Reports" in the Preface.