The steps in this section will show you how to create a second query in the data model that retrieves the information stored in the table you created in Section 36.2, "Create a table in the database to hold the TOC data". This query will fetch the data necessary for generating the table of contents in the Header section of your report.
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.
In the SQL Query Statement field, enter the following
SELECT * FROM TOC_MULTILEVEL
Note:You can enter this query in any of the following ways:
Copy and paste the code from the provided text file called
multilevel_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.
In the new query, click and drag the MAIN_TOPIC column to a separate group above the rest of the query.
Click the Summary Column tool in the tool palette, then click in the new group object to create a summary column.
Double-click the new summary column object to display the Property Inspector, and set the following properties:
Under General Information, set the Name property to
Under Summary, set the Function property to Minimum and set the Source property to PAGE
Your data model should now look like this:
Save your report.