Oracle® Reports Building Reports
10g Release 2 (10.1.2)
In this chapter, you will learn about across group reports. By following the steps in this chapter, you can generate the report output shown in Figure 12-1.
Figure 12-1 Across group report output
Reports Builder enables you to modify the look of your report in multiple ways. In this example, you will build an across group report that prints the values of a database column across the page instead of down.
In across reports with breaks, the master (or break) group prints "top to bottom"; that is, as it would in other master/detail reports. However, the values in the detail group print across the page, from left to right. When there are more values than will fit on a line, Oracle Reports wraps the line and prints the remaining values across the page on the next line.
For more information on break reports, refer to the Oracle Reports online Help.
The break in this report is created through a data link between a master group and a detail query.
To create the layout used in this report, you will select the master/detail style, then modify the Print Direction setting for one of the groups to ensure it prints across the page instead of down the page.
As you build this example report, you will:
Create two queries that select all of the columns displayed, then link them to establish a master/detail relationship
Create the default layout using the Report Block Wizard.
To see a sample across report with control breaks, open the examples folder called
acrossbreak, then open the Oracle Reports example report named
acrossbreak.rdf. For details on how to open it, see "Accessing the Example Reports" in the Preface.
To build the example in this chapter, you must have access to the Human Resources sample schema (HR) provided with the Oracle Database. If you do not know if you have access to this sample schema, contact your database administrator.
When you create a report, you can either use the Report Wizard to assist you or create the report yourself. In this example, you will use the Data Model view to create your two queries, then use the tool palette to create a data link between the two queries to relate the data tables.
To create two queries:
Launch Reports Builder (or, if already open, choose File > New > Report)
In the Welcome or New Report dialog box, select Build a new report manually, then click OK.
In the Data Model view that displays, click the SQL Query tool in the tool palette then click in an open area of the Data Model view to display the SQL Query Statement dialog box.
In the SQL Query Statement field, enter the following
SELECT ALL DEPARTMENTS.DEPARTMENT_ID, DEPARTMENTS.DEPARTMENT_NAME, DEPARTMENTS.MANAGER_ID, DEPARTMENTS.LOCATION_ID FROM DEPARTMENTS
Note:You can enter this query in any of the following ways:
The data model for your new query displays:
Figure 12-2 Data Model for Query 1
Create another query, this time using the following code:
SELECT ALL EMPLOYEES.LAST_NAME, EMPLOYEES.FIRST_NAME, EMPLOYEES.DEPARTMENT_ID FROM EMPLOYEES ORDER BY EMPLOYEES.LAST_NAME
Note:You can also copy and paste the code from the text file provided in the acrossbreak folder, called
In the Data Model view, click the Data Link tool in the tool palette.
Click and drag your mouse from DEPARTMENT_ID column in Q_1, to DEPARTMENT_ID1 in Q_2 to create a data link between the two queries.
Your data model should now look like this:
Figure 12-3 Data Model of the two linked queries
Note:You can right-click the data link, then choose Property Inspector from the pop-up menu to ensure that the data link was created properly.
The steps in this section show you how to use the Report Block Wizard to create the layout and choose how your data will display in your report. Here, you will choose the style of report you want to create, and choose to display the data across the report (hence creating the across group report).
To create the default layout:
In the Object Navigator, double-click the Paper Layout node to display the Paper Layout view.
In the Paper Layout view, choose Insert > Report Block to display the Report Block Wizard.
In the Report Block Wizard, on the Style page, select Group Above, then click Next.
On the Groups page:
Click G_LAST_NAME in the Available Groups list, then click Across to specify the Print Direction and move this field to the Displayed Groups list.
Click G_DEPARTMENT_ID, then click Down.
On the Fields page, click the right arrow (>) to move the following fields from the Available Fields list to the Displayed Fields list, then click Next:
On the Labels page, click Next.
On the Template page, make sure Beige is selected under Predefined Template, then click Finish to display your report output in the Paper Design view. It should look like this:
Figure 12-4 Paper Layout view for the across group report
In this section, you will run your report to the Paper Design view so you can see how your report displays.
Click the Paper Design button in the toolbar. Your report runs, then displays in the Paper Design view. It should look like the following:
Figure 12-5 Paper Design View of the Across Group Report
Save your report as
Congratulations! You have successfully created an across group paper report. You now know how to:
manually create a data model with two queries.
create a master/detail report using the Report Block Wizard.
For more information on any of the wizards, views, or properties used in this example, refer to the Oracle Reports online Help, which is available in Reports Builder or hosted on the Oracle Technology Network (OTN), as described in Section 3.1.1, "Using the Oracle Reports online Help".