Skip Headers

Oracle9i Reports Building Reports
Release 9.0

Part Number B10310-01
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

12
Building a Mailing Label Report

Figure 12-1 Mailing label report output

Text description of orbrmail_space.gif follows.

Text description of the illustration orbrmail_space.gif

Reports Builder provides many different layouts for your reports to suit your needs. In this example, you will learn how to set up a mailing label report so you can print out addresses from your database and print them out as mailing labels.

About mailing label reports

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.

Concepts

Mailing labels can be created using simple, one-query reports with a special layout style.

Data Relationships
Layout

Example Scenario

In this example, you will use the Report Wizard to define a mailing label layout for your report, and use the Query Builder to write a single query that selects all of the columns for this report. You don't need to create any other data objects; Oracle9i Reports will create all other necessary data objects by default. You will then create another mailing label report, also using a single query, this time using format triggers to suppress blank lines that may appear in the labels.

To see a sample mailing label report, open the examples folder named mailinglabel, then open the Oracle9i Reports example report named mailinglabel.rdf. For details on how to open it, see "Accessing the example reports" in the Preface.

Table 12-1 Features demonstrated in this mailing label report example
Feature Location

Use the Report Wizard to create a introductory mailing label report with a paper layout.

Section 12.2, "Use the Report Wizard to create a mailing label report"

12.1 Prerequisites for this example

To build the example in this chapter, you must have access to the sample schema provided with the Oracle9i database. If you don't know if you have access to this sample schema, contact your database administrator. You should have access to the "Human Resources" portion of the schema to complete this example.

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


  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

  13. In the LOCATIONS table, select the check boxes next to the following column names:

    • STREET ADDRESS

    • POSTAL CODE

    • CITY

    • STATE PROVINCE

  14. Click OK.

  15. In the Data Source definition field, your query should look something like this:

    SELECT ALL EMPLOYEES.LAST_NAME,
    EMPLOYEES.FIRST_NAME,
    LOCATIONS.STREET_ADDRESS, 
    LOCATIONS.POSTAL_CODE, LOCATIONS.CITY,
    LOCATIONS.STATE_PROVINCE
    FROM EMPLOYEES, LOCATIONS
    ORDER BY EMPLOYEES.LAST_NAME
    


    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.


  16. Click Next.


    Note:

    If you are not already connected to a database, you will be prompted to connect to the database when you click Next. Ensure that you connect to a database that has the appropriate schema for this example. Section 12.1, "Prerequisites for this example" describes the sample schema requirements for this example.


  17. On the Text page, format the way you want the mailing labels to display. Steps 20 through 24 will show you how to display your labels in the following format:

    John Smith
    55 Main Street
    Springfield, ME 00000
    
    
  18. In the Available Fields list, click FIRST_NAME, then click the right arrow (>) to move this field to the Mailing Label list.

  19. In the Available Fields list, click LAST_NAME, then click the right arrow (>).

  20. In the Available Fields list, click LAST_NAME, then click the right arrow (>).

  21. Click New Line.

  22. In the Available Fields list, click STREET_ADDRESS, then click the right arrow (>).

  23. Click New Line.

  24. In the Available Fields list, click CITY, then click the right arrow (>).

  25. Press Backspace on your keyboard to remove the extra space.

  26. Click Comma.

  27. In the Available Fields list, click STATE, then click the right arrow (>).

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

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

  29. Click Next.

  30. 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 12-2 Paper Design view for the mailing label report

Text description of maillab_1.gif follows.

Text description of the illustration maillab_1.gif

  • Save your report as mailinglabel_<your initials>.rdf.

    12.3 Add Vertical Spacing

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

    To add vertical spacing:

    1. In the Object Navigator, under your report name, expand the Paper Layout node.

    2. Under Paper Layout, expand the Main Section node.

    3. Under Body, find the repeating frame called R_G_POSTAL_CODE.

    4. Press F4 to open the Property Inspector for this repeating frame.

    5. Under Repeating Frame, next to Vert. Spacing Between Frames, type 0.25.

    6. Press Enter to add your changes.

    7. In the toolbar, click Run Paper Layout to display your report in the Paper Design view.

    Your report should look something like this:

    Figure 12-3 Final mailing mabel report with vertical spacing

    Text description of orbrmail_space.gif follows.

    Text description of the illustration orbrmail_space.gif

    12.4 Summary

    Congratulations! You have successfully created a mailing label 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 Reports Builder online help, which you can access in two ways:


  • Go to previous page Go to next page
    Oracle
    Copyright © 2002 Oracle Corporation.

    All Rights Reserved.
    Go To Table Of Contents
    Contents
    Go To Index
    Index