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.
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.
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.
Launch Reports Builder (or, if already open, choose File > New > Report)
In the Welcome or New Report dialog box, select Use the Report Wizard, then click OK.
If the Welcome page displays, click Next.
On the Report Type page, select Create Paper Layout Only, then click Next.
On the Style page, type a Title for your report, select Group Left, then click Next.
On the Data Source page, click SQL Query, then click Next.
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.
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.
On the Groups page, click DEPARTMENT_ID and click the right arrow (>) to move this field to the Group Fields list, then click Next.
On the Fields page, click the double right arrows (>>) to move all of the fields to the Displayed Fields list.
Click Next until you reach the Template page of the Report Wizard.
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:
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.
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.
Click the Currency button in the toolbar. A currency symbol immediately appears next to all of the values.
Click the Add Decimal Place button twice. Two decimal places are added to the right of the decimal point.
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.
Shift-click the Salary label.
Click the Align Right button in the toolbar.
Click in an open area of the Paper Design view to deselect all of the objects.
Save the report as
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.
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.
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.
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.
Click the title bar of the Report Editor to make it the active window again.
Save your report.