Oracle® Reports Building Reports
10g Release 2 (10.1.2)
In this chapter, you will learn about mailing label reports, one of the standard report styles. By following the steps in this chapter, you can generate the report output shown in Figure 6-1.
Figure 6-1 Mailing label report output
A mailing label report consists of data displayed in a format suitable for use as address labels on envelopes. The labels can be printed in one or many columns, and can begin at any position.
Mailing labels can be created using simple, one-query reports with a mailing label layout style.
To fetch the data for a mailing label report, all you need to do is create a query to select it.
Oracle Reports provides a default mailing label layout in which the fields are positioned so that each field is directly below the preceding field. Field labels are not printed.
You will use the Report Wizard to create a simple mailing label report. The Report Wizard provides you with a formatting page, where you can choose the layout of each mailing label.
You will use the Vertical Spacing field, located in the Property Inspector for the repeating frame, to control the amount of blank space between each mailing label. The default spacing between repeating frames may not be sufficient, and you may want to specify that space be inserted between mailing labels in the layout so that they are correctly positioned when printing them onto labels.
As you build this example report, you will:
Use the Report Wizard to create a mailing label report and use Query Builder to write a single query that selects all of the columns for this report. You do not need to create any other data objects; Oracle Reports will create all other necessary data objects by default.
Add vertical spacing using the Vertical Spacing property to add space between each record in your mailing label report
To see a sample mailing label report, open the examples folder named
mailinglabel, then open the Oracle Reports example report named
mailinglabel.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. To build the simple report in this example, you can use the Report Wizard. Using the wizard enables you to define the layout for the report, as well as set the data definition.
To create a simple mailing label report:
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 Mailing Label, then click Next.
On the Data Source page, click SQL Query, then click Next.
On the Data page, click Query Builder.
In the Select Data Tables dialog box, click the EMPLOYEES table, then click Include.
Click the DEPARTMENTS table, then click Include.
Note:In this case, you must include the DEPARTMENTS table since the EMPLOYEES and LOCATIONS tables are not directly related in the schema.
Click the LOCATIONS table, then click Include.
The three tables display in the Query Builder.
In the EMPLOYEES table, select the check boxes next to the following column names:
In the LOCATIONS table, select the check boxes next to the following column names:
In the Data Source definition field, your query should look something like this:
SELECT ALL EMPLOYEES.EMPLOYEE_ID, EMPLOYEES.FIRST_NAME, EMPLOYEES.LAST_NAME, LOCATIONS.STREET_ADDRESS, LOCATIONS.POSTAL_CODE, LOCATIONS.CITY, LOCATIONS.STATE_PROVINCE, LOCATIONS.LOCATION_ID FROM EMPLOYEES, DEPARTMENTS, LOCATIONS WHERE ((EMPLOYEES.DEPARTMENT_ID = DEPARTMENTS.DEPARTMENT_ID) AND (DEPARTMENTS.MANAGER_ID = EMPLOYEES.EMPLOYEE_ID) AND (DEPARTMENTS.LOCATION_ID = LOCATIONS.LOCATION_ID))
Note:You can enter this query in any of the following ways:
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 6.1, "Prerequisites for this example" describes the sample schema requirements for this example.
On the Text page, format the way you want the mailing labels to display. Steps 21 through 30 will show you how to display your labels in the following format:
John Smith 55 Main Street Springfield, ME 00000
In the Available Fields list, click FIRST_NAME, then click the right arrow (>) to move this field to the Mailing Label list.
In the Available Fields list, click LAST_NAME, then click the right arrow (>).
Click New Line.
In the Available Fields list, click STREET_ADDRESS, then click the right arrow (>).
Click New Line.
In the Available Fields list, click CITY, then click the right arrow (>).
Press Backspace on your keyboard to remove the extra space.
In the Available Fields list, click STATE_PROVINCE, then click the right arrow (>).
In the Available Fields list, click POSTAL_CODE, then click the right arrow (>).
The code in the Mailing Label Text box should look like this (if necessary,add spaces as shown):
&<FIRST_NAME> &<LAST_NAME> &<STREET_ADDRESS> &<CITY>, &<STATE_PROVINCE> &<POSTAL_CODE>
Tip:For more information on formatting your mailing labels, click Help on this page of the Report Wizard.
On the Template page, select No Template and click Finish to display your report output in the Paper Design view. It should look something like this:
Figure 6-2 Paper Design view for the mailing label report
Save your report as
In this section, you will use the Vertical Spacing property to add space between each record in your mailing label report. You can adjust this spacing according to the size of the mailing labels where the records will be printed.
In the Object Navigator, under your report name, expand the Paper Layout node.
Under Paper Layout, expand the Main Section node.
Under Body, find the repeating frame called R_G_FIRST_NAME.
Double-click the repeating frame icon next to the R_G_FIRST_NAME node to display the Property Inspector.
Under Repeating Frame, next to Vert. Spacing Between Frames, type
Press Enter to add your changes.
In the toolbar, click Run Paper Layout to display your report in the Paper Design view.
Your report should look something like this:
Figure 6-3 Final mailing label report with vertical spacing
Congratulations! You have successfully created a mailing label paper report. You now know how to:
define a mailing label report using the Report Wizard.
adjust the vertical spacing between labels.
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".