Summary Oracle Fusion Middleware Online Documentation Library

Building a Mailing Label Report 6-1 6 Building a Mailing Label Report 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 Concepts ■ 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. ■ In a mailing label report, you can combine data from the database with static text to create addresses, and print them out as mailing labels for envelopes. ■ Mailing labels can be created using simple, one-query reports with a mailing label layout style. Data Relationships To fetch the data for a mailing label report, all you need to do is create a query to select it. Layout ■ 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 6-2 Oracle Reports Users Guide to Building Reports want to specify that space be inserted between mailing labels in the layout so that they are correctly positioned when printing them onto labels. Example Scenario 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.

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

6.2 Use the Report Wizard to Create a Mailing Label Report

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:

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 Mailing Label, then click Next .

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

7. On the Data page, click Query Builder.

8. In the Select Data Tables dialog box, click the EMPLOYEES table, then click

Include .

9. 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. Building a Mailing Label Report 6-3

10. Click the LOCATIONS table, then click Include.

11. Click Close.

The three tables display in the Query Builder.

12. In the EMPLOYEES table, select the check boxes next to the following column

names: ■ FIRST NAME ■ LAST NAME ■ EMPLOYEE ID 13. In the LOCATIONS table, select the check boxes next to the following column names: ■ STREET ADDRESS ■ POSTAL CODE ■ CITY ■ STATE PROVINCE ■ LOCATION ID 14. Click OK. 15. 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

16. Click Next.

17. 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: Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called mailinglabel_code.txt into the Data Source definition field. ■ Click Query Builder to build the query without entering any code manually, as described in the steps above. ■ 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 6.1, Prerequisites for This Example describes the sample schema requirements for this example.