Create an After Parameter Form trigger

35-8 Oracle Reports Users Guide to Building Reports Section 35.2.1, Create a table in the database to hold the TOC data . You will later create a tabular layout to display this information in your table of contents. To create a second query with a formula column: 1. In the Data Model view, click the SQL Query tool in the tool palette then click in an open area of the Data Model view, somewhere to the right of query Q_1, to display the SQL Query Statement dialog box.

2. In the SQL Query Statement field, enter the following SELECT statement:

SELECT TOPIC, MINPAGE FROMPAGE, MAXPAGE TOPAGE FROM TOC_EXAMPLE GROUP BY TOPIC

3. Click OK. Your data model should now look like this:

Figure 35–6 Data model with second query 4. In the Data Model view, click the Formula Column tool in the tool palette, then click in the group G_TOPIC for the second query.

5. While the formula column is selected, choose Tools Property Inspector to

display its Property Inspector.

6. Under General Information, set the Name property to TOC_pages, and the

Datatype property to Character.

7. Under PlaceholderFormula, click the PLSQL Formula property field to display

the PLSQL Editor. 8. In the PLSQL Editor, use the template to enter the following code: Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called toc_index_code.txt into the SQL Query Statement field. ■ Click Query Builder to build the query without entering any code manually. ■ Type the code in the SQL Query Statement field. Building a Paper Report with a Simple Table of Contents and Index 35-9 function TOC_pagesFormula return Char is begin if :fromPage = :toPage then return :fromPage; else return :fromPage ||-|| :toPage; end if; end;

9. Click Compile.

10. Once the code is compiled, click Close.

11. Save the report.

35.2.5 Create a report block to display the table of contents

The steps in this section will show you how to create a tabular report block in the Header section of your report. This report block will display the headings in the table of contents in this example, the country name, and the page range where the information can be found in the report. To create a tabular report block in the Header section:

1. In the Paper Layout view, click the Header Section button in the toolbar.

2. Click the Report Block tool in the tool palette, then draw an area about about 5

inches 12.5 centimeters wide and 1.5 inches 4 centimeters high in the Paper Layout view. When you release the mouse button, the Report Block Wizard displays.

3. On the Style page, select Tabular, then click Next.

4. On the Groups page, click G_TOPIC and click Down to move it to the Displayed

Groups list, then click Next. 5. On the Fields page, click each of the following fields in the Available Fields list, then click the right arrow to move them to the Displayed Fields list, then click Next : ■ TOPIC ■ TOC_pages 6. On the Labels page, click Next. 7. On the Template page, click Finish. Your report block displays in the Paper Layout view: Figure 35–7 Paper Layout view of the Header Section

8. Save your report.

Note: You can also copy and paste this code from the provided file, called toc_index_code.txt.