Skip Headers
Oracle® Reports Building Reports
10g Release 2 (10.1.2)
B13895-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

12 Building an Across Group Report

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

Description of Figure 12-1  follows
Description of "Figure 12-1 Across group report output"

Concepts

Data Relationships

The break in this report is created through a data link between a master group and a detail query.

Layout

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.

Example Scenario

As you build this example report, you will:

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.

12.1 Prerequisites for this example

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.

12.2 Create two queries

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:

  1. Launch Reports Builder (or, if already open, choose File > New > Report)

  2. In the Welcome or New Report dialog box, select Build a new report manually, then click OK.

  3. 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.

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

    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:
    • Copy and paste the code from the provided text file called acrossbreak_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.


  5. Click OK.

    The data model for your new query displays:

    Figure 12-2 Data Model for Query 1

    Description of Figure 12-2  follows
    Description of "Figure 12-2 Data Model for Query 1"

  6. 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 acrossbreak_code.txt.

  7. Click OK.

  8. In the Data Model view, click the Data Link tool in the tool palette.

  9. 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

    Description of Figure 12-3  follows
    Description of "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.

12.3 Create the default layout

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:

  1. In the Object Navigator, double-click the Paper Layout node to display the Paper Layout view.

  2. In the Paper Layout view, choose Insert > Report Block to display the Report Block Wizard.

  3. In the Report Block Wizard, on the Style page, select Group Above, then click Next.

  4. 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.

    • Click Next.

  5. 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:

    • DEPARTMENT_ID

    • DEPARTMENT_NAME

    • LAST_NAME

    • FIRST_NAME

  6. On the Labels page, click Next.

  7. 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

Description of Figure 12-4  follows
Description of "Figure 12-4 Paper Layout view for the across group report"

12.4 Run your report to paper

In this section, you will run your report to the Paper Design view so you can see how your report displays.

  1. 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

    Description of Figure 12-5  follows
    Description of "Figure 12-5 Paper Design View of the Across Group Report"

  2. Save your report as acrossbreak_your_initials.rdf.

12.5 Summary

Congratulations! You have successfully created an across group paper report. You now know how to:

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".