10.2 Group Report with One Break Column

The most basic case of a group left or above report is to have one break group with one break column in it. This means that a single master field value will print once for many detail field values.

To see a sample group left report with one break column, open the examples folder named break, then open the Oracle Reports example named grp1col_lft1.rdf. For details on how to access it, see "Accessing the Example Reports" in the Preface.

Concepts

  • Create a group left (or above) report when you want to prevent a column from repeatedly displaying the same value while other column values in the rows change.

  • You can build a group left or above report with either a single-query or multiple queries. A single-query report typically runs faster than a multiquery report.

  • You must ensure that your SELECT statement includes a column, called a break column, containing at least one value which repeats over multiple records (for example, department number in the example report above). With the break column, you will create a second group, called a break group, to create the breaks in the data.

  • This report uses a default tabular format. You will improve the readability of the report by changing the vertical spacing for a repeating frame to insert a space between each set of department information (for example, between the last record of Department 10 and the first record of Department 20, as shown in the example report above). You will also add a format mask.

10.2.1 Create a data model with a break group and group left layout

When you are creating a single-query report, such as this one, you can use the Report Wizard to create the data model and layout simultaneously.

To create a data model and layout:

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

  2. In the Welcome or New Report dialog box, select Use the Report Wizard, then click OK.

  3. If the Welcome page displays, click Next.

  4. On the Report Type page, select Create Paper Layout Only, then click Next.

  5. On the Style page, type a Title for your report, select Group Left, then click Next.

  6. On the Data Source page, click SQL Query, then click Next.

  7. On the Data page, enter the following SELECT statement in the Data Source definition field:

    SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME,
    JOB_ID, SALARY, DEPARTMENT_ID
    FROM EMPLOYEES 
    

    Note:

    You can enter this query in any of the following ways:
    • Copy and paste the code from the provided text file called across_code.txt into the Data Source definition field.

    • Click Query Builder to build the query without entering any code manually.

    • Type the code in the Data Source definition field.

  8. Click Next.

    Note:

    If you are not already connected to a database, you will be prompted to connect to the database when you click Query Builder or Next. Ensure that you connect to a database that has the appropriate schema for this example. Section 10.1, "Prerequisites for This Example" describes the sample schema requirements for this example.
  9. On the Groups page, click DEPARTMENT_ID and click the right arrow (>) to move this field to the Group Fields list, then click Next.

    Figure 10-2 Groups page of the Report Wizard

    Description of Figure 10-2 follows
    Description of "Figure 10-2 Groups page of the Report Wizard"

  10. On the Fields page, click the double right arrows (>>) to move all of the fields to the Displayed Fields list.

    Figure 10-3 Fields page of the Report Wizard

    Description of Figure 10-3 follows
    Description of "Figure 10-3 Fields page of the Report Wizard"

  11. Click Next until you reach the Template page of the Report Wizard.

  12. On the Template page, select Predefined Template and click Beige, then click Finish to display your report output in the Paper Design view. It should look something like this:

    Figure 10-4 Paper Design view for the single-query group left report

    Description of Figure 10-4 follows
    Description of "Figure 10-4 Paper Design view for the single-query group left report"

10.2.2 Format a field

In the Paper Design view, notice the Salary field. The values are neither aligned nor displayed as monetary amounts. You can quickly rectify this in the Paper Design view.

To assign a format mask to monetary values:

  1. In the Paper Design view, click the first number value underneath the Salary label. Notice that all of the values are immediately selected, indicating that you can change their properties simultaneously.

  2. Click the Currency button in the toolbar. A currency symbol immediately appears next to all of the values.

  3. Click the Add Decimal Place button twice. Two decimal places are added to the right of the decimal point.

  4. Resize the fields. Click and drag the rightmost handle of the cell value under the Salary label about 0.5 inches (1.5 centimeters) to the left.

  5. Shift-click the Salary label.

  6. Click the Align Right button in the toolbar.

  7. Click in an open area of the Paper Design view to deselect all of the objects.

  8. Save the report as grp_lft2_your_initials.rdf.

Figure 10-5 Salaries formatted

Description of Figure 10-5 follows
Description of "Figure 10-5 Salaries formatted"

10.2.3 Use the Property Inspector to add white space

If you examine your report output in the Paper Design view, you will notice that it can be difficult to distinguish where one department's data ends and the next department's data begins. To make the report more readable, you want to add some white space between the departments, but you want to retain the same spacing between employee rows. For this report, you will change a repeating frame property for the master repeating frame to create some white space between the department records.

To create white space between the departments:

  1. In the Paper Design view, click the first number value underneath the Department Id label. Notice that all of the department numbers are immediately selected.

  2. Click the Select Parent Frame button in the toolbar. Notice how the border of the repeating frame that contains the Department Id field is now highlighted.

  3. Choose Tools > Property Inspector to display the Property Inspector, and set the following properties:

    • Under Repeating Frame, set the Vert. Space Between Frames property to 0.25.

    Figure 10-6 Property Inspector for master repeating frame

    Description of Figure 10-6 follows
    Description of "Figure 10-6 Property Inspector for master repeating frame"

  4. Click the title bar of the Report Editor to make it the active window again.

  5. Save your report.

    Figure 10-7 Paper Design view after white space is added

    Description of Figure 10-7 follows
    Description of "Figure 10-7 Paper Design view after white space is added"