35 Building a Paper Report with a Simple Table of Contents and Index

In this chapter, you will learn about reports that include a simple table of contents and index.


Generating a table of contents or index is not supported for matrix reports.

By following the steps in this chapter, you can generate the report output shown in Figure 35-1 and Figure 35-2.

Figure 35-1 Simple table of contents for a large report

Description of Figure 35-1 follows
Description of ''Figure 35-1 Simple table of contents for a large report''

Figure 35-2 Simple index for a large report

Description of Figure 35-2 follows
Description of ''Figure 35-2 Simple index for a large report''


  • When you have large paper report, it is sometimes easier for your users to navigate through the report if you include a table of contents. Using Reports Builder, you can generate a table of contents that displays at the beginning of your paper report.

  • Normally, Reports Builder formats the report starting with the Header section, then the Main section, followed by the Trailer section. With the functionality demonstrated in this example report, Reports Builder can format any section first to create information that is only known at the time of formatting, such as page numbers, then use that information in the formatting of a previous section.

  • In this example, you will use the built-in procedure called SRW.SET_FORMAT_ORDER to generate the Main section of the report first, then the Header and Trailer sections. Doing so enables you to generate the page numbers for the report in the Main section, then display the page numbers in the table of contents in the Header section.


    Although you can use SRW.SET_FORMAT_ORDER to change the order in which the report is formatted, the report will still display the Header section first, then the Main section, and finally the Trailer section. You can use SRW.SET_FORMAT_ORDER to simply change the formatting order, but not the display order of the report sections.
  • You will use the After Parameter Form trigger and a format trigger to place the page numbers temporarily in a table you create in the database. You will then create a simple tabular report that displays at the beginning of your report, that lists the category and its page number. Finally, you will create an index that simply lists the record and the page number in the Trailer section of the report.

For information on creating a multilevel table of contents, refer to Chapter 36, "Building a Paper Report with a Multilevel Table of Contents".

Example Scenario

In this example, you will generate a list of all the e-mail addresses for your customer database, which contains thousands of records. First, you want to categorize the customers (in this case, by country), then generate a table of contents so you can easily find the e-mail address for the desired customer. Then, you will learn how to create an index for your report.

As you build this example report, you will:

To see a sample table of contents and index report, open the examples folder named tocindex, then open the Oracle Reports example named toc_index.rdf. For details on how to open it, see "Accessing the Example Reports" in the Preface.