You are on page 1of 446

Oracle9i Reports Developer:

Build Reports

Volume 1 • Instructor Guide


.......................................................................................

D12997GC10
Production 1.0
June 2002
D34780
Author Copyright  Oracle Corporation, 2002. All rights reserved.

Ellen Gravina This documentation contains proprietary information of Oracle Corporation. It is


provided under a license agreement containing restrictions on use and disclosure
and is also protected by copyright law. Reverse engineering of the software is
Technical Contributors prohibited. If this documentation is delivered to a U.S. Government Agency of the
and Reviewers Department of Defense, then it is delivered with Restricted Rights and the
Cem Ayberkin following legend is applicable:

Christian Bauwens Restricted Rights Legend


Use, duplication or disclosure by the Government is subject to restrictions for
Alena Bugarova commercial computer software and shall be deemed to be Restricted Rights
Laurent Dereac software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS
252.227-7013, Rights in Technical Data and Computer Software (October 1988).
Warren Lord This material or any portion of it may not be copied in any form or by any means
without the express prior written permission of Oracle Corporation. Any other
Marcelo Manzano copying is a violation of copyright law and may result in civil and/or criminal
Darren McBurney penalties.

If this documentation is delivered to a U.S. Government Agency not within the


Paul Narth Department of Defense, then it is delivered with “Restricted Rights,” as defined in
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Daphne Nougier
The information in this document is subject to change without notice. If you find
Miyuki Ohsato any problems in the documentation, please report them in writing to Education
Products, Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores,
Ligia Jasmin Robayo CA 94065. Oracle Corporation does not warrant that this document is error-free.
Jim Safcik Oracle is a registered trademark and all references to Oracle and Oracle products
are trademarks or registered trademarks of Oracle Corporation.
Rie Saitoh
All other products or company names are used for identification purposes only
Sarah Spicer and may be trademarks of their respective owners.

Martijn van der Bruggen


Vanessa Wang
Philipp Weckerle
Ted Witiuk

Publisher
John B Dawson
Contents
.....................................................................................................................................................

Contents
Preface
Profile xvi
Resources xvii
Typographic Conventions xviii

Introduction
Course Objectives I-3
Course Content I-5

Lesson 1: Introduction to Oracle9i Reports Developer


Overview 1-3
What Is Business Intelligence? 1-5
Enterprise Reporting 1-7
Web Publishing and Paper Publishing 1-11
Oracle9i Reports Developer 1-13
Oracle9i Products 1-15
What Is Oracle9i Reports Developer? 1-21
Summary 1-25

Lesson 2: Designing and Running Reports


Overview 2-3
Designing Reports 2-5
Design Considerations 2-9
Retrieving and Sharing Data 2-17
Running a Report 2-19
Previewing Reports 2-21
Summary 2-27
Practice Session Overview: Lesson 2 2-29
Practice Session: Lesson 2 2-30

Lesson 3: Working in Oracle9i Reports Developer


Overview 3-3
Reports Developer Executables 3-5
Reports Builder 3-9

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports iii
Contents
.....................................................................................................................................................

Reports Builder Components 3-13


Navigating Around the Oracle9i Reports Main Menu 3-15
Object Categories 3-23
Customizing Your Oracle9i Reports Session 3-33
Oracle9i Reports Environment Variables 3-35
Reports Builder Help Options 3-37
Summary 3-39
Practice Session Overview: Lesson 3 3-41
Practice Session: Lesson 3 3-42

Lesson 4: Creating a Paper Report


Overview 4-3
Invoking Reports Builder and the Report Wizard 4-7
Creating a Tabular Report Using the Wizard 4-9
Creating Other Report Styles 4-27
Previewing a Paper Report in a Web Browser 4-37
Summary 4-39
Practice Session Overview: Lesson 4 4-41
Practice Session: Lesson 4 4-42

Lesson 5: Enhancing a Basic Paper Report


Overview 5-3
What Is the Paper Design View? 5-5
Modifying a Report in the Paper Design View 5-7
Summary 5-23
Practice Session Overview: Lesson 5 5-25
Practice Session: Lesson 5 5-26

Lesson 6: Managing Report Templates


Overview 6-3
Using the Report Templates 6-5
Modifying a Template 6-7
Adding Web Links to a Template for Report HTML Output 6-13

.....................................................................................................................................................
iv Oracle9i Reports Developer: Build Reports
Contents
.....................................................................................................................................................

Predefining Your Own Templates 6-15


Summary 6-19
Practice Session Overview: Lesson 6 6-21
Practice Session: Lesson 6 6-22

Lesson 7: Creating a Web Report


Overview 7-3
JavaServer Page (JSP) Technology 7-5
Creating a Web Report Using the Report Wizard 7-9
Web Source View 7-11
Generating Output 7-17
Summary 7-19
Practice Session Overview: Lesson 7 7-21
Practice Session: Lesson 7 7-22

Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
Overview 8-3
Describing the Report Data Model 8-5
Modifying Properties of a Query 8-7
Changing the Group Structure 8-15
The Group Hierarchy 8-17
Ordering Data in a Group Hierarchy 8-19
Filtering Data in a Group 8-23
Summary 8-25
Practice Session Overview: Lesson 8 8-27
Practice Session: Lesson 8 8-28

Lesson 9: Enhancing Reports Using the Data Model: Data Sources


Overview 9-3
The Data Source Types 9-5
Pluggable Data Sources 9-7
Using XML as a Data Source 9-9
XML Example 9-11
Adding New Data 9-13

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports v
Contents
.....................................................................................................................................................

Using REF Cursor Queries 9-15


Using Data Links to Structure Data 9-19
Efficiency Issues: Multiple- or Single-Query Hierarchy 9-25
Summary 9-27
Practice Session Overview: Lesson 9 9-29
Practice Session: Lesson 9 9-30

Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
Overview 10-3
The Data Model Column Types 10-5
Maintaining Data Source Columns 10-7
Using a Data Source Column to Output Contents of a File 10-9
Creating a Column 10-11
Creating Summary Columns 10-13
Example Report Displaying Subtotals 10-15
Example Report Displaying Percentages 10-17
Creating Formula Columns 10-21
Creating Placeholder Columns 10-23
Example Report to Populate a Placeholder 10-25
Summary 10-27
Practice Session Overview: Lesson 10 10-29
Practice Session: Lesson 10 10-30

Lesson 11: Enhancing Reports Using the Paper Layout


Overview 11-3
Viewing the Paper Layout 11-5
Designing Multipanel Reports 11-9
Recognizing Layout Objects 11-13
The Paper Layout Layers 11-15
Creating Layout Objects 11-21
The Paper Layout Tools 11-23
Report Bursting 11-25
Creating Variable Length Lines 11-35
Summary 11-37
Practice Session Overview: Lesson 11 11-39
Practice Session: Lesson 11 11-40

.....................................................................................................................................................
vi Oracle9i Reports Developer: Build Reports
Contents
.....................................................................................................................................................

Lesson 12: Controlling the Paper Layout: Common Properties


Overview 12-3
Modifying Paper Layout Object Properties 12-5
Modifying Common Layout Properties 12-7
Sizing Objects 12-9
Anchors 12-11
Layout Object Relationships 12-13
Using Format Triggers 12-25
Layout Object Properties for Web Support 12-27
Summary 12-29
Practice Session Overview: Lesson 12 12-31
Practice Session: Lesson 12 12-32

Lesson 13: Controlling the Paper Layout: Specific Properties


Overview 13-3
Modifying Properties of a Repeating Frame 13-5
Print Direction 13-7
Minimum Widow Records 13-13
Column Mode 13-15
Modifying Properties of a Field 13-17
Displaying File Contents with a File Link 13-25
Summary 13-31
Practice Session Overview: Lesson 13 13-33
Practice Session: Lesson 13 13-34

Lesson 14: Web Reporting


Overview 14-3
High Quality Web Publishing 14-5
Creating Reports for the Web 14-7
Adding Dynamic Content to a Web Page 14-9
Creating a Report Block 14-11
Examining the Web Source Code 14-13
Customizing Reports JSPs 14-17
Summary 14-23
Practice Session Overview: Lesson 14 14-25
Practice Session: Lesson 14 14-26

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports vii
Contents
.....................................................................................................................................................

Lesson 15: Extending Functionality Using XML


Overview 15-3
Why Use XML Report Definitions? 15-5
Creating and Using XML Report Definitions 15-7
Running XML Report Definitions 15-17
Debugging XML Report Definitions 15-21
Summary 15-23
Practice Session Overview: Lesson 15 15-25
Practice Session: Lesson 15 15-26

Lesson 16: Creating and Using Report Parameters


Overview 16-3
Creating User Parameters 16-5
Referencing Parameters in a Report Query 16-7
Hints and Tips for Referencing Parameters 16-13
Creating a List of Values 16-15
Referencing System Parameters 16-19
Building a Paper Parameter Form 16-23
Using Parameter Form HTML Extensions 16-27
Summary 16-31
Practice Session Overview: Lesson 16 16-33
Practice Session: Lesson 16 16-34

Lesson 17: Embedding a Graph in a Report


Overview 17-3
Creating and Embedding a Graph in a Report 17-5
Using a Graph Hyperlink 17-13
Summary 17-15
Practice Session Overview: Lesson 17 17-17
Practice Session: Lesson 17 17-18

Lesson 18: Enhancing Matrix Reports


Overview 18-3
The Matrix Data Model 18-5
The Matrix Paper Layout 18-7
Creating Matrix Summaries 18-9

.....................................................................................................................................................
viii Oracle9i Reports Developer: Build Reports
Contents
.....................................................................................................................................................

Creating the Simple Matrix Report Manually 18-11


Building a Matrix with Group Report 18-13
Building a Nested Matrix 18-15
Summary 18-23
Practice Session Overview: Lesson 18 18-25
Practice Session: Lesson 18 18-26

Lesson 19: Coding PL/SQL Triggers


Overview 19-3
Types of Triggers in Reports 19-5
Using Report Triggers 19-7
Using Data Model Triggers 19-11
Using Layout Triggers 19-15
Writing Common Code 19-25
Publish Reports Based on Database Events 19-27
Summary 19-31
Practice Session Overview: Lesson 19 19-33
Practice Session: Lesson 19 19-34

Lesson 20: Extending Functionality Using the SRW Package


Overview 20-3
Contents of the Reports Builder Built-in Package 20-5
Outputting Messages 20-7
Executing a Nested Report 20-9
Restricting Data 20-13
Initializing Fields 20-15
Performing DDL Statements 20-17
Setting Format Attributes 20-19
Summary 20-25
Practice Session Overview: Lesson 20 20-27
Practice Session: Lesson 20 20-28

Lesson 21: Maximizing Performance Using Oracle9iAS Reports Services


Overview 21-3
Why Use Oracle9iAS Reports Services? 21-5
Oracle9iAS Reports Services Architecture 21-9

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports ix
Contents
.....................................................................................................................................................

Oracle9iAS Reports Services Runtime Architecture 21-13


Making a Request to Run a Report 21-15
Managing and Monitoring Oracle9iAS Reports Services 21-23
Summary 21-31
Practice Session Overview: Lesson 21 21-33
Practice Session: Lesson 21 21-34

Lesson 22: Building Reports: Efficiency Guidelines


Overview 22-3
Tuning Oracle9i Reports 22-5
Different Development and Run-Time Environments 22-19
Developing Reports to Run in Different GUIs 22-21
Building Reports to Run in Different Languages 22-23
Summary 22-27
Practice Session Overview: Lesson 22 22-29
Practice Session: Lesson 22 22-30

Appendix A: Solutions
Practice Session Overview: Lesson 2 A-3
Practice Session Solutions: Lesson 2 A-4
Practice Session Overview: Lesson 3 A-8
Practice Session Solutions: Lesson 3 A-9
Practice Session Overview: Lesson 4 A-11
Practice Session Solutions: Lesson 4 A-12
Practice Session Overview: Lesson 5 A-18
Practice Session Solutions: Lesson 5 A-19
Practice Session Overview: Lesson 6 A-23
Practice Session Solutions: Lesson 6 A-24
Practice Session Overview: Lesson 7 A-27
Practice Session Solutions: Lesson 7 A-28
Practice Session Overview: Lesson 8 A-30
Practice Session Solutions: Lesson 8 A-31
Practice Session Overview: Lesson 9 A-33
Practice Session Overview: Lesson 10 A-40
Practice Session Solutions: Lesson 10 A-41

.....................................................................................................................................................
x Oracle9i Reports Developer: Build Reports
Contents
.....................................................................................................................................................

Practice Session Overview: Lesson 11 A-45


Practice Session Solutions: Lesson 11 A-46
Practice Session Overview: Lesson 12 A-52
Practice Session Solutions: Lesson 12 A-53
Practice Session Overview: Lesson 13 A-55
Practice Session Solutions: Lesson 13 A-56
Practice Session Overview: Lesson 14 A-58
Practice Session Solutions: Lesson 14 A-59
Practice Session Overview: Lesson 15 A-61
Practice Session Solutions: Lesson 15 A-62
Practice Session Overview: Lesson 16 A-63
Practice Session Solutions: Lesson 16 A-64
Practice Session Overview: Lesson 17 A-67
Practice Session Solutions: Lesson 17 A-68
Practice Session Overview: Lesson 18 A-72
Practice Session Solutions: Lesson 18 A-73
Practice Session Overview: Lesson 19 A-77
Practice Session Solutions: Lesson 19 A-78
Practice Session Overview: Lesson 20 A-83
Practice Session Solutions: Lesson 20 A-84
Practice Session Overview: Lesson 21 A-93
Practice Session Solutions: Lesson 21 A-94
Practice Session Overview: Lesson 22 A-95
Practice Session Solutions: Lesson 22 A-96

Appendix B: Table Descriptions

Glossary

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports xi
Contents
.....................................................................................................................................................

.....................................................................................................................................................
xii Oracle9i Reports Developer: Build Reports
Preface

.................................
Preface
.....................................................................................................................................................

Instructor Note

PowerPoint Slides The slide show provides some manual builds to enable you to
step through your explanation. So that content can be reused for different delivery
formats, Oracle University does not allow the use of animation in the slide show. If
you know how to use PowerPoint, you can add animation or modify the manual builds
if you prefer.

Demonstrations Additional demonstration reports that are not mentioned in the


course instructor notes are included in the <oracle_home>\reports\samples
directory.
There is also a hosted enviroment for Oracle9i Reports demonstrations. Visit Oracle
Technology Network for the latest information: http://otn.oracle.com.

Practice Sessions Students might want to view the report output that they are asked
to produce in each question. Solution files of all reports are available in the SOLN
directory.
Suggest that students use Reports Builder to run any solution report file to see the
desired result. Remind them to use the appropriate option (i.e., Run Web Layout or
Run Paper Layout) to view the output

Setup Environment TThe setup environment for this course contains two tiers: the
database server and the client workstation.
Oracle9i Database Server Enterprise Edition is recommended for the database server.
The tables in the Human Resource (HR) and Order Entry (OE) schemas are used for
the demonstrations and practices. The EMP and DEPT tables are used in the lesson
Extending Functionality Using XML.
Oracle9i Developer Suite (Business Intelligence installation option) is recommended
for each client workstation. All reports, both Web and paper layouts, are run from
Reports Builder.
There is no middle tier application server required for this setup environment.

.....................................................................................................................................................
xiv Oracle9i Reports Developer: Build Reports
.....................................................................................................................................................

Known Issues If your setup environment uses Reports Builder 9.0.2, you need to be
aware of known issues with that release, as they may affect instructor demonsrations
and student practices.
• Query Builder: You cannot open tables containing user-defined objects in Query
Builder because Query Builder does not recognize these object types. These tables
include CUSTOMERS, OC_CORPORATE_CUSTOMERS, OC_CUSTOMERS,
OC_INVENTORIES, OC_ORDERS, OC_PRODUCT_INFORMATION,
PRODUCT_INFORMATION, PRODUCTS, and WAREHOUSES. To create a
report with one of these tables, you have to enter the query directly.
• Query Builder: Using the Sort option causes Reports Builder to crash. Refer to bug
#2352728 in the bug database (http://bug.us.oracle.com) for more information.
• Report Wizard: If you create a report using an object column (e.g.,
CUST_ADDRESS in the CUSTOMERS table) and then reenter the Wizard to
make modifications to the report or the layout, the selections you initially made for
that object column are not retained. Refer to bug #2294059 in the bug database for
more information.
• Templates: If you open one of the predefined templates in Reports Builder and
save it as another name, you receive “REP-69: Internal error”. Note, however, the
template is saved correctly under that new name. Refer to bug #2353764 in the bug
database for more information.
• Creating Columns: Suppose you create a report using the Report Wizard and then
manually create columns in the Data Model view of the Report Editor. In order to
display the new columns, you reenter the Wizard to update the layout. Reentering
the Wizard destroys the data model and you will receive several error messages
(e.g., “invalid reset group”) when you finish the Wizard and the paper layout
attempts to run. Refer to bug #2288263 in the bug database for more information.
• Matrix Reports: If you create a matrix with group report and save it as a JSP, you
will get an error: “ID attribute of rw:field tag is not unique”. Refer to bug
#2310757 in the bug database for more information.

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports xv
Preface
.....................................................................................................................................................

Profile
Before You Begin This Course
Before you begin this course, you should have:
• Thorough knowledge of creating SQL query statements
• Working experience of:
– Creating PL/SQL constructs, including conditional statements, procedures and
functions
– Creating PL/SQL stored (server) procedures and functions
– Using a graphical user interface (GUI)

Prerequisites
• The following instructor-led training (inClass) courses:
– Introduction to Oracle9i: SQL
– Introduction to Oracle9i: PL/SQL
• Or the following self-paced CD-ROM training (TBT) courses from the SQL
and PL/SQL Library:
– Oracle SQL: Basic SELECT Statements
– Oracle SQL: Data Retrieval Techniques
– Oracle SQL: DDL and DML
– PL/SQL: Basics
– PL/SQL: Procedures, Functions and Packages
– PL/SQL: Database Programming

Suggested
• Oracle9i: Advanced SQL (inClass)
• Or SQL and SQL*Plus: Advanced SELECT Statements (TBT)
• Oracle9i: Advanced PL/SQL (inClass)

Suggested Follow-up Courses


• Oracle9i Reports: Create Reports for the Web and Portals (eClass)
• Oracle9i Reports: Integrate Pluggable Data Sources (eClass)
• Oracle9iAS Reports Services: Deploy Internet Reports (eClass)

.....................................................................................................................................................
xvi Oracle9i Reports Developer: Build Reports
Profile
.....................................................................................................................................................

How This Course Is Organized


Oracle9i Reports Developer: Build Reports is an instructor-led course featuring
lecture and hands-on exercises. Online demonstrations and written practice sessions
reinforce the concepts and skills introduced.

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports xvii
Preface
.....................................................................................................................................................

Resources
Oracle Publications
Title Part Number
Oracle9iAS Release 2 Reports Services Release Notes - Solaris A96189-01
and Windows NT
Oracle9i Reports Developer Tutorial A90900-01
Oracle9i Reports Developer Building Reports A92101-01
Oracle9iAS Reports Services Publishing Reports A92102-01

Additional Publications
• System release bulletins
• Installation and user’s guides
• read.me files
• International Oracle User’s Group (IOUG) articles
• Oracle Magazine

Web Sites
• Oracle Technology Network: http://otn.oracle.com
• Oracle9i Reports Frequently Asked Questions (FAQ):
http://otn.oracle.com/products/reports/htdocs/faq9i.htm
• Oracle9i Reports whitepapers, presentations, and viewlets:
http://otn.oracle.com/products/reports/content.html
• Getting Started with Oracle9i Reports: http://otn.oracle.com/docs/products/
reports/htdocs/doc_library/getstart/GettingStarted/index/index.html

.....................................................................................................................................................
xviii Oracle9i Reports Developer: Build Reports
Typographic Conventions
.....................................................................................................................................................

Typographic Conventions
Typographic Conventions in Text
Convention Element Example
Bold italic Glossary term (if The algorithm inserts the new key.
there is a glossary)
Caps and lowercase Buttons, Click the Executable button.
check boxes, Select the Can’t Delete Card check box.
triggers,
Assign a When-Validate-Item trigger . . .
windows
Open the Master Schedule window.
Courier new, Code output, Code output: debug.seti('I',300);
case sensitive directory names, Directory: bin (DOS), $FMHOME (UNIX)
(default is filenames,
Filename: Locate the init.ora file.
lowercase) passwords,
pathnames, Password: Use tiger as your password.
URLs, Pathname: Open c:\my_docs\projects
user input, URL: Go to http://www.oracle.com
usernames User input: Enter 300
Username: Log on as scott
Initial cap Graphics labels Customer address (but Oracle Payables)
(unless the term is a
proper noun)
Italic Emphasized words Do not save changes to the database.
and phrases, For further information, see Oracle7 Server
titles of books SQL Language Reference Manual.
and courses,
Enter user_id@us.oracle.com , where
variables
user_id is the name of the user.
Quotation marks Interface elements Select “Include a reusable module
with long names component” and click Finish.
that have only This subject is covered in Unit II, Lesson 3,
initial caps; lesson “Working with Objects.”
and chapter titles in
cross-references
Uppercase SQL column Use the SELECT command to view
names, commands, information stored in the LAST_NAME
functions, schemas, column of the EMP table.
table names

.....................................................................................................................................................
Oracle9i Reports Developer: Build Reports xix
Preface
.....................................................................................................................................................

Convention Element Example


Arrow Menu paths Select File—>Save.
Brackets Key names Press [Enter].
Commas Key sequences Press and release these keys one at a time:
[Alt], [F], [D]
Plus signs Key combinations Press and hold these keys simultaneously:
[Ctrl]+[Alt]+[Del]

Typographic Conventions in Code


Convention Element Example
Caps and lowercase Oracle Forms When-Validate-Item
triggers
Lowercase Column names, SELECT last_name
table names FROM s_emp;
Passwords DROP USER scott
IDENTIFIED BY tiger;
PL/SQL objects OG_ACTIVATE_LAYER
(OG_GET_LAYER ( 'prod_pie_layer'))
Lowercase italic Syntax variables CREATE ROLE role
Uppercase SQL commands SELECT userid
and functions FROM emp;

Typographic Conventions in Navigation Paths


This course uses simplified navigation paths, such as the following example, to direct
you through Oracle Applications.
Example:

Invoice Batches Summary


(N) Invoice > Entry > Invoice Batches Summary (M) Query > Find
(B) Approve

This simplified path translates to the following:


1 (N) From the Navigator window, select Invoice > Entry > Invoice Batches
Summary.
2 (M) From the menu bar, select Query > Find.
3 (B) Click the Approve button.

N = Navigator, M = Menu, B = Button

.....................................................................................................................................................
xx Oracle9i Reports Developer: Build Reports
I
................................

Introduction
Introduction
..........................................................................................................................................................................

Course Objectives

After completing this course, you should be able to do


the following:
• Describe the capabilities of Oracle9i Reports
• Develop and maintain Web and paper reports in
different styles using Reports Builder
• Lay out and format data to meet user reporting
requirements
• Incorporate text, images, and graphics in reports

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 10 minutes
Total 10 minutes

......................................................................................................................................................
I-2 Oracle9i Reports Developer: Build Reports
Course Objectives
..........................................................................................................................................................................

Course Objectives
Course Description
This course enables you to design and build a variety of standard and custom Web
and paper reports using Oracle9i Reports Developer. You learn how to retrieve,
display, and format data from any data source in numerous reporting styles and
publish the output to any destination.
During the course, you learn how to add dynamic content to a static Web page and
publish reports to the Web. You also learn how to customize more complex reports,
embed graphical charts, and use Oracle9iAS Reports Services to deploy your
reports.

Course Objectives
After completing this course, you should be able to do the following:
• Describe the capabilities of Oracle9i Reports
• Develop reports using data from any source, in any format, and publish to any
destination
• Develop and maintain different styles of reports using Reports Builder
• Lay out and format data to suit user reporting requirements
• Incorporate text, images, and graphics in reports
• Publish a report on the Web
• Manage server resources
• Tune reports

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports I-3
Introduction
..........................................................................................................................................................................

Course Content

Day 1:
• Introducing Oracle9i Reports Developer
• Designing and running reports
• Working in Oracle9i Reports Builder
• Creating and modifying paper reports using the
Wizard
• Enhancing a paper report in the Paper Design view
Day 2:
• Managing templates
• Creating a Web report
• Enhancing report structure

Copyright © Oracle Corporation, 2002. All rights reserved.

Course Content

Day 3:
• Using the paper layout
• Modifying properties
• Using Web reporting
• Extending functionality using XML
Day 4:
• Customizing reports with parameters
• Embedding graphs
• Enhancing matrix reports
• Adding PL/SQL code

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
I-4 Oracle9i Reports Developer: Build Reports
Course Content
..........................................................................................................................................................................

Course Content
The lesson titles show the topics covered in this course and the usual sequence of
lessons. However, the daily schedule is an estimate, and may vary for each
individual class.

Day 1
Course Introduction
Introduction to Oracle9i Reports Developer
Designing and Running Reports
Working in Oracle9i Reports Developer
Creating a Paper Report
Enhancing a Basic Paper Report

Day 2
Managing Report Templates
Creating a Web Report
Enhancing Reports Using the Data Model: Queries and Groups
Enhancing Reports Using the Data Model: Data Sources
Enhancing Reports Using the Data Model: Creating Columns

Day 3
Enhancing Reports Using the Paper Layout
Controlling the Paper Layout: Common Properties
Controlling the Paper Layout: Specific Properties
Web Reporting
Extending Functionality Using XML

Day 4
Creating and Using Reports Parameters
Embedding a Graph in a Report
Enhancing Matrix Reports
Coding PL/SQL Triggers

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports I-5
Introduction
..........................................................................................................................................................................

Course Content

Day 5:
• Extending functionality using the Reports Builder
built-in package
• Using 9iAS Reports Services
• Efficiency and performance guidelines

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
I-6 Oracle9i Reports Developer: Build Reports
Course Content
..........................................................................................................................................................................

Day 5
Extending Functionlaity Using the SRW Package
Maximizing Performance Using Oracle9iAS Reports Services
Building Reports: Efficiency Guidelines

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports I-7
Introduction
..........................................................................................................................................................................

......................................................................................................................................................
I-8 Oracle9i Reports Developer: Build Reports
1
................................

Introduction to
Oracle9i Reports Developer
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Describe business intelligence
• List the benefits of enterprise reporting
• Describe the differences between Web publishing
and paper publishing
• Describe the key features of Oracle9i Reports
Developer
• Describe the architecture of Oracle9i Application
Server
• Describe Oracle9iAS Reports Services

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 30 minutes
Total 30 minutes

......................................................................................................................................................
1-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
Oracle9i Reports Developer is a powerful enterprising reporting tool that allows
developers to rapidly develop and deploy sophisticated high quality reports from any
data source, in any format, to any destination.
This lesson identifies the key features and benefits of Oracle9i Reports Developer and
its relationship with Oracle’s end-to-end business intelligence solution.

Objectives
After completing this lesson, you should be able to do the following:
• Explain Oracle’s business intelligence solution
• List the benefits of enterprise reporting
• Describe the differences between Web publishing and paper publishing
• Describe the key features of Oracle9i Reports Developer
• Describe the architecture of Oracle9i Application Server
• Describe Oracle9iAS Reports Services

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-3
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Business Intelligence
Discoverer Server Reports Server

XML

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-4 Oracle9i Reports Developer: Build Reports
What Is Business Intelligence?
.....................................................................................................................................................

What Is Business Intelligence?


Introduction
Reporting is the delivery of information to information consumers. These consumers
must often further investigate that information. Historically, different tools have
performed different tasks. There is however a growing need to integrate data
consolidation, data analysis, and enterprise reporting tools. This provides a seamless
environment that allows users to move from the role of pure information consumer to
information investigator.
The combination of providing information and enabling additional investigation of
that information is commonly referred to as business intelligence (BI).

The Oracle Business Intelligence Solution


Oracle9i offers an integrated business intelligence solution that provides the user with
a complete picture across the entire organization. The Oracle9i BI solution is designed
to easily and quickly put data into the database, find information from the database,
share this information, and exploit BI to learn more about a business and its customers.
Oracle’s set of integrated BI tools allow you to seamlessly move between the roles of
information consumer and information investigator:
• Oracle9i Warehouse Builder (OWB) is designed to consolidate disparate data
sources, performs any required data transformations, manage warehouse lifecycle,
and integrate with analysis tools.
• Oracle9iAS Discoverer, the powerful ad hoc query and analysis tool, can be
unleashed to reveal potential opportunities and risks associated with your products,
customers, and marketplace.
• Oracle9i Reports, the high-fidelity enterprise reporting tool, enables businesses to
give immediate access to information to all levels within and outside of the
organization in a scalable and secure environment. Oracle9i Reports is the solution
for Web and paper publishing, enabling you to publish any data, in any format,
anywhere. Oracle9i Reports delivers high-quality information to users with only
an Internet browser in open Internet document standards. Authentication is
handled through single sign-on, and scalability is guaranteed through Oracle9iAS
Reports Services.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-5
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Enterprise Reporting

• Provides access for more users to vital customized


information
• Lowers cost of ownership
• Uses integrated business intelligence

Any Web Data Server


Client Application
Server

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-6 Oracle9i Reports Developer: Build Reports
Enterprise Reporting
.....................................................................................................................................................

Enterprise Reporting
Evolution of Enterprise Reporting
For as long as there has been electronic data storage, there has been reporting. In the
mainframe computing era a “one-report-fits-all” metaphor was used. Reports were
expensive to develop and were typically generated in overnight batch jobs. With the
advent of the personal computer and its rich graphical user interface and fourth
generation languages, reports where easier to produce. Report developers could now
write reports tailored to the needs of particular information consumers. Most
companies however shifted from a “one-fits-all” model to a paradigm of “one-report-
fits-one”. Reports were stored on an individual PC, or at best shared across small work
groups. Enterprise reporting grew out of a business need for better, faster, and more
flexible delivery of individually tailored information to a very large number of users.
No environment is better suited to fulfill this than the Internet.

Benefits of Enterprise Reporting


Enterprise reporting offers a number of important benefits. These include:
• Widening the reach of information access
The ability to provide information electronically to a large and often
geographically distributed user base, in a timely manner, picking up live data on-
demand, means that everybody is kept informed at all times.
• Lowering the cost of computing
Costs are minimized through a centrally managed architecture. This approach
takes the labor out of the computing infrastructure, and lowers the maintenance
needs and associated costs.
• Allowing for extensible business intelligence
Reporting is the delivery of information. Delivery alone however is not enough. If,
for example, a possible trend is identified, such as a drop or rise in sales, you must
find out why and be able to move seamlessly from mere consumer to investigator.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-7
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Enterprise Reporting

Reporting

Ad hoc query

Advanced
Web Client analysis

Data Server
Application Server

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-8 Oracle9i Reports Developer: Build Reports
Enterprise Reporting
.....................................................................................................................................................

Challenges for Enterprise Reporting


Enterprise reporting provides an organization with significant benefits. In order to
obtain those benefits however, a number of challenges need to be met, including:
• High performance and scalability
Timely information delivery is essential. The powerhouse of Oracle’s reporting
architecture is Oracle9i Application Server. Oracle9iAS Reports Services, the
report publishing component of Oracle9i Application Server, provides out-of-the-
box optimized performance and scalability to run Oracle9i Reports applications in
Web and non Web environments.
• High quality reports
Enterprise reporting uses the Internet as its conduit for information delivery.
Oracle9i Reports adheres to Internet document standards and supports Hypertext
Markup Language (HTML), HTML Cascading Style Sheets (HTMLCSS),
Extensible Markup Language (XML), Rich Text Format (RTF), Postscript, and
Portable Document Format (PDF) formats. This enables you to generate and
deliver information to a browser offering a rich variety of fonts, page layouts, and
graphical widgets.
• Reduced time to market
In Internet-based environments, information consumers have a low tolerance for
delays in information delivery. The key to reducing development time is to take the
hard labor out of report development. Oracle9i Reports does not require the report
developer to write numerous lines of code or manually format complex layout
structures. The entire development environment is wizard driven and Oracle9i
Reports Developer generates the code automatically, making this an extremely
productive development environment.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-9
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Web Publishing

GIF89a

hyperlinks

JavaScript

Copyright © Oracle Corporation, 2002. All rights reserved.

Paper Publishing

8.5”

GIF89a

hyperlinks
11”

JavaScript

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-10 Oracle9i Reports Developer: Build Reports
Web Publishing and Paper Publishing
.....................................................................................................................................................

Web Publishing and Paper Publishing


Today, many people turn to the Web first to find information. However, publishing
enterprise data using a browser has not lowered the demand for high fidelity paper
publishing. HTML pages that look great in a browser often do not look professional
when printed from the browser. There are few tools today that recognize this and help
developers publish data with high fidelity to both the Web and paper.

Web Publishing
A Web page is very fluid. A Web page does not have the limitation of page size; a page
can contain as much or as little data as you wish. If there is more content than will fit
in the browser window, scroll bars are displayed to allow users to navigate through the
content. Web specific features, such as bookmarks and hyperlinks, can also aid the
user in navigation.
A Web page comes alive with rich images, color, JavaScript, and animation. Users can
interactively drill down to see details or related data. Style sheets are used to
universally control appearance.

Paper Publishing
A paper report has characteristics that include rigid geometry restrictions, headers and
footers repeated on each page, and higher resolution allowing more details to be
presented to the end user at once, giving the end user the option of printing the output
and the ability to “study” the data.
Oracle Reports has historically done a very good job of publishing high fidelity paper
reports. The tools understands the concept of a paper page. It manages geometry and
includes features to control behavior when a page break occurs.

Effective Publishing
The key to effective publishing is understanding the medium, utilizing the
functionality the medium provides, and generating visually attractive content for that
medium. For the Web, this means the ability to incorporate Java, JavaScript, and
animated Graphic Interchange Formats (GIFs). For paper, it requires the
understanding of paper layouts and complicated geometry management.
Recognizing the differences between Web publishing and paper publishing, Oracle9i
Reports Developer provides a declarative environment with the power to generate
high quality output for the Web and e-business requirements, as well as high fidelity
paper reports.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-11
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9i Reports Developer

Publish data from any source, in any format, to any


destination with high fidelity.

<TEXT>
<Your Data Source>

Copyright © Oracle Corporation, 2002. All rights reserved.

Benefits

• Publish data from any source, in any format, with


high fidelity
• Develop one time and deploy anywhere
• Open, standards-based, modular architecture

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-12 Oracle9i Reports Developer: Build Reports
Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9i Reports Developer


The Goal of Oracle9i Reports Developer
Oracle9i Reports Developer provides an enterprise-wide publishing solution that
delivers high fidelity, dynamic Web pages to corporate (intranet) and Internet users
without compromising scalability and performance. Using Oracle9i Reports, you can
publish information from any data source, in any format (PDF, HTML, printed, XML,
etc.), to any destination (Web, Portal, e-mail, file, etc.) in a scalable, efficient manner.
The goal of Oracle9i Reports is to be the universal publishing solution of choice for
any publishing need within an organization.

Benefits
• Oracle9i Reports enables you to publish data from any source in any format with
high fidelity.
In addition to SQL, PL/SQL, and Express, you can publish data from Java
Database Connectivity (JDBC) sources, XML, text files, or you own data sources
that you have defined. Report output can go anywhere you wish: the Web, e-mail,
the printer, wireless devices, and so forth.
• Develop your report once, deploy it anywhere.
– Output formats include HTML, HTMLCSS, XML, PDF, Postscript, RTF,
delimited, character, etc.
– The Web layout is optimized for HTML.
– The paper layout is designed for PDF and Postscript.
– Share a single data model among all output formats.
– Customize the appearance and content of your output at runtime by applying
XML customization files.
• Oracle9i Reports uses a standards-based, modular architecture.
– Use the Reports Java APIs to define your own plug-ins for data sources, output
destinations, security infrastructure, cache management, engines, and so on.
– Take advantage of the industry standards used in Oracle9i Reports: JavaServer
Pages (JSPs), servlets, JavaBeans, CORBA, and IIOP information protocol.
– Flexible design fits any middle-tier configuration.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-13
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9i Products

Oracle9i provides the complete solution:


• Oracle9i Database
• Oracle9i Developer Suite
• Oracle9i Application Server

Copyright © Oracle Corporation, 2002. All rights reserved.

Oracle9i Database

Oracle9i Database manages all of your data:


Relational Data

Documents

Multimedia

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-14 Oracle9i Reports Developer: Build Reports
Oracle9i Products
.....................................................................................................................................................

Oracle9i Products
Oracle9i provides the complete Internet infrastructure that makes it easy for
companies interested in e-commerce to create and deploy scalable, Web-based
applications. Oracle markets three products to help you achieve this: Oracle9i
Database, Oracle9i Developer Suite (Oracle9iDS), and Oracle9i Application Server
(Oracle9iAS).
The Oracle9i Database manages all of your structured and unstructured data, including
Word documents, Excel spreadsheets, XML, images, and more. It provides a scalable,
secure, and reliable architecture.
The Oracle9i Developer Suite offers a complete set of integrated development tools,
empowering you to easily and quickly create Internet applications for personalized
Web portals and hosted software services. Oracle9i Developer Suite combines leading
Oracle application development and business intelligence tools into a single integrated
product. Built on Internet standards such as Java and XML, Oracle9iDS provides a
complete development environment.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-15
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9iDS Application Development

Copyright © Oracle Corporation, 2002. All rights reserved.

Oracle9iDS Business Intelligence

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-16 Oracle9i Reports Developer: Build Reports
Oracle9i Products
.....................................................................................................................................................

Oracle9i Developer Suite


The components of Oracle9iDS include Oracle9i Designer, Oracle9i Forms
Developer, Oracle9i JDeveloper, Oracle9i Software Configuration Manager, Oracle9i
Clickstream Intelligence Builder, Oracle9i Discoverer Administrator, Oracle9i
Discoverer Desktop, Oracle9i Reports Developer, and Oracle9i Warehouse Builder.

Oracle9iDS Application Development


• Modeling: Oracle9i Designer provides visual modeling, reverse engineering, and
code generation tools by utilizing visual tools for activity and class modeling with
the JDeveloper component.
• Rapid Application Development (RAD): RAD capabilities in Oracle9iDS
feature integrated builders, reentrant wizards, live previewers, and property
inspectors. The JDeveloper component supports additional RAD functionality
through Business Components for Java (BC4J), a built-in Java 2 Platform
Enterprise Edition (J2EE) framework.
• J2EE and Web Services: Oracle9iDS supports the latest J2EE application
programming interfaces (APIs) including Enterprise Java Beans (EJB), JavaServer
Pages (JSP), and servlets. Web services support Simple Object Access Protocol
(SOAP), Web Service Definition Language (WSDL), and Universal Description,
Discovery, and Integration (UDDI).
• Team Support: Oracle9i Software Configuration Management provides
versioning, dependency management, and impact analysis for all objects and file
types.

Oracle9iDS Business Intelligence


• Extract, Transform, and Load: Oracle9i Warehouse Builder provides a graphical
interface for mapping and transformation. It also provides an extensible
framework for integrating a diverse set of data sources with BI tools.
• End User Query and Analysis: With Oracle9i Discoverer Administrator, you can
create and maintain a business-oriented view of the data that supports the
Discoverer client tools: Discoverer Plus and Discoverer View, both components of
Oracle9iAS, and Discoverer Desktop, a component of Oracle9iDS.
• Enterprise Reporting: Oracle9i Reports Developer enables you to access any
data, publish it in any format, and send it to any destination.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-17
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9i Application Server

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-18 Oracle9i Reports Developer: Build Reports
Oracle9i Products
.....................................................................................................................................................

Oracle9i Application Server


Oracle9i Application Server (Oracle9iAS) is a comprehensive and integrated
application server that runs any Web site, portal, or Internet application. Oracle9iAS
consists of a set of services and utilities that can be used to implement applications in a
distributed environment for scalability and reliability. These are:
• Communication Services: These services handle incoming requests received by
Oracle9iAS. Some of these requests are processed by the Oracle HTTP Server and
some requests are routed to other areas of Oracle9iAS for processing.
• Presentation Services: The presentation services of Oracle9iAS generally output
some kind of graphical representation, often in the form of HTML. Oracle9iAS
supports a variety of ways to generate presentation presentations that can be
delivered to the client ranging from low level programming using Perl scripts and
Java servlets, to high level frameworks using Oracle portal services.
• Business Logic Services: Oracle9iAS provides several ways to develop business
logic, utilizing both Java development approaches and high level, model-driven
techniques. These approaches include Java 2 Platform Enterprise Edition (J2EE),
Enterprise JavaBeans (EJB), and Oracle Business Components for Java (BC4J), as
well as rich GUI oriented approaches such as Oracle9i Forms Developer and
Oracle9i Reports Developer.
• Data Management Services: To reduce the load on the database instance and to
avoid network roundtrips for read-only data, Oracle9i Application Server includes
Oracle9i Cache.
• System Services: To provide system management and security services,
Oracle9iAS includes Oracle Enterprise Manager and Oracle Advanced Security.
These system services provide a comprehensive management framework for your
entire Oracle environment and network security using Secure Sockets Layer
(SSL)-based encryption and authentication facilities.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-19
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Features of Reports Developer

• User-friendly wizards
• Pluggable data sources
• Customizable report templates
• WYSIWYG live editor for paper reports
• Dynamic Web publishing using JSP/HTML
• Run-time customization
• Dynamic SQL execution
• Portal integration
• Event-based reporting

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-20 Oracle9i Reports Developer: Build Reports
What Is Oracle9i Reports Developer?
.....................................................................................................................................................

What Is Oracle9i Reports Developer?


Oracle9i Reports Developer is a component of the Oracle9i Developer Suite. Oracle9i
Reports Developer is a collection of programs that allows you to centralize report
processing and better manage reporting efforts. Reports Builder is one of the program
components included with Oracle9i Reports Developer. Features include:
• Wizards that guide you through the report design process
• The ability to access data from any data source
• A query builder with a graphical representation of the SQL statement to obtain
report data
• Default report templates and layout styles that can be customized if needed
• A live editor that allows you to modify paper report layouts in WYSIWYG (“what
you see is what you get”) mode
• The ability to add dynamic report output to an HTML page by embedding custom
JavaServer Page (JSP) tags within an HTML document
• An integrated chart builder to graphically represent report data
• The ability to generate code to customize how reports will run
• Web publishing tools that dynamically generate Web pages based on your data
• Standard report output formats such as HTML, HTMLCSS, XML, PDF, PCL
(Printer Control Language), Postscript, and ASCII
• The ability to apply run-time customization
• The ability to execute dynamic SQL statements within PL/SQL procedures
• Support for Oracle objects
• Seamless integration of Oracle9i Reports with Oracle9iAS Portal for
administering report security
• The ability to publish report output to portlets
• Report execution based on database events

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-21
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9iAS Reports Services

• Flexible reporting
• Reduced overhead
• Fast distribution
• Real time publishing

Copyright © Oracle Corporation, 2002. All rights reserved.

Oracle9iAS Reports Services Architecture

HTTP

Oracle HTTP Listener


mod_OC4J
JSP Engine
Oracle Internet Directory
CORBA/IIOP CORBA/IIOP
Reports
Oracle9iAS
Engine
Reports Services
PDS

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The Reports CGI component is maintained only for backward compatibility.

......................................................................................................................................................
1-22 Oracle9i Reports Developer: Build Reports
What Is Oracle9i Reports Developer?
.....................................................................................................................................................

Oracle9iAS Reports Services


Oracle9iAS Reports Services, a component of Oracle9iAS, provides the deployment
environment for Oracle9i Reports Developer applications. Oracle9iAS Reports
Services executes, distributes, and publishes your reports for enterprise wide
reporting. Using Oracle9iAS Reports Services to deploy your reports results in gains
of flexibility, time savings, and processing capacity.
Users can schedule, batch, queue, view, and reuse reports according to their needs.
This flexibility improves the delivery of mission critical information and enhances
workflow. An advanced reports cache prevents needless rerunning of common reports
and reduced overhead on resources.
Oracle9iAS Reports Services integrates into standard Web environments with
JavaServer Pages (JSPs), Java servlets, and Common Gateway Interface (CGI,
maintained only for backward compatibility) and provides powerful distribution and
publishing capabilities that broaden access and improve the usefulness of information.
Users can distribute a report using the Web, a printer, and e-mail, or split a report into
multiple sections and send each section to a different destination.

Oracle9iAS Reports Services Architecture


In a Web environment, Oracle9iAS Reports Services can consist of four tiers:
• the client tier (a Web browser)
• the Web server tier
• the Oracle9iAS Reports Services tier
• the data tier (databases and pluggable data sources)
The major components of Oracle9iAS Reports Services include:
• Oracle9iAS HTTP Server: This is the Web server. It incorporates an OpenSSL
module to provide support for Secure Socket Layers (SSL) and HTTP Secure
Sockets Layer (HTTPS). It also provides a servlet engine to support the running of
Java servlet applications.
• Reports Servlet and JSP: These components process custom (JSP) report tags
and deliver information between the HTTP Server and the Reports Server.
• Reports Server: The Reports Server processes client requests, including user
authentication, scheduling, caching, and report distribution.
• Reports Engine: The Reports Engine fetches data from the data source, formats
the report, send output to cache, and notifies the Reports Server that the job is
ready.
• Reports Cache: The Reports Cache stores completed jobs.
Note: Oracle9iAS Reports Services and report deployment will be covered in more
detail in a later lesson.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-23
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Describe integrated business intelligence
• List the benefits of enterprise reporting
• Describe the challenges of publishing for different
media
• List the Oracle9i products
• List the key features and benefits of Oracle9i
Reports Developer
• Describe Oracle9iAS Reports Services

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
1-24 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
• A business intelligence solution provides a set of integrated tools that enable you
to move seamlessly between the roles of information consumer and information
investigator.
• Enterprise reporting grew out of a business need for better, faster, and more
flexible delivery of individually tailored information to a very large number of
users. The conduit of choice is the Internet.
• Effective publishing requires an understanding of the features and limitations of
the different medium. Reports need to be designed for the specific output medium.
Web publishing and paper publishing differ.
• Oracle9i Reports Developer enables you to create and deploy reports using any
data, in any format, for any medium.
• The Oracle9i products provide the infrastructure to easily develop, deploy, and
manage Internet applications and Web sites. Oracle9i Reports Developer is a
component of the Oracle9i Developer Suite. Reports created with Oracle9i Reports
are deployed by Oracle9i Application Server, specifically Oracle9iAS Reports
Services.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 1-25
Lesson 1: Introduction to Oracle9i Reports Developer
.....................................................................................................................................................

......................................................................................................................................................
1-26 Oracle9i Reports Developer: Build Reports
2
................................

Designing and Running


Reports
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Identify user requirements
• Name the common report styles
• Describe the structure of each style
• Run prebuilt reports as an end user
• Identify supported report file types

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 20 minutes
Practice 20 minutes
Total 40 minutes

......................................................................................................................................................
2-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
Your reports need to satisfy the requirements of your business. To help you begin the
process of translating report requirements into Reports Developer solutions, you need
to understand the users’ needs, the potential range of report styles, the distribution and
output requirements, and gain an appreciation of the underlying report structure. This
helps you to make the right decision about which style to use for the report.
This lesson discusses understanding the user requirements, standard report design
styles, and describes options to execute reports.

Objectives
After completing this lesson, you should be able to do the following:
• Explain the development process
• Recognize user needs
• Name the common report styles required in a business report
• Describe the structure of common report styles
• Run prebuilt reports

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-3
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

User Requirements

What data Web features


Parameters Security

Web or Charts
Paper Drill down

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-4 Oracle9i Reports Developer: Build Reports
Designing Reports
.....................................................................................................................................................

Designing Reports
Understanding the User Requirements
In the first stage of the development, you determine what the user needs and expects.
While it may be tempting to skip this stage and start building right away, it is not a
good idea to do so. Without a clear understanding of the users and their reporting
needs, it is virtually impossible to create effective enterprise reports.
To define user requirements:
• Gather relevant policies, business rules, and existing documentation
• Observe users and their daily job activities
• Interview a wide variety of users
Helpful questions to help you determine the user requirements:
• What data will people want, and in what priority?
• How is the data stored?
• Is there a corporate standard that must be met? If so, define standard templates.
• Will users want Web reports, paper reports, or both?
• For Web reports, will the reports be static or dynamic?
• Will users want charts in the report? If so, what data will be used in the graph?
• Will users want to drill down on data? If so, plan on using hyperlinks.
• Will users want to specify input parameters? If so, you need to create the necessary
parameters and establish the validation rules.
• Will users want a report to be embedded in a form? If so, you will have to call the
report from a form and have the form pass the data to the report.
• Will the same report serve different types of users? If so, you need to think about
report sectioning and report distribution.
• Are there any administration or security issues? If so, you need to set up the
necessary specifications in the Oracle9iAS Portal Reports Security option.
• Will the users want run-time customizations? If so, plan on using XML files.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-5
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Designing Reports

Before you start development, consider:

Specification
Data retrieval
Common features
Structure

Style

Publishing
Medium

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Assure the students that the publishing medium will be addressed in a later lesson.
This is a high-level description to introduce students to the concept of the group
structure:
• Tabular: One group
• Master-detail: Master-detail hierarchy (may be several levels)
• Master and multiple details: Two or more detail groups at the same level
• Matrix: Two masters, one detail
The Form, Form Letter, and Mailing Label styles are not discussed at this stage,
because these are all variations of a single-group report.

......................................................................................................................................................
2-6 Oracle9i Reports Developer: Build Reports
Designing Reports
.....................................................................................................................................................

Selecting the Report Style


Before you create a report using any report-writing software, you must first consider
the type of report that you are being asked to produce. You will have a specification of
the needs, required output, and the expected publishing medium, but you also need to
know the underlying structure that supports the requirement and the most efficient way
to retrieve data.
Also, consider whether this is a one-time requirement, or whether this specification
shares common features with other reports, especially where multiple reports are
required in the same application.
There are a few standard styles of reports that form the majority of all reporting
requirements. This section teaches you to recognize the common styles in order to
enable you to interpret your report requirements and choose the correct style when
developing report definitions.

The Common Report Styles


The majority of report requirements fall into the following categories:
• Tabular
• Master-detail
• Master and multiple details
• Matrix

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-7
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Tabular
List of Products

Product
Number Description Price

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-8 Oracle9i Reports Developer: Build Reports
Design Considerations
.....................................................................................................................................................

Design Considerations
Introduction
Define the report structure by identifying the number of times each piece of data is
printed. Separate the data into groups based on this frequency. You may also need to
identify any relationships that exist between groups, so that you can create a hierarchy
in the internal report structure.
This section describes the four main styles of reports and the group structure for each.

Tabular Report Style


In the List of Products report displayed opposite, all fields for each product number,
product description, and price are printed with the same frequency. They each repeat a
value for every product record.
This report structure contains a single group.
In tabular reports, the headings or labels appear once above each field.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-9
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Master-Detail
Outstanding Customer Items

Customer Name
Product
Number Price

Customer Name
Product
Number Price

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-10 Oracle9i Reports Developer: Build Reports
Design Considerations
.....................................................................................................................................................

Master-Detail Report Style


The Outstanding Customer Items report displays one customer name, followed by
several records containing the products and prices of items ordered but not yet
received. This structure is repeated for every customer who has unfulfilled orders. The
customer name does not repeat for every outstanding product; the frequency is
different.
This report structure contains two groups.
Each list of products is directly related to the preceding customer name, which means
that there is a master-detail hierarchy. Customer information is in one group, called the
master, and the product information is in a second group, called the detail.
In this Master-Detail report, the headings or labels appear as follows:
Group Label Placement
Master Labels appear to the left of fields.
Detail Labels appear above fields (as for a tabular report).

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-11
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Master with Two Details


Customer Statistics

Customer

Outstanding Orders in Last


Items Six Months
Product Order Total
Number Price No. Date Value

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-12 Oracle9i Reports Developer: Build Reports
Design Considerations
.....................................................................................................................................................

Master with Two Details Report Style


More than one group may appear at the same level in a hierarchy.
Consider the Customer Statistics report. This report has the same information as the
Outstanding Customer Items report, with the addition of another group displaying
orders placed in the last six months.
Both groups, Outstanding Items and Orders in Last Six Months, relate to each
customer, but not directly to each other.
This report has three groups, one master and two detail groups. The two detail groups
are related to the master at the same lower level.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-13
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Matrix
Customer Matrix

Product ID
Customer

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Another way of describing a matrix report is one which has two masters (parents) and
one detail (child). The detail data displays where the two masters intersect.

......................................................................................................................................................
2-14 Oracle9i Reports Developer: Build Reports
Design Considerations
.....................................................................................................................................................

Matrix Report Style


The Customer Matrix report displays a group of master customer records down the
page, a group of master product records across the page, and a group of detail
summary calculations.
The detail group is related to both of the master groups.
In this report structure, the master groups are on the same level, with the detail group
below.
This is an example of a simple matrix. Later you will see that matrix reports can have
multiple levels of nesting.

Two Masters
The matrix style is the only style in which a detail group is related to two different
master groups at the same level.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-15
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Retrieving and Sharing Data

• Keep database access to a minimum


• Consider report structure and number of queries
• Make effective use of common code and objects

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-16 Oracle9i Reports Developer: Build Reports
Retrieving and Sharing Data
.....................................................................................................................................................

Retrieving and Sharing Data


Introduction
One of the primary considerations of any report is to ensure that it runs efficiently. The
following points provide guidance for future reference.

SQL and Database Access


In Oracle9i Reports, data for your report can come from any data source. This section
provides considerations for data stored in relational databases.
For data that is retrieved from a database, you use SQL SELECT statements. Aim to
keep database access to a minimum. The fewer queries your report contains, the faster
it retrieves data.
With hierarchical reports that contain more than one group, you can either use one
query and create additional groups, or use many queries and manually link the groups.
The one-query approach is usually preferable.

Report Structures
The report style also affects the number of queries required. A master with multiple
detail groups requires an additional query for each extra “sibling” group. Matrix
reports can contain one or several queries.
The following table shows the number of queries you can use to create the reports in
this lesson.
Report Name Number of Queries
List of Products 1
Outstanding Customer Items 1 or 2
Customer Statistics 2 or 3
Customer Matrix 1, 2, or 3

Using Common Code


In Oracle9i Reports, you can create queries, PL/SQL libraries, and stored program
units that are accessible to more than one report. Consider which code is common and
ensure that all developers have access to it.

Using Common Objects


Many reports have a standard layout for features such as company logo image, font
size, and style. Paper reports often have a standard page size and margin widths. For
paper reports, consider creating one template containing these common features that
can be the basis of all reports. You can also enhance individual reports with specific
changes. For Web reports, consider using an HTML template for your reports. Good
template design standardizes the appearance of your reports and helps to ensure that,
as a developer, you maintain documented standards.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-17
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Running a Report

• Your browser
• Oracle9iAS Portal application
• Command line (Start > Run)
• Oracle9iAS Reports Queue Manager
• Menu integrated with a Forms application
• Button in a Forms application

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Run a few of the pre-built reports in your directory using Reports Builder as this is the
methos the students will use in the practice.
• Run the Web layout for p2q4.jsp.
• Run the paper layout for p2q3.rdf.
• Run the paper layout for p2q6.rdf. This is a report with parameters. Valid
customer IDs include 145, 146, and 147.
• Double-click \demo\ShippingManifest.pdf. This report includes a barcode Java
bean.
• If you can access the Oracle9i Reports hosted demos Web site, show the students
one or two reports. This site contains links that allow you to run reports through
the Oracle9iAS Reports Services, look at source code, download demo scripts and
documentation, and so forth.

......................................................................................................................................................
2-18 Oracle9i Reports Developer: Build Reports
Running a Report
.....................................................................................................................................................

Running a Report
Invoking a Report
There can be many ways of running a report, depending on the application design. You
can call a report from:
• A Web browser
• An Oracle9iAS Portal application
• The command line, using the Start > Run option in Windows NT
• The Oracle9iAS Reports Queue Manager
• A Java application
• A database trigger
• A customized menu in a Forms application
• A button in a Forms application

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-19
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Previewing Reports

Copyright © Oracle Corporation, 2002. All rights reserved.

Print Preview
1 2 3

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Print, Page Setup, and Mail 3 Go to specific page number


options
2 Page options: First, Previous,
Next, Last

......................................................................................................................................................
2-20 Oracle9i Reports Developer: Build Reports
Previewing Reports
.....................................................................................................................................................

Previewing Reports
Introduction
In Reports Builder, there are a number of ways in which you can preview your report.

Run Web Layout


Reports Builder provides the option of previewing your Web report in a browser.
Select Program > Run Web Layout from the menu, or click the Run Web Layout
inconic button on the horizontal toolbar.

Run Paper Layout


To preview your paper report, select Program > Run Paper Layout from the menu, or
click the Run Paper Layout iconic button on the horizontal toolbar. Your output
displays in the Report Editor, which you will learn more about later in this course.

Print Preview
Select File > Print Preview to display your formatted paper report. Your output
displays in the Previewer window.

Navigating Through the Previewer Window


You can navigate through the Previewer using the scrollbars and the iconic buttons in
the toolbar at the top of the Previewer window. The toolbar includes buttons to
perform the following actions:
Button Description
First Page Go to first page
Previous Page Go to previous page
Next Page Go to next page
Last Page Go to last page
Page Go to the page number that you enter in the field
Print Print the report
Mail Send report to a SMTP-compliant mail system

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-21
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Print Preview
1 2 3

Copyright © Oracle Corporation, 2002. All rights reserved.

1 New Previewer, Close 3 Choose this rectangle to split


Previewer options Previewer horizontally
2 Zoom in, zoom out tools 4 Choose this rectangle to split
Previewer vertically

Instructor Note
Demonstration: p5q3.rdf
Select File > Print Preview and demonstrate these features, especially how to split the
screen. This feature is not obvious to students.

......................................................................................................................................................
2-22 Oracle9i Reports Developer: Build Reports
Previewing Reports
.....................................................................................................................................................

Viewing Multiple Pages


To view the contents of more than one page at the same time, click New Previewer to
open another Previewer window. The window menu item shows the number of
Previewer windows open at any time. Close each Previewer window individually.

Viewing Large Pages


When viewing large report pages, you can split the Previewer window either
horizontally or vertically to show the extreme left and right or top and bottom portions
of a page.
• Horizontal split: Click and drag the gray rectangle above the vertical scrollbar.
• Vertical split: Click and drag the gray rectangle to the left of the horizontal
scrollbar.
Release the mouse button at the position at which you want to split the viewing region.

Magnifying and Reducing the Report View


Zoom in and zoom out buttons are available on the toolbar. Select the large plus sign to
zoom in and the small minus sign to zoom out.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-23
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Supported File Types

• RDF
• REP
• JSP
• HTML
• XML

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-24 Oracle9i Reports Developer: Build Reports
Previewing Reports
.....................................................................................................................................................

Supported File Types


As you will learn in later lessons, report definitions created with Oracle9i Reports can
be saved in a variety of formats and then deployed with Oracle9iAS..
File Type Description
RDF Report Definition File: binary file
containing source code
REP Report: binary file without source code
JSP JavaServer Page format
HTML HyperText Markup Language
XML Extensible Markup Language

Reports defintions RDF and REP are “owned” by Oracle9i Reports. In other words,
you will need to use Oracle9i Reports to modify the definiton of these reports. Report
defintions JSP, HTML, and XML are saved and can be retrieved in a textual format.
This gives you the flexibility to use third party text editors and HTML tools to modify
the module definition.

Technical Note
Another file type REX is supported in Oracle9i Reports for backward compatibility. A
REX file contains a report definition in stored in text (e.g., ASCII or EBCDIC) format.
A REX file is not executable and cannot be directly modified in Reports Builder. You
can convert a .rex file to a .rdf by selecting Tools > File Conversion from the
menu.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-25
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Identify key questions to help understand user
requirements
• List the simple report styles and describe their
underlying structures
• Identify key design considerations:
– Report style
– Database access
– Common code
– Common objects
• List the various options for running a report

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-26 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Designing Reports
Make sure you fully understand and document the user requirements, and then pick a
report style and structure that maps to the need.
By discussing the report styles and structures, you should now be able to:
• Appreciate the principle of groups and frequencies of data
• Describe simple report styles and their underlying structures
• Realize the importance of database access and report performance, and consider
this for every report you design
• Consider usage of common code and objects at the very early stages of
development

Executing Reports
You have learned that there are a number of different ways to run a report, including a
Web browser, an Oracle9iAS Portal application, and the command line. You can
preview a report in Reports Builder using the Run Web Layout, Run Paper Layout, and
Print Preview options.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-27
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Practice 2 Overview

Executing existing reports

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
2-28 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 2
.....................................................................................................................................................

Practice Session Overview: Lesson 2


This practice session contains:
• Previewing a report in a browser
• Executing a number of different reports. For each report, answer some questions

Introduction
This practice session consists of a combination of practical and paper-based questions

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-29
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

Practice Session: Lesson 2


1 Invoke the Reports Builder executable.
2 Open the report called p2q2.jsp. Run the Web layout.
a Examine the report in your browser. Among the styles discussed in this lesson
as a reference, what style of report is it?
b How many groups of data are there in this report?
c In the browser, use the scroll bars to move up and down the report to see all of
the data.
d Close the browser window. You are now back in Reports Builder.
3 Open report p2q3.rdf and run the paper layout.
a In the Paper Design view, move to the next page. Notice that this report has a
header page with text.
b What style of report is this?
c Close the Paper Design view. From the File menu, select Print > Preview. In
the Previewer window, experiment with the horizontal and vertical split screen
features.
d Close the Previewer window.
4 Open report p2q4.jsp and run the Web layout.
a What style of report is this?
b How many groups of data are in this report?
c How many pages are there in this report?
d Close the browser.
5 Open report p2q5.jsp and run the Web layout.
a What style of report is this?
b How many groups of data are in this report?
c Close the browser window.
6 Open report p2q6.rdf and run the paper layout.
a Notice the Parameter Form. You are requested to enter a customer ID. The
report will display order information based on your input.
b Specify a valid customer ID and run the report. Valid values include 101, 118,
148 and 170; pick one of these and then select Run Report.
c What do you think would be a better method of providing valid values to a
user?
d Close the Paper Design view.

......................................................................................................................................................
2-30 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 2
.....................................................................................................................................................

Run the paper layout again. This time do not specify a customer ID.
e
i What is the result?
ii In a production situation, what should happen in this instance?
f Close the Paper Design view.
g Run the paper layout again. This time enter Customer ID 999.
i What is the result?
ii In a production situation, what should happen in this instance?
h Close the Paper Design view.
7 Open report p2q7.rdf and run the paper layout.
a In the Parameter Form, notice the list of values for the customer information.
The report displays order information based on your input.
b Select a valid customer name and run the report.
c Close the Paper Design view.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 2-31
Lesson 2: Designing and Running Reports
.....................................................................................................................................................

......................................................................................................................................................
2-32 Oracle9i Reports Developer: Build Reports
3
................................

Working in Oracle9i
Reports Developer
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Describe the main Oracle9i Reports executables
• Describe the main components of Reports Builder
• Describe the main objects in a report

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 30 minutes
Practice 15 minutes
Total 45 minutes

......................................................................................................................................................
3-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
This lesson describes the Oracle9i Reports executables and gives an overview of
Reports Builder, including a high-level description of its components and object
hierarchy.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the main Oracle9i Reports executables
• Describe the main components of Reports Builder
• Describe the main objects in a report

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-3
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Executables

Developer
Reports Builder Reports Runtime Reports Converter
rwbuilder rwrun rwconverter

Reports Services

Reports Server Reports Client Queue Manager


rwserver rwclient rwrqm

Reports Servlet Reports CGI


rwservlet rwcgi

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-4 Oracle9i Reports Developer: Build Reports
Reports Developer Executables
.....................................................................................................................................................

Reports Developer Executables


Introduction
Reports Developer executable filenames are lower case.
In Windows NT, all Oracle9i Reports executables follow a similar pattern:
rw<?>.exe.
In UNIX, the executables follow a pattern of rw<?>.

What are the Main Reports Developer Executables?


NT Filename Executable Description
Title
rwbuilder Reports Builder Create, develop, and maintain report
definitions.
rwrun Reports Runtime Run-time environment for testing.
rwconverter Reports Converter Converts a report definition to alternate
storage formats.
rwserver Reports Server Install/invoke a Reports server.
rwclient Reports Client Parses and transfers a command line to the
specified (or default) Reports Server.
rwrqm Reports Queue View/schedule reports on a remote server.
Manager
rwservlet Reports Servlet Runs a report as a servlet, translating and
delivering information between HTTP and
the Reports Server.
rwcgi Reports CGI Provides a connection between a Web server
and Reports Services, enabling you to run
reports dynamically from your browser.
Reports CGI is maintained only for
backward compatibility.

Technical Note
A servlet is a Java application that runs in a Web server or application server and
provides server-side processing, typically to access a database or perform e-commerce
processing. Servlets provide an alternative to CGI (Common Gateway Interface)
scripts. Because they are written in Java, servlets are portable between servers and
operating systems. Servlets are also more efficient than CGI scripts as they can remain
running inside the servlet engine of the Web listener, waiting for new requests, instead
of being shut down once a request is processed, and then restarted when a new request
is issued.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-5
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Invoking Reports Builder

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
If you invoke Reports Builder at this stage, do not choose the Wizard, but select the
option “Open an existing report” and then select a simple report to demonstrate the
components and objects in the builder.

......................................................................................................................................................
3-6 Oracle9i Reports Developer: Build Reports
Reports Developer Executables
.....................................................................................................................................................

Invoking Reports Builder


In the previous lesson, you used the run-time executables, rwrun and rwservlet,
to run some reports. Now you invoke Reports Builder, the rwbuilder executable,
and look at the definitions of some reports to describe the components and objects in
the builder.

The Welcome Dialog Box


When you invoke Reports Builder, the initial Welcome dialog box contains a check
box “Display at startup” that you can clear if you want to suppress this dialog box.
If you clear this option, and then later want to see the Welcome dialog box, you must
change the relevant option in the Preferences dialog box.

How to Display the Welcome Dialog Box


1 Select Edit > Preferences.
2 Select the Wizards tab.
3 Select the Welcome Dialog check box.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-7
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Modules

Report Template PL/SQL Library

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Briefly explain the different module types, but point out that the rest of this lesson
discusses the report definition. The other two objects are discussed later in the course.

......................................................................................................................................................
3-8 Oracle9i Reports Developer: Build Reports
Reports Builder
.....................................................................................................................................................

Reports Builder
Introduction
The Reports Builder interface enables you to create a number of different types of
modules, and it provides a Report Editor in which you can view the structure and
objects in a report module.
This section gives an overview of the module types.

Types of Reports Builder Modules


Module Description
Type
Report A report definition
Template A skeleton definition containing common style and standards; can include
graphics; provides a standard format to enable quick and easy development
of professional standard look-and-feel reports
PL/SQL A stand-alone library containing PL/SQL program units—procedures,
Library functions, packages—that can be called from multiple reports

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-9
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Data and Layout

Paper

Web

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-10 Oracle9i Reports Developer: Build Reports
Reports Builder
.....................................................................................................................................................

Report Data and Layout


A report definition defines two main parts of a report and brings them together in the
output.
• Data: Data structure and data to be displayed
• Layout: Formatting information about how the data appears in the output
Each report module can have a data model, a paper layout, and a Web layout. The data
model, as well as program units, can be shared by the paper and Web layouts.
A report can consist of:
• a data model and a paper layout.
• a data model and a Web layout.
• a data model, a paper layout, and a Web layout.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-11
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Reports Builder Components

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Briefly introduce the main components of Reports Builder. They will be discussed in
more detail later in the lesson.

......................................................................................................................................................
3-12 Oracle9i Reports Developer: Build Reports
Reports Builder Components
.....................................................................................................................................................

Reports Builder Components


Object Navigator
The Object Navigator is a hierarchical browsing and editing interface that enables you
to locate and manipulate application objects quickly and easily. Features include:
• A hierarchy represented by indentation and expandable nodes (Top-level nodes
show module types, database objects, and built-in packages.)
• A find field and icons, enabling forward and backward searches for any level of
node or for an individual item in a node
• Icons in the horizontal toolbar replicating common File menu functions

Report Editor
The Report Editor contains different views to help you handle the data objects and
layout objects for Web and paper reports. These views will be introduced later in this
lesson.

Property Inspector
All objects in a module, including the module itself, have properties that you can see
and modify in the Property Inspector. Features include:
• Inherit and localize properties from another object
• A Find field and icons, similar to the Object Navigator

PL/SQL Editor
The PL/SQL Editor enables you to create and compile program units such as
procedures, functions, and packages within the current report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-13
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Main Menu Structure

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-14 Oracle9i Reports Developer: Build Reports
Navigating Around the Oracle9i Reports Main Menu
.....................................................................................................................................................

Navigating Around the Oracle9i Reports Main Menu


Introduction
The main menu contains options to enable you to create, modify, and manage your
Reports Builder modules.

Common Menu Features


The following table describes some common features in GUI menus.
Feature Description
Underline Shortcut key: [Alt]+letter
Ellipsis (...) Additional input, usually by dialog box
> Menu option has a submenu
Windows menu List of open windows; choose any window to make it active
Help List of Help facilities, such as online Help text and Quick Tour

The Builder Main Menu


Menu Description
Item
File Common file utilities, such as open, save, connect, administration
Edit Cut, copy, paste, other editing functions; session preferences
View Switch view in current window; options vary greatly depending on context
Insert Add dynamic data to a static HTML page; add fields and layout objects to
paper reports
Format Change the style and appearance of objects in the Paper Layout view
Layout Arrange and reshape objects in the Paper Layout view
Program Includes compilation, run options for Web and paper, and the Java Importer
Tools Includes wizards and access to PL/SQL editors

Note: Some menu items are selectable depending on the current context. For example,
the items in the Layout menu are selectable only when the context is the Paper Layout
view.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-15
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Wizards

• Report Wizard
• Data Wizard
• Graph Wizard
• Report Block Wizard

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-16 Oracle9i Reports Developer: Build Reports
Navigating Around the Oracle9i Reports Main Menu
.....................................................................................................................................................

Wizards in Reports Builder


Wizards provide an easy step-by-step interface for commonly performed tasks. The
wizards in Reports Builder are:
• Report Wizard: The Report Wizard guides you through the steps to create a basic
paper report. Each page of the wizard asks you for information to help you create
your initial report.
• Data Wizard: This wizard helps you quickly define or modify a query for a
multiquery data models.
• Graph Wizard: You can add a variety of charts and graphs, including true 3-
dimensional graphs, to a report using the Graph Wizard. Charting is implemented
in Reports Builder with the Oracle BI graph bean.
• Report Block Wizard: This wizard enables you to quickly create a JSP report by
embedding report data into a Web page using Reports custom JSP tags.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-17
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Report Editor

• Data Model
• Web Source
• Paper Layout
• Paper Design
• Paper Parameter Form

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-18 Oracle9i Reports Developer: Build Reports
Navigating Around the Oracle9i Reports Main Menu
.....................................................................................................................................................

The Report Editor


The Report Editor contains views to handle the data objects and layout objects
separately:
View Description
Web Source Displays the HTML / JSP source for a report. You can use this view
to add dynamic content to a Web page using the Report Block
Wizard and the Graph Wizard. You can also edit the Web source
directly in this view.
Paper Design Displays output for paper reports and allows you to make many
commonly required, simple modifications to the layout, such as
spacing, formatting fields, color, and editing text, without having to
open the Paper Layout view.
Paper Layout Displays the layout objects in a paper report and allows you to make
many modifications to any layout object. All layout objects have
properties that you can modify using the Property Inspector.
The hierarchy of the layout objects is determined by the Data Model.
Data Model Displays a structural representation of the data in a report. The
objects do not appear in the report output, but the structure
determines the layout style, and the data objects provide the values
that appear in the layout objects.
Paper Parameter Displays the layout of the Paper Parameter Form that, at run time,
Form allows user input of parameter values.

You can create many fully functional paper reports simply by using the Wizard and
modifying the report in the Paper Design view. However, this course also teaches you
in later lessons how to use the Data Model, Paper Layout, and Paper Parameter Form
so that you can create more complex paper reports. You will also learn how to use the
Web Source view to add dynamic content to HTML pages to create reports for Web
publishing.

Technical Note
Oracle9i Reports has been integrated with Oracle9i JDeveloper to enable Java
developers to leverage the powerful publishing capabilities of Oracle9i Reports within
their Java applications. You can create a new JSP-based Web report or a Pluggable
Destination from within Oracle9i JDeveloper. You can also debug a Reports JSP from
within JDeveloper. For more information, see the Oracle Technology Network (http://
otn.oracle.com).

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-19
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

PL/SQL Development Environment:


Syntax Palette

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-20 Oracle9i Reports Developer: Build Reports
Navigating Around the Oracle9i Reports Main Menu
.....................................................................................................................................................

PL/SQL Development Environment


The PL/SQL development environment is the integrated functionality of Procedure
Builder with Reports Builder. It provides:
• Development of server-side database triggers and stored procedures, functions,
and packages
• Development of libraries to hold PL/SQL program units
• Statement-level debugging of PL/SQL at run time

Syntax Palette
The Syntax Palette is a programming tool that enables you to display and copy the
constructs of PL/SQL language elements and built-in packages into the PL/SQL
editor.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-21
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Object Navigator

Copyright © Oracle Corporation, 2002. All rights reserved.

Report-Level Objects

• Properties
• Triggers
• PL/SQL Program Units
• Attached Libraries

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-22 Oracle9i Reports Developer: Build Reports
Object Categories
.....................................................................................................................................................

Object Categories
Introduction
The Report Module consists of many objects that fall into the following four
categories:
• Report level
• Data Model
• Paper Layout
• Paper Parameter Form
The hierarchy of object categories can be viewed in the Object Navigator.
This section gives an overview of the objects in each category.
Note: All the objects mentioned in this section are discussed in greater detail in later
lessons.

Report-Level Objects
The report objects define the measurements, dimensions, triggers, and PL/SQL
program units of a report. The report object itself consists of the following:
Object Description
Properties Define page dimensions and Previewer settings, for example
Triggers Allow PL/SQL to be executed at different stages of the report
execution
PL/SQL Program Contain functions and procedures that can be called from
Units report-level objects in the same report
Attached Libraries External PL/SQL library file that contains sets of PL/SQL program
units that are independent of a report definition

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-23
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Data Model Objects

• Parameters
• Queries
• Groups
• Columns
• Data Links

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-24 Oracle9i Reports Developer: Build Reports
Object Categories
.....................................................................................................................................................

Data Model Objects


The Data Model objects for a report define the data used in the report and the data
structure. Data Model objects appear in the Data Model view of the Report Editor and
the Object Navigator. Data Model objects can be of the following types:
Object Description
Parameter Provide for run-time defaults or user input; system parameters
exist by default; you can also create user parameters
Query Select the data for your report
Group Organize the data to form the required hierarchical structure
Columns Contain individual data values; database columns exist by default
and contain data from the database columns or expressions defined
in the query; you can also create Formula, Summary, and
Placeholder column types
Data Link Join queries for complex data relationships

With the exception of parameters, you create all objects in the relevant editor, not in
the Object Navigator.
Parameters do not appear in the editor. You create and modify parameters in the
Object Navigator only.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-25
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Paper Layout Objects

• Frames
• Repeating frames
• Fields
• Boilerplate

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
When you expand the Paper Layout node in the Object Navigator, you see the report
sections. This will be discussed in detail later in the course. For now, tell the students
that you can define up to three sections (Header, Main, and Trailer) each with a Body
and Margin area. Report sectioning enables you to define multiple layouts in the same
report, each with a different target audience and output format. By default, a report
layout is created in the main section.

......................................................................................................................................................
3-26 Oracle9i Reports Developer: Build Reports
Object Categories
.....................................................................................................................................................

Paper Layout Objects


The Paper Layout objects define the format of the report including the positioning and
appearance of data, text, and graphics. The main layout objects fall into the following
categories:
Object Description
Repeating frame Contains other objects and prints once for each record of the
associated group
Frame Contains other objects and prints only once
Field Contains data and other variable values and their formats
Boilerplate Contains text or graphics that may appear anywhere in the
report

These and other layout objects are discussed later in the course.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-27
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Paper Parameter Form Objects

• Fields
• Boilerplate

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-28 Oracle9i Reports Developer: Build Reports
Object Categories
.....................................................................................................................................................

Paper Parameter Form Objects


The Paper Parameter Form objects define the appearance of the run-time parameter
form. You create and modify run-time paper parameter form objects.
Object Description
Field Contains parameter values
Boilerplate Contains constant text or graphics that appear on the run-time
paper parameter form

Note: The Paper Parameter Form controls the layout of the run-time paper parameter
form. The objects are similar to paper layout objects. The source of a parameter field
comes from a parameter that is a Data Model object. Parameters appear in the Object
Navigator, not in the Data Model view.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-29
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Object Interrelationship
1
Select
...

2
3

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Each query fetches data records and structures them in the group
hierarchy.
2 Each group is the source of a repeating frame.
3 Each column is a source of a field.

......................................................................................................................................................
3-30 Oracle9i Reports Developer: Build Reports
Object Categories
.....................................................................................................................................................

Object Relationships
Now that you know the different categories of objects, it is also important to
understand the relationship between these objects. The diagram opposite shows the
relationships between some of the most common objects, explained in terms of a
simple tabular report.

Data Model Objects


• A query fetches records from the data source.
• Each fetched record becomes an instance of the related group.
• Each data source value is fetched into the related column.

Paper Layout Objects


• A column provides the value that is displayed in one or more layout fields.
• A field must display all instances of its related column value; therefore, each
record instance of a group is represented by a repeating frame.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-31
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Customizing Your Oracle9i Reports


Developer Session

Copyright © Oracle Corporation, 2002. All rights reserved.

Saving Tools Preferences

1 2

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-32 Oracle9i Reports Developer: Build Reports
Customizing Your Oracle9i Reports Session
.....................................................................................................................................................

Customizing Your Oracle9i Reports Session


What are Reports Builder Tools Preferences?
Tools preferences allow you to customize some aspects of your Reports Builder
session.
To access the Reports Preferences dialog box, select Edit > Preferences from the
menu.

Report Preferences
There are four tab pages in the Reports Preferences dialog box. Press the Help key
([F1] in Windows NT) in the Preferences dialog box to see a description of each
preference.
As well as session preferences, Reports Builder preferences enable you to set run-time
options when running your report within the builder.
The following table describes a few example preferences. Others are introduced when
applicable throughout the course.
Tab Preference Name Description
General Suppress Report Do not display the Report Editor when opening a
Editor on Open report. This saves you time when opening several
reports to make changes in the Object Navigator.
Unit of Measurement Set the unit of measurement that you want to use for
new reports that you create. Altering this setting does
not affect existing report definitions.
Wizards Welcome Dialog Check box to suppress or display the first Welcome
dialog box. There are several similar check boxes.

Your preferences are maintained in the file cauprefs.ora, located in the


<oracle_home> directory.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-33
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Oracle9i Reports Environment Variables

• REPORTS_PATH
• REPORTS_TMP
• REPORTS_RESOURCE
• ORACLE_PATH
Windows: Modify in Registry

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-34 Oracle9i Reports Developer: Build Reports
Oracle9i Reports Environment Variables
.....................................................................................................................................................

Oracle9i Reports Environment Variables


Introduction
Oracle9i Reports Developer uses many environment variables. All necessary
environment variables used to run reports are initialized for you by the installer. You
can modify these variables in your own environment and for different applications.

Setting Pathnames
Oracle9i Reports uses some environment variables to search for files at run time. This
enables you to build applications that are portable across platforms and directory
structures by avoiding hard-coded paths in file references in a report.
Variable Description
REPORTS_PATH A path that Reports searches for files at run time
REPORTS_TMP A path that will be used to create temporary files
REPORTS_RESOURCE A path that contains the location of the Reports resource
files, such as icon files
REPORTS_CLASSPATH A path that Reports searches to locate Java objects

Generic Oracle Path


ORACLE_PATH is an additional path that all Oracle9iDS components search if they
cannot find a file in their own specific path.

Modifying Environment Variables


In a Windows 32-bit environment, use the Windows Registry to modify these paths.
Registry path: HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-35
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Using the Online Help System

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-36 Oracle9i Reports Developer: Build Reports
Reports Builder Help Options
.....................................................................................................................................................

Reports Builder Help Options


The table describes the Help menu options in Reports Builder.
Help Menu Option Description
Help Topics This is the contents page for comprehensive online Help;
includes Index and Find tabs.
The Help key ([F1] for Windows) displays context-
sensitive online Help at any place in the builder.
Quick Tour This option will navigate you to the Oracle9i Reports
home page on the Oracle Technology Network (http://
otn.oracle.com/products/reports/content.html). From here
you can access Getting Started with Oracle9i Reports, a
self-paced tutorial on this release.
About Reports Builder Appears as two panels:
The upper panel shows a server-side connection when you
are connected to a database server. If there is no
connection, this panel is blank.
The lower panel shows client-side components and their
version numbers.

Technical Note
In Oracle9i Reports Builder 9.0.2.0.1, ‘Quick Tour’ is the option in the Help menu. In
future releases, this option will be changed to ‘Getting Started with Oracle9i Reports’.
The Oracle9i Reports online Help system is also accessible through the Oracle
Technology Network (http://otn.oracle.com).

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-37
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Describe the Oracle9i Reports executables
• List the types of modules you can create in Reports
Builder
• Describe the views of the Report Editor
• Describe the main object categories in a report
module

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-38 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Oracle9i Reports Developer provides a number of executables for developing and
deploying reports, including Reports Builder.
The Reports Builder interface allows you to develop three types of modules, including
report definitions.
Reports Builder provides a Report Editor in which you can view and modify the
objects that the wizard creates. You can also create your own objects to enhance your
report structure and layout.
The Report Editor enables you to switch views, depending on the objects that you
want to modify. For Web reports, use the Web Source view.
Objects in a Report module fall into four categories: Report, Data Model, Paper
Layout, and Paper Parameter Form.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-39
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Practice 3 Overview

• Invoking Reports Builder


• Opening an existing report
• Switching views in the Report Editor
• Accessing the Help system

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
3-40 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 3
.....................................................................................................................................................

Practice Session Overview: Lesson 3


This practice session contains:
• Invoking Reports Builder
• Opening an existing report
• Switching views in the Report Editor
• Accessing the Help system

Introduction
The questions in the practice session provide an introduction to the Reports Builder
interface. You open and navigate through an existing report definition and use the
Help system to obtain information about some of the Reports executables.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 3-41
Lesson 3: Working in Oracle9i Reports Developer
.....................................................................................................................................................

Practice Session: Lesson 3


1 Start Reports Builder and open the existing report: p3q1.jsp. Run the paper
layout.
2 Using the same report, display the Data Model view of the Report Editor.
In the Object Navigator, select Q_1.
Hint: Move the Data Model window to the right so that you can also see the
Object Navigator. Use the Find field at the top of the Object Navigator to locate
Q_1.
Notice the object that is selected in the Data Model view.
3 Using the same report, switch to the Paper Layout view of the Report Editor.
In the Object Navigator, select F_CUSTOMER_ID.
Hint: Use the Find field at the top of the Object Navigator.
Notice the object that is selected in the Paper Layout view.
Fully expand the Paper Layout node and select R_G_ORD_ID.
Notice the object that is selected in the Paper Layout view.
4 Using the same report, run the Web layout.
5 Use Help Contents to answer the following questions:
a What is RWSERVLET?

b What is RWCLIENT?

c What is the Web Source view?

......................................................................................................................................................
3-42 Oracle9i Reports Developer: Build Reports
4
................................

Creating a Paper Report


Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Create a simple tabular paper report using the
Report Wizard
• Describe the methods of building the report query
• Summarize report values
• Modify the style and content of a report
• Create other report styles available in the Report
Wizard

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 60 minutes
Practice 60 minutes
Total 120 minutes

......................................................................................................................................................
4-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
In this lesson, you learn how to create a simple tabular paper report and modify the
report by adding data and altering the report style. This lesson covers how to create
other styles of reports that are available from the Report Wizard. You will also learn
how to preview a paper report on the Web.
Oracle9i Reports enables you to easily model, design, and publish high fidelity Web
reports. You will learn about this in a later lesson.

Objectives
After completing this lesson, you should be able to do the following:
• Create a simple tabular report using the Report Wizard
• Describe the different methods of building the report query
• Summarize report values
• Modify the style and content of a report by reentering the Wizard
• Create other report styles available in the Report Wizard

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-3
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Report Module Components

• Data Model
• Web Source
• Paper Layout
• Paper Parameter Form
• Program Units

Copyright © Oracle Corporation, 2002. All rights reserved.

Building a Paper Report

You have two options:


• Use Reports Builder
– Wizards
– Paper Layout
– Paper Design
• Define the report in XML

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-4 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Report Module Components


Each report definition consists of a data model, Web source, paper layout, program
units, and paper parameter form, regardless of the storage format for the report. The
same data model and program unit objects can be shared by a paper based layout and a
Web based layout. In essence, you only have to define the actual report once because
the same data model and business logic used for paper publishing can also be used for
Web publishing. You will develop Web reports later in the course.
This lesson focuses on defining a simple data model and creating a paper layout.

Building a Paper Report


In Oracle9i Reports, you have two options for building a paper report. The simplest
method is to use the wizards and editors in Reports Builder. Designed for the paper
layout, the Report Wizard guides you through the steps to create a basic report.
As an alternative, you can define the data model and/or layout for your paper report in
XML.
In this course, you will build paper reports using the Report Wizard.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-5
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Invoking the Report Wizard

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Invoke Reports Builder to show the Wizard at this stage. You might need to close
Reports Builder at the end of the previous lesson. (Later you show the students how to
create a new report using the Wizard when Reports Builder is already open.)
Demonstration:
1 Create a tabular report with a Web and paper layout.
2 Use Query Builder, and base the query on the EMPLOYEES table:
FIRST_NAME, LAST_NAME, JOB_ID, SALARY, DEPARTMENT_ID.
3 Display all fields and reorder some, such as SALARY before JOB_ID.
4 Create a total for SALARY.
5 Change some column labels and reduce widths, such as:
DEPARTMENT_ID: Label=Dept, Width=4
SALARY: Width=6
TOTAL: Width=6

......................................................................................................................................................
4-6 Oracle9i Reports Developer: Build Reports
Invoking Reports Builder and the Report Wizard
.....................................................................................................................................................

Invoking Reports Builder and the Report Wizard


Introduction
When you invoke Reports Builder, the Welcome dialog box gives you the option of
using the Wizard to build a new report.

The Report Wizard


The Report Wizard provides an easy step-by-step interface to create a new report.
The Report Wizard opens with a Welcome page. To suppress this page, clear the
“Display at startup” check box. You can reinstate this page in the same way as the
Welcome dialog box in Reports Builder; select the Wizard tab in the Preferences
dialog box and then select Report Wizard Welcome Page.
Each page of the Report Wizard asks you for information to help you create your
initial report. Step through the wizard pages, selecting Next and Back, until you are
satisfied with the initial information that you have entered. On the last page, select
Finish.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-7
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Choosing the Layout Type

Copyright © Oracle Corporation, 2002. All rights reserved.


M

Creating a Tabular Report

Wizard Pages
• Report Style
• Data Source
Type
• Data Source
Definition
• Fields
• Totals
• Labels
• Template

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-8 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Creating a Tabular Report Using the Wizard


Introduction
You can use the Report Wizard to build eight styles of reports. In this section, you step
through the wizard pages to create a tabular report.

Report Layout and Styles


On the first page you specify the type of layout you want the Wizard to generate. Your
options are:
• Web and Paper Layout
• Web Layout only
• Paper Layout only
In this lesson, you will create a paper report. You can select either Create both Web
and Paper Layout or Create Paper Layout only and then click Next.
The next page shows the various styles of reports. Select Tabular and then click Next.

Wizard Pages
When you choose the Tabular style of report, the Wizard takes you through the
following pages:
Page Name Description
Data Source Select the data source type on which you want to base your report.
Type
Data Source Define the data you want to retrieve for your report.
Definition
Fields Select the fields that you want to display in the output.
Totals Select the fields that you want to summarize.
Labels Alter the labels that appear for each field and the width of each field.
Template Select the template that you want to use for this paper report. A template
contains formatting information and can also contain standard information
such as company logo, date, and so on.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-9
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Selecting the Data Source Type

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-10 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Data Source Types


On the third page, you define the data source type for your report. Through the
implementation of the Pluggable Data Source (PDS) feature in Oracle9i Reports, the
data for your report can come from any source you choose. Reports Builder provides
interface definitions, that act as a translator between Reports Builder and a PDS by
redefining Reports Builder's requests in terms your data source uses.
Oracle Express Server, JDBC, Text and XML pluggable data sources are shipped with
Oracle9i Reports. You can also define your own data source.
This lesson will use the default data source, SQL query.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-11
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Using Query Builder

Copyright © Oracle Corporation, 2002. All rights reserved.

Building a Query

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-12 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Using the Query Builder


Building your query with the Query Builder GUI saves you time and increases the
ease of use for developers not familiar with building SQL statements or with the
application tables.

How to Use the Query Builder


1 Select Query Builder from the Query page in the Report Wizard.
2 Enter your username, password, and alias in the Connect dialog box that appears if
you have not already connected to the database.
3 Select the data tables to build the query.
4 Click Include. The tables appear in the selection area.
5 Click Close to close the Select Data Tables window.
6 In each table, double-click the column names that you want in the query, or use the
check boxes. To select all columns, double-click the Table title bar.
7 Click OK.
Query Builder copies the query syntax into the Report Wizard. You can modify the
query by reentering Query Builder or by modifying the SQL query statement text.
Note: If you prefer to write your own SQL statement, enter the syntax directly in the
SQL query statement area of the Query page. Alternatively, you can import the
contents of a file by clicking Import SQL Query.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-13
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Query Builder Functions

User-friendly interface: Alternative to writing SQL


syntax

1 2 3 4

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Column sequence 4 Logical operators for


conditions
2 Define column 5 Conditions box for WHERE
and HAVING clauses
3 Sort 6 Object type (T=Table, V=
View, S=Synonym, A=Alias)

......................................................................................................................................................
4-14 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Query Builder Functions


This course does not teach the detailed functionality of Query Builder. You can find
comprehensive help in the Reports Builder online Help system as follows:
Reports Builder Online Help: Concepts and Task > How to... > Define a Query >
Using Query Builder
You can use Query Builder to build almost any query that you can write as a SQL
SELECT statement.
You can select from a table, view, or synonym. The letter T, V, or S appears in the
object title bar to indicate which it is. If you define the same table more than once,
Query Builder creates an alias (A).
The following is a brief description of some Query Builder toolbar buttons and
functions.
Function Description
Column sequence Defines the sequence of column names in the SELECT clause
Define column Defines a new, derived, or calculated column to be included in the
SELECT clause; use this definition to calculate and retrieve derived
values from the server
Sort Defines the ORDER BY clause; select the columns that you want to
be sorted, and choose ascending or descending sorting order
WHERE and Place the cursor in the Conditions box on the left side of the Query
HAVING clauses Builder window. Type a condition. Use the AND, OR, and NOT
buttons to create compound conditions.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-15
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Selecting Displayed Fields

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-16 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Selecting Displayed Fields


In the Field page, select each field from the Available Fields list and click >. The
selected fields move to the Displayed Fields list.
To display all fields, click >>.

Sequencing Displayed Fields


You can alter the sequence of displayed fields by dragging one field above or below
another in the list. The sequence of fields in this list determines how the fields appear
in the report output. In a tabular report, the fields appear in sequence from left to right
across the page.

Referencing Nondisplayed Fields


Fields that remain in the Available Fields list are available for you to reference in your
report definition as hidden fields or in PL/SQL trigger code.
In the report output, the user sees only those fields that you transfer to the Displayed
Fields list.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-17
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Totals and Labels

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-18 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Totals and Labels


In the next two pages of the Report Wizard, you can create totals based on any of the
displayed fields and modify the labels and width of the displayed fields.

Totals Standard SQL aggregate functions are provided for creating totals in your
report. If you choose a total, the Wizard creates the total at each level of the report; that
is, at report level and also at each break level, if your report contains break groups.
You can clear some of these totals later (by reentering the Wizard) if, for example, you
want a report-level total only.

Labels The field label is displayed on one or more lines in the report output. In a
tabular report, the labels appear above the field values.
• If the initial label is wider than the field, Reports Builder allows enough space for
the label, or displays it on multiple lines.
• If you increase the number of characters in the label text in the reentrant Wizard,
the label can appear truncated in the report output.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-19
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Selecting a Report Template

• Enforce corporate standards


• Create professional-looking paper reports easily

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-20 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Selecting a Report Template


Select a template from the list of predefined template names.
In a template, the fonts, styles, and colors are already selected for designated objects.
A variety of templates are available with the standard Reports installation.

How to Select a Predefined Template


1 Select the Predefined Template option button, if it is not already selected.
2 Select a template from the Template list.
3 Click Finish.
Note: How to modify and use your own user-defined templates is covered later in the
course.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-21
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Viewing the Paper Report Output

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Magnify tool
2 Page buttons

......................................................................................................................................................
4-22 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Viewing the Report Output


When you finish creating your report in the Report Wizard, the output appears in the
Paper Design view of the Report Editor.

Magnifying the Output


The Paper Design view contains a Magnify tool in the vertical toolbar. This provides a
view of the area of layout you want to see.
• To increase the view size, select the Magnify tool and click in the layout area.
• To reduce the view size, select the Magnify tool, hold down the Shift key, and click
in the layout area.
You can also use the View menu to magnify or reduce the size of the output. Select
View > Zoom to see your options.

Viewing Different Pages


The Paper Design toolbar contains four buttons, and the specific page option, with
which you can scroll through the pages of your report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-23
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Saving the Report Definition

Save changes frequently.

File > Save

File > Save As...

xxx.rdf yyy.rdf

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-24 Oracle9i Reports Developer: Build Reports
Creating a Tabular Report Using the Wizard
.....................................................................................................................................................

Saving the Report Definition


Remember to save the report frequently by selecting Save in the toolbar, or by using
the File > Save menu option.
The recommended format for storing paper reports is with an .rdf extension.

Copying the Report Definition


If you want to make a copy of the report definition in a different filename, use the
menu option File > Save As.
There is no toolbar button for the Save As option.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-25
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Reentering the Wizard

• Select Tools > Report Wizard.


• Tabs are different for each report style.
• Wizard preserves all previous settings.

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Select Tools > Report Wizard (show the right-mouse-button option also).
On the Style tab, select Form.
Click Finish and explain the output that you see in the Paper Design view: labels to
left; each record on a new page.
In the Paper Design, also show that the page buttons are now available for the
multiple-page report. You might also want to demonstrate opening a new Paper Design
window and displaying different pages in each.
Caution: When you demonstrate the Form report, you must create a new report before
demonstrating the other styles, because Reports retains the page break for each record
and you should avoid confusing students with the Property Inspector at this stage.
The bulleted points opposite may provide useful review questions later in the course.

......................................................................................................................................................
4-26 Oracle9i Reports Developer: Build Reports
Creating Other Report Styles
.....................................................................................................................................................

Creating Other Report Styles


Introduction
In this section, you discover the other report styles available in the Wizard and the
pages that the Wizard displays. There are two methods of creating additional report
definitions with the Report Wizard:
• Modifying an existing report definition by reentering the Report Wizard
• Creating a new report definition by restarting the step-by-step Wizard

Modifying a Report by Reentering the Wizard


The reentrant Report Wizard preserves your current settings and query. You can make
changes to these or other settings and click Finish when you are ready to reapply all
the wizard settings to your report.
To reenter the Wizard in an existing report definition, follow one of these steps:
1 Select Tools > Report Wizard.
2 In the Object Navigator, select Report Wizard from the right-mouse-button menu.

Tabbed Pages
When you reenter the Report Wizard, you see a tab for each page. You can navigate
directly to the page you want to modify instead of clicking Next to move through each
page in turn.
Click Finish at any time to apply the changes.

Creating a Form Report


There are three significant features in the Form style that differ from the Tabular style.
• Labels appear to the left of each field.
• Each field appears to the left of the previous field, across the page.
• Each record appears on a new page.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-27
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Creating a New Report

2 1

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Reports node
2 Create object button

Instructor Note
Demonstration
Create a new report and show the group styles:
1. Select the Reports node; select Create in the vertical toolbar.
2. Select Create Paper Layout only. Select Group Left style.
3. In Query Builder, include DEPARTMENTS and EMPLOYEES. Select columns:
DEPARTMENTS: DEPARTMENT_NAME
EMPLOYEES: LAST_NAME, JOB_ID, SALARY
4. Edit the query to remove the join clause linking manager_id to manager_id.
5. In the Groups page, select DEPARTMENT_NAME.
6. In the Fields page, reorder JOB_ID and SALARY.
7. Include a summary of SALARY. Complete the Wizard pages.
8. Reenter the Wizard and change style to Group Above.
9. Click the Groups tab. Select JOB_ID to create a Level 2 group.
10. Click the Fields tab and show how summary fields have been automatically
created for subtotals as well as report total.
11. Click Finish. Point out the differences in the output: position of groups and labels.

......................................................................................................................................................
4-28 Oracle9i Reports Developer: Build Reports
Creating Other Report Styles
.....................................................................................................................................................

How to Create a New Report


To create a new report with the Wizard when you are already in Reports Builder,
follow these steps:
1 Select the Reports node in the Object Navigator.
2 Select the green plus sign in the vertical toolbar.
3 Select the Use the Report Wizard check box.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-29
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Creating Break Reports

• Break report styles:


Group Left, Group Above
• Additional
wizard page:
Groups

Copyright © Oracle Corporation, 2002. All rights reserved.

Break Report Labels

Group Left

Location Id Department Name Last Name Job Id

xxxx xxxxxx xxxx xxxxx


xxxxxxx xxxx

Group Above

Location Id xxxx
Department Name xxxxxx
Last Name Job Id
xxxx xxxxx
xxxxxxx xxxx

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-30 Oracle9i Reports Developer: Build Reports
Creating Other Report Styles
.....................................................................................................................................................

Creating Break Reports


When you select one of the break (or master-detail) styles—Group Left or Group
Above—the Wizard displays an extra page, called the Groups page, in which you
choose the columns that should be in each break group of the report. You can choose
multiple levels of breaks.

Group Left The output is displayed as columns across the page, with the groups
next to each other.
All labels appear above the fields.

Group Above The output is displayed with the groups below each other nested
within the parent group. The labels for all master groups appear to the side of the
fields.
Labels for the bottom detail groups appear above the fields, as in a tabular report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-31
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Creating Mailing Labels and Letters

Wizard pages:
• Style
• Data
• Text
• Template

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Reenter the Wizard. Change the style to Mailing Label.
Modify the query; add an ORDER BY clause: ORDER BY
EMPLOYEES.LAST_NAME. This allows you to show the print direction of the
records (across, then down). Do not try to change the direction here; this is discussed
later when modifying layout objects.
In the Text tab, select LAST_NAME, DEPARTMENT_NAME, and SALARY.
Do not select JOB_ID. This shows that you do not have to display all columns in your
mailing label text.
Finish and run. Reenter the Wizard and change the style to Form Letter.
Modify the text to include constant text; for example:
The employee &<LAST_NAME> works for the &<DEPARTMENT_NAME>
department and earns a salary of &<SALARY> dollars.
Click Finish and show the output.
Caution: Demonstrate Mailing Labels before Form Letter; otherwise each mailing
label is displayed on a separate page.

......................................................................................................................................................
4-32 Oracle9i Reports Developer: Build Reports
Creating Other Report Styles
.....................................................................................................................................................

Creating Mailing Labels and Letters


When you choose the Mailing Label or Form Letter report style, the Wizard displays
only four tab pages: Style, Data, and Template pages as before, and the Text page.

How to Create Text


1 Select a field from the Available Field list.
2 Click > to display in the text area.
3 Type new lines and punctuation as required, or use the punctuation buttons
supplied: New Line, Space, Dash, Comma, and Period.
4 Select additional fields from the Available Fields list.

What Appears in the Text Area?


The selected field name appears in the text area, enclosed in optional angled brackets
(<>) and prefixed by an ampersand (&). This indicates that the field name is a
variable. Each variable is replaced by a specific value at run time.
You can type directly into the text area instead of selecting from the Available Fields
list. However, remember to prefix each field name (variable) with an ampersand.
Any word that you type without an ampersand appears as a text string in your mailing
label output. For example:
Text Area Output
LAST_NAME LAST_NAME
&<LAST_NAME> Kingsway
LAST_NAME
Kochhar

The optional angled brackets allow you to display two variables side by side with no
separating space.

What Is the Difference Between Mailing Labels and Form Letters?


Mailing Label Form Letter
Multiple records on one page One record on each page

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-33
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Creating a Matrix Report

Three additional wizard pages:


• Matrix rows
• Matrix columns
• Matrix cells

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Create a new report using the Wizard. Create both a Web and paper layout. Select the
Matrix style.
Query: In Query Builder, select Import SQL Query. Select les04.sql.
Rows: CITY. Columns: JOB_ID. Cell: SALARY select Sum >.
Totals: SUMSALARY - select Sum >. (Caution: Select SUMSALARY).
Change the width of the summary fields to 6.
Click Finish and show output. Note that there are several physical page widths. Point
out that the Report Wizard tab pages for Rows, Columns, and Cell correspond to the
across, down, and body components of the matrix report.
Now run the Web layout, noting that the Web is not restricted by physical page size.
Reenter the Wizard. Select the Rows tab. Add DEPARTMENT_NAME as Level 2.
Click Finish and show output. Note that all departments are displayed for every city
even if there is no applicable value. This is a nested matrix.
Reenter the Wizard. Change the report style to Matrix with Group.
Select Rows. Select CITY and return it to Available Fields list.
Select Groups. Move CITY to Matrix Group Fields.
Make sure all the summary fields have a width of 6.
Click Finish and show difference in output. Note that only the relevant departments
and JOB_IDs are displayed for each city.

......................................................................................................................................................
4-34 Oracle9i Reports Developer: Build Reports
Creating Other Report Styles
.....................................................................................................................................................

Creating Matrix Reports


When you choose the Matrix report style, the Wizard displays three new tab pages.
Tab Page Description
Rows The field to be displayed vertically down the left side of the matrix; you
can choose multiple levels of rows to create a vertically nested matrix
Columns The field values to be displayed horizontally across the top of the matrix;
you can choose multiple levels of columns to create a horizontally nested
matrix
Cell The field value that becomes the cell, or cross-product, of the matrix

Creating Matrix Totals


When you select a total in the Totals page, the Wizard creates three totals in the matrix.
Summary Description Position in Output
Row One value for each row Right side of matrix, at end of row
Column One value for each column Bottom of matrix, below column
Report One value for the report Bottom right corner of matrix

Creating a Matrix for Each Group Record


Select the Matrix with Group report style. This provides a similar group structure to
the Group Above report.
In your Regional report, you can select CITY in the Group page so that the Wizard
structures the Department/Job_ID matrix for each record.
The differences from a nested matrix are:
• Only the relevant Departments and Job_IDs are displayed for each city.
• If you create summaries for a Matrix with Group style, the Wizard calculates and
displays summaries for each group as well as the report total. The report total is
displayed at the end of the report, in the bottom left corner.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-35
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Previewing a Paper Report in a Browser

• Use Insert > Bookmark to create a bookmark for


your break report

• Use File > Generate to File

Copyright © Oracle Corporation, 2002. All rights reserved.

Previewing a Paper Report in a Browser

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-36 Oracle9i Reports Developer: Build Reports
Previewing a Paper Report in a Web Browser
.....................................................................................................................................................

Previewing a Paper Report in a Web Browser


Introduction
As you will learn in a later lesson, Oracle9i Reports enables you to easily create Web
reports. However, you can deploy your paper reports on the Web with Oracle9i
Reports. If you know that your paper report will be deployed on the Web, you can
preview your report in your Web browser. You need to generate HTML or PDF output
of your report in order to display it in your browser.

Using Bookmarks
If you have used a break style for your paper report, you have the option of creating an
outline for navigation, or bookmark, within your paginated HTML or PDF report,
using the break column.
1 Select Insert > Bookmark.
Note: This menu option is enabled for the Paper Design and Paper Layout views
only.
2 Select a column from the Available Columns list.
3 Click > to display in the Bookmark area.

How to Preview Your Paper Report Output in a Web Browser


1 Select or open the report.
2 Select File > Generate to File to specify the output format:
Use Paginated HTML for HTML output.
Use Paginated HTMLCSS for HTML Style Sheets.
Use PDF for PDF output.
3 In the Save dialog box, you can modify the name and location of your HTML or
PDF file.
4 Open your browser.
5 If you are using Internet Explorer, select File > Open and specify the location and
name of your file. If you are using Netscape Navigator, select File > Open Page
and specify the location and name of your file.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-37
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Create paper reports with the Report Wizard
• Build queries using the Query Builder
• Apply templates to paper reports
• Modify reports by reentering the wizard
• Create new reports of different styles
• Preview a paper report on the Web

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-38 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Report Styles
There are eight common styles of report that you can create by using the Report
Wizard. The Wizard steps you through a variety of pages, depending on your chosen
report style.

Query Builder
The built-in Query Builder provides a user-friendly graphical interface for you to build
the SQL queries to retrieve your report data. Alternatively, you can write the SQL
statement yourself, or import the contents of a file.

Predefined Templates
Predefined templates offer standard fonts, colors, formats, and images that enable you
to create many reports with a professional appearance and a standard look and feel
very quickly and easily.

Reentrant Wizard
The Report Wizard is reenterable; it retains all your previous settings, and enables you
to modify any settings by selecting the relevant tabbed page.

Paper Reports on the Web


While Oracle9i Reports does offer the solution for creating true Web reports, you are
able to publish a paper report on the Web.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-39
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Practice 4 Overview

• Creating a Tabular report


• Modifying the report to create a Group Above break
report
• Creating a Form Letter
• Creating a Matrix report
• Creating a Matrix with Group report

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
4-40 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 4
.....................................................................................................................................................

Practice Session Overview: Lesson 4


This practice session contains:
• Creating and saving a Tabular report
• Modifying the report to create and save a Group Above break report
• Creating and saving a Form Letter
• Creating and saving a Matrix report
• Creating and saving a Matrix with Group report

Introduction
The questions in the practice session are intended to ensure that you have a good
understanding of how to create various styles of reports using the Report Wizard.
Note: When you are completing the practice sessions, use the file naming conventions
that the questions specify. You may need these files in later practices.
In addition, note the field headings and widths. With many reports, you need to change
these to achieve the desired result.
Many of the practice sessions ask you to rename files. Be sure to use Save As, not
Save, so that you do not overwrite the existing filename.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-41
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

Practice Session: Lesson 4


1 Create a tabular report, paper layout only, containing the following data. Use
Query Builder to build the query.
DEPARTMENTS: DEPARTMENT_NAME
EMPLOYEES: FIRST_NAME, LAST_NAME, JOB_ID, SALARY
2 Using the reentrant Report Wizard, make the following modifications.
a Modify the query to sort the data in descending order of salary.
b Add a summary to show the total salary value.
c Ensure the width of SALARY and TOTAL is 6.
d Select the Green template.
e Save the report to a file named p4q2.rdf.
3 Using the reentrant Wizard, modify the report to create a break report.
a Select the report style Group Above.
b Modify the query and remove the join clause so that the report contains all
employees and not just managers.
c Group the report by the department name.
d Save the report as p4q3.rdf.
4 Create a new report as follows:
a Using the Report Wizard, create a paper layout and select the Mailing Label
style.
b Enter the query in the data source definition window:
select c.cust_first_name || c.cust_last_name Name,
c.cust_address
from customers c
This query text is available in the file p4q4.sql.
c In the text area, include all six customer fields, each on a new line.
d Select No template and click Finish.
e Save the report to a file named p4q4.rdf.

......................................................................................................................................................
4-42 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 4
.....................................................................................................................................................

5 Using the reentrant Wizard, modify the report to create a Form Letter style.
Modify the query to include order information for each customer:
a
select c.cust_first_name || c.cust_last_name Name,
c.cust_address, o.order_id, o.order_total
from customers c, orders o
where c.customer_id = o.customer_id
This query text is available in the file p4q5.sql.
b In the text area, enter some free-flowing text for each order. For example:
Order No. &<ORDER_ID> has been shipped to &<NAME> in &<C_CITY>.
The order has a total value of &<ORDER_TOTAL> dollars.
Thank you for your business.
c Select a different template and click Finish.
d Save the report as p4q5.rdf.
6 Create a new report.
a Create both a Web and paper layout. Select the matrix report style.
b For the query, import the contents of p4q6.sql.
c Display customer names down the left side of the page.
d Display product numbers across the top of the page
e Display the total value in the cells.
f Create a summary to give the total of the sum(total_value) values.
g Change the width of all four summaries to 4. Change the PRODUCT_ID label
to Product. Remove the label for sumTOTAL_VALUE.
h Select any template and click Finish to preview your report.
i Save the report to a file named p4q6.jsp.
7 Modify the matrix report to create a Matrix with Group.
a Select Month as the group and check that all totals have a width of 7.
b Click Finish to preview your report and save the report as p4q7.jsp.
Note: The query for the matrix reports above has been restricted to display only
products beginning with “1,” so that you can see and understand the complete matrix
more easily.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 4-43
Lesson 4: Creating a Paper Report
.....................................................................................................................................................

8 Web-enable a paper report.


a Open report p2q9.rdf and run the paper layout.
b Add a bookmark to the report, letting the department names serve as
bookmarks.
c Generate HTML Style Sheet output. Save the file as p4q8.htm..
d Open the report in a browser.
e What happens when you click on the bookmarks?
f Close the browser and in Reports Builder, save the report as p4q8.rdf.
g Save and close all reports.

......................................................................................................................................................
4-44 Oracle9i Reports Developer: Build Reports
5
................................

Enhancing a Basic
Paper Report
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Describe the Paper Design view
• Modify the display of report data in the Paper
Design view
• Modify the positioning of report data
• Highlight data using conditional formatting
• Add page numbering and the current date

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 45 minutes
Practice 30 minutes
Total 75 minutes

......................................................................................................................................................
5-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
In this lesson, you learn to enhance your paper reports with the most commonly
required changes, while viewing the live run-time output in the Paper Design view in
Reports Builder.
You will learn how to enhance your Web reports is a later lesson.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the report Paper Design view
• Modify the display of report data in the Paper Design view
• Modify the positioning of report data in the Paper Design view
• Highlight data using conditional formatting
• Add page numbering and the current date to a report

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-3
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

What Is the Paper Design?

The Paper Design is a view of report output that


allows live editing of text and paper layout attributes:
• True WYSIWYG report editing
• Easy editing: See it. Click it. Change it.
• Cached report data

Copyright © Oracle Corporation, 2002. All rights reserved.

The Paper Design Window

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Toolbar 3 Tool palette


2 Stylebar 4 Status bar

......................................................................................................................................................
5-4 Oracle9i Reports Developer: Build Reports
What Is the Paper Design View?
.....................................................................................................................................................

What Is the Paper Design View?


Introduction
The report Paper Design view is a WYSIWYG editor. All edits that you perform in the
Paper Design view are on live data.

Cached Report Data


Oracle9i Reports Developer caches the data the first time that you run the report, and
then reuses the cached data each time you run the report during the session, unless you
modify the report in any way that requires refreshed data, for example, changing the
group structure or adding a summary column.

The Paper Design Window


The Paper Design window has a horizontal toolbar and stylebar that contain common
functions, also available from the pull-down menu.
The vertical tool palette provides tools that enable you to create simple boilerplate
objects and text to enhance your report, as well as color palettes to modify the color fill
and borders of objects.
You can suppress the tool palette and status bar from the pull-down menu.

Saving Reports
Save your report definition often, using the Save icon on the toolbar or the Save or
Save As options on the File menu, to preserve the changes that you make in the Paper
Design view.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-5
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Modifying a Report

Common modifications:
• Align columns
• Set format masks
• Manipulate objects
• Edit text
• Modify visual attributes
• Highlight data using conditional formats
• Insert page numbers and current date

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
5-6 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Modifying a Report in the Paper Design View


Introduction
This section discusses some of the most commonly required changes that you need to
make to reports after creating the initial definition with the wizard:
• Aligning columns
• Setting format masks
• Manipulating objects
• Editing text
• Modifying visual attributes
• Highlighting data using conditional formatting
• Inserting page numbering
• Inserting current date and time

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-7
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Aligning Columns

Point and Select


select “Align Right”

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Create a tabular report, paper layout only:
Use the EMPLOYEES table. Select columns LAST_NAME, JOB_ID, and SALARY.
Include JOB_ID so that you have an extra column to clear (delete) later. Change the
width of Salary to 6.

......................................................................................................................................................
5-8 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Aligning Columns
In the sample report output, in the left panel, the salary values are aligned to the left.
You often need to align numbers to the right.
1 Select the column that you want to align.
2 Select the “align right” icon on the stylebar.

Aligning Multiple Objects


You can align each object separately, so that you can center the labels if you want.
However, if you want to align the values and the labels to the right, use [Shift]-click to
select more than one object at a time.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-9
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Setting a Format Mask

Change format masks from the stylebar

1 2 3 4 5

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Currency symbol 4 Add decimal places


2 Percentage symbol 5 Remove decimal places
3 Thousand separator

Instructor Note
Demonstration:
Continue with the report used previously. Add currency sign, thousand separator, and
two decimal places to the Salary column.
If students know about number format masks and ask for specific information, tell
them that Reports Builder formats the number using the L, G, and D local currency
elements in the format mask. You can discuss this in detail in a later lesson when you
demonstrate modifying properties in the property inspector.

......................................................................................................................................................
5-10 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Setting a Format Mask


The most commonly used numeric format symbols are available on the stylebar:
• Currency
• Percentage
• Thousand separator
• Decimal places: add and remove

How to Alter a Numeric Format


1 Select the numeric field to which you want to apply a format mask.
2 Select the corresponding format mask button on the stylebar.
The format mask is applied.
Note: Reports Developer applies the format mask only to fields whose datatype is
NUMBER. Also, the currency and percentage format masks are mutually exclusive:
only one or the other can be applied to a numeric field, never both.

NLS Support for Format Masks


The stylebar always shows “$” for the currency button, “,0” for thousands, and “.0”
for decimal places, but the output currency symbols are language-specific and can
differ at run time.
If you use National Language Support (NLS) the symbols that appear in the report
output depend on the value of the territory portion of the NLS_LANG parameter.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-11
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Manipulating Objects

• Clear fields
• Move fields
• Resize fields

Flex Mode adjusts layout during changes.

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Continue with the same report.
Resize, move, and clear one of the columns displayed.
Show the Flex Mode tool. With Flex Mode enabled, try to move a column. Disable
Flex Mode and again try to move a column.
Also point out that you can change the interrecord spacing by dragging the second or
subsequent records.

......................................................................................................................................................
5-12 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Manipulating Objects
You can alter the position of objects, such as fields and labels, by selecting the object
you want to move and dragging it to a new position.
Alter the size of an object by selecting one of the square handles and dragging to the
required size, either smaller or larger.

Flex Mode When you move or resize an object, the rest of the report adjusts as
necessary. This is controlled by the Flex Mode option, which is a button in the
stylebar. Flex Mode is enabled by default, so that all report objects flex, or adjust, to
make room for your modifications.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-13
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Modifying Visual Attributes

• Modify text colors and fonts


• Edit text
• Set fill, patterns, and colors
• Use the Parent Frame tool
to select an enclosing object

-Sales Report - Sales Report by Area Sales Report by Area

Year Region Sales Year Region Sales Year Region Sales


1993 Americas 200 1993 Americas 200
1993 Europe 400 1993 Europe 400 1993 Americas 200
1993 Asia Pacific 770 1993 Asia Pacific 770 1993 Europe 400
1993 Asia Pacific 770
Year Region Sales Year Region Sales
Year Region Sales
1994 Americas 210 1994 Americas 210
1994 Europe 390 1994 Europe 390 1994 Americas 210
1994 Europe 390

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Continue with the same report.
Change the font of one field.
Change the text of a label. For example, change Last Name to Name.
Show how to use the icons to set fill, patterns, and colors. Add a fill, pattern, and color
to the label area, showing how to use the Parent Frame tool.

......................................................................................................................................................
5-14 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

How to Change Field and Boilerplate Font


1 Select one or more objects.
2 Use the font pop-up lists in the stylebar to change font face and size.

How to Edit Boilerplate Text


1 Select the text you want to edit.
The text object is highlighted.
2 Click in the text to position the cursor in the text editor.
3 Edit the text as required.
4 Select any area outside the text object to accept the change.

How to Modify Color Fills and Lines


1 Select the object that you want to modify.
2 Use the color palettes in the toolbar to change the fill, line, or text color.
The stylebar includes a Parent Frame tool you can use to select the outer object
surrounding the currently selected object.
To color the area surrounding all the labels, select one label, click Parent Frame, and
then select the color and pattern you require from the first color palette.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-15
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Applying Conditional Formatting

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
When you apply conditional formats, Reports Builder creates a format trigger that you
can enhance, if necessary.
Demonstration:
Continue with the same report.
Change the appearance of a column based on multiple conditions; for example, change
the font color of the Salary column to red if the value is greater than 10,000 and to blue
if the value is lower than 5,000. Show the format trigger on the Salary column.

......................................................................................................................................................
5-16 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Conditional Formatting
You can highlight or suppress objects using conditional formats.

How to Create Format Exceptions


1 Select an object.
2 Display the pop-up menu and select Conditional Formatting, or select
Format > Conditional Formatting from the menu.
3 Create a new format exception.
4 Specify the conditions as required.
5 Set the format attributes as required.
6 Create further format exceptions as required.
7 Click OK.
Formatting is applied in the order that the format exceptions are listed; a format
exception overrides a previous format exception if both evaluate to TRUE.
You can select a format exception in the Format Exceptions list and move it up or
down. You can also drag and drop items in the list.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-17
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Inserting Page Numbers, Dates,


and Times

• Inserted easily
• Customizable extensions

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Using the same report, add page numbers and the date. Point out that many of the
predefined paper templates already add these features to your reports.
Mention that you can add extra date format masks to your preferences.
Show how to customize date extensions to include the time. However, it is much
easier to use the list of examples that shows the current date. The default preferences
file (cagprefs.ora) provides a large list.
The Property Inspector is not used in this lesson because there is so much basic
functionality to discuss in the Paper Design view. If students ask, you can modify the
date after you create it. Double-click the date object to open the Property Inspector.
The Format Mask property is in the Field region.

......................................................................................................................................................
5-18 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Inserting Page Numbers, Current Date, and Time


To add page numbers and the current date to your report in the Paper Design view,
select the appropriate items from the Insert menu.
Insert Menu Description
Item
Page Number Use this item to add a page number to the margin of a report.
Date and Use this item to add the current date and time to the margin of a report. You
Time can define your own date and time format masks.

Date and Time Format Masks The Insert Date and Time dialog box displays the
current date in many different formats. You simply choose the style that you want. The
underlying format mask is composed of tokens representing each element.
The list of formats depends on the entries in your preferences file. To modify the
preferences list, select Edit > Preferences > Edit Masks.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-19
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Customizing Dates

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
5-20 Oracle9i Reports Developer: Build Reports
Modifying a Report in the Paper Design View
.....................................................................................................................................................

Inserting Page Numbers, Current Date, and Time (continued)

Customizing the Date and Time Format If the mask that you want does not exist,
and you do not want to add it to your preferences, select Custom. This dialog box
provides a read-only list of tokens available for you to build your own style, if you
understand the Oracle format tokens.
Note: The Help system fully describes the format mask syntax. Select
Help > Find > Date Syntax, and select Date and Time Format Mask Syntax from the
list of topics.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-21
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Enhance report output using live data:
– Move, resize, delete objects
– Edit text
– Alter fonts, colors, and patterns
– Apply format masks
– Add page numbering and current date
• Save report to preserve changes

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
5-22 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Features of the Paper Design View
The Paper Design view is a WYSIWYG editor that enables you to enhance your report
output using the live data. You can manipulate objects and edit text content. You can
also alter the font, colors, and patterns of individual objects.
The format mask buttons provide quick and easy currency formatting. The Insert menu
enables you to add page numbering and the current date, using predefined formats or
customizing your own.

Saving Changes
Remember to save your report definition often during editing in order to preserve the
changes you make in the Paper Design view.
When you save the report, all changes become part of your report definition and
always appear at run time.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-23
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Practice 5 Overview

Modifying reports by applying changes in the Paper


Design view

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
5-24 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 5
.....................................................................................................................................................

Practice Session Overview: Lesson 5


This practice session involves modifying reports by applying changes in the Paper
Design view.

Introduction
In this practice session, you will reuse some of the reports that you created in the last
session.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-25
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

Practice Session: Lesson 5


1 Open report p4q2.rdf. Make the following changes in the Paper Design view:
Make the SALARY column right-justified. Do not forget to justify the column
a
header accordingly.
b Add a comma and a currency symbol to SALARY. Add two decimal places.
c Make the total at the end of the report right-justified and add commas, a
currency symbol, and two decimal places, as in the column SALARY.
d Change the label of the total to italic font.
e Make whatever other changes you like.
f Save the report to a file named p5q1.rdf and close it.
2 Open report p4q3.rdf. Make the following changes in the Paper Design:
a Add a border with a 2 pt. width around the total for each department.
b Add commas and two decimal places to the SALARY field and the total and
make them right-justified. Do not forget to justify the column header for the
SALARY field accordingly.
c Make the same changes to the total at the end of the report. Move the grand
total so that it aligns with the SALARY field (you must do this manually; use
the ruler guides to help you).
d Change the color of the employee data heading to blue.
e Make whatever other changes you like.
f Save the report to a file named p5q2.rdf and close it.
3 Open report p5q3_a.rdf. Make the following changes in the Paper Design:
a Add a date at the top center of the page. Give it any format you want.
b Make whatever other changes you like.
c Save the report to a file named p5q3.rdf and close it.
4 Open report p4q6.jsp. Make the following changes in the Paper Design:
a Right-justify the Product ID field.
b Add commas and two decimal places to the cells and summaries and make
them right-justified.
c Why are some of the cell and summary values displayed with asterisks? What
can you do to correct this?
d Add a blue line color to the parent frame of NAME.
e Save the report to a file named p5q4.jsp and close it.

......................................................................................................................................................
5-26 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 5
.....................................................................................................................................................

If You Have Time


5 Open the file p5q2.rdf and conditionally highlight the SALARY field.
a If the salary is less than 8500, print the field in italics.
b If the salary is more than 12000, print the field in bold italics and make the text
color red.
c Save the report to a file named p5q5.rdf and close it.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 5-27
Lesson 5: Enhancing a Basic Paper Report
.....................................................................................................................................................

......................................................................................................................................................
5-28 Oracle9i Reports Developer: Build Reports
6
................................

Managing Report
Templates
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Describe the template regions
• Describe the difference between default and
override template sections
• Modify a predefined report template
• Register a customized template
• Add a Web link to a template

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 45 minutes
Practice 40 minutes
Total 85 minutes

......................................................................................................................................................
6-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
In this lesson, you learn how to open and modify predefined Oracle9i Reports paper
templates and how to register a customized template in the predefined template list.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the template regions
• Describe the difference between default and override template sections
• Modify a predefined paper report template
• Register a customized template in the predefined template list
• Apply an HTML header to a paper template

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-3
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Using Report Templates

For paper reports, you have three template options:


• Predefined
• User-defined
• No template

Installation templates in:


<oracle_home>\reports\templates

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
6-4 Oracle9i Reports Developer: Build Reports
Using the Report Templates
.....................................................................................................................................................

Using the Report Templates


Introduction
The template page of the Report Wizard has three options for choosing a template for
a paper report:
Option Description
Predefined Shows a static descriptive list of available templates
Template File A user-defined template file that you specify by entering a filename or
browsing the file system
No Template Uses the report default settings instead of a template file

Creating a User-Defined Template


You can create your own templates from scratch, but this may not necessary because
many prebuilt templates exist in the installation.
Create your own templates by modifying one or more installed templates with your
own standards, logos, and so on, as described on the following pages.
Several templates are included in the installation. They are in
<oracle_home>\reports\templates. The file extension for paper templates
is .tdf.
One template definition can contain template information for all styles of reports.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-5
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Modifying a Template

Margin Body

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Open a predefined template file from the template directory:
<oracle_home>\reports\templates. Save it as another name in your home
directory.
Show the following nodes in the Object Navigator: Body, Margin. Show the
corresponding button in the Template Editor view, and make sure you are in the Body
region.
Expand the Body node to show Default and Override. (There is a demonstration on a
later page).
In the Template Editor, you can switch the style in the pop-up list, Group Left, Matrix,
and so on, to show the different layouts for different styles.

......................................................................................................................................................
6-6 Oracle9i Reports Developer: Build Reports
Modifying a Template
.....................................................................................................................................................

Modifying a Template
Introduction
A report template is not the same as a report definition. A template is divided into
regions, which the Report Wizard references while creating the paper report definition.

The Template Regions


The Template Editor enables you to modify existing objects in the margin and body
regions of the template. You can also customize or add other reports objects:
parameters, report-level triggers, program units, and attached PL/SQL libraries.
Region Description
Body Contains default section to apply changes to all report styles, and override
sections to apply individual changes to different report styles
Margin Defines objects that appear in the margin of all pages

Making Modifications to Template Objects


Modify template objects in the Template Editor or in the Object Navigator.
The Template Editor is similar to the Paper Layout view of the Report Editor. You can
create, delete, and modify objects (such as page numbers, text, and graphics) in the
margin area. In the body area, you can modify the properties of body objects.
The Report Style drop-down list enables you to view the layout for a selected report
style.

Default and Override Sections


Make general modifications to the default section. These modifications affect all
report styles. However, you can override attributes for one or more styles to provide a
flexible inheritance model.
Each report inherits attributes from the default section of the template unless there is
an override value. The override section overrides specific attributes for each style.
There is an inherit button in the Property Inspector to return to the default value.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-7
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Customizing Template Margin

Include
objects
such as:
• Images
• Text
• Page
Numbers
• Date

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
1 In the Template Editor, change to the margin region and insert an image into the
template margin.
2 Add a report title.
3 Insert a date.
Note: If you create a report using a template, rwblue, and then modify rwblue, the
report does not automatically inherit the changes unless you reapply the template
through the Report Wizard. When you apply a template to a report, the objects and
defintions of the template are physically copied into the report module defintion.

......................................................................................................................................................
6-8 Oracle9i Reports Developer: Build Reports
Modifying a Template
.....................................................................................................................................................

Customizing Template Margin


You can copy, create, or import various objects into the margin of the template.
• Images: Insert > Image
• Text: Text tool in the vertical toolbar
• Page Numbers: Insert > Page Number, and the button on the horizontal toolbar
• Date: Insert > Data and Time, and the button on the horizontal toolbar
Note: The toolbar button for inserting page numbers is visible in the Template Editor
when the margin area is selected. This button, and the one to insert date and time, are
shortcuts for menu items.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-9
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Customizing Template Body

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Using the same template:
1 In the Default section, change the solid color fill on the field labels on the
template.
2 For Group Left only, change the font style to italic for the master fields (section
level 1).
3 Save the template.
4 In the Report Wizard, create a simple report that provides a break:
SELECT JOB_ID, LAST_NAME, SALARY FROM EMPLOYEES.
5 Select Group Above, group by JOB_ID, and apply your new template. Show how
to browse the directory for the template file.
6 Reenter the Wizard and change the style to Group Left. Show the different color
labels.
7 If you have time, apply this new template to an existing report. Only some changes
occur.

......................................................................................................................................................
6-10 Oracle9i Reports Developer: Build Reports
Modifying a Template
.....................................................................................................................................................

Customizing Template Body


In the template body, you can modify fonts, colors, and fills of the field, label,
summary, and frame objects. You make changes directly in the Template Editor or by
using the Property Inspector and pop-up lists corresponding to the object selected.

Reapplying a Template
If you reenter the Report Wizard and reapply the template in the Template tab, Reports
Builder reapplies the template background and margin objects to your report.
The report retains any live changes you made to the body, such as modifying the font
or color of text or fields.

Technical Note
You can also create Web layout templates. For more information, refer to the Oracle9i
Reports Technical Note How to Create a Web Layout Template on the Oracle
Technology Network (http://otn.oracle.com).

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-11
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Adding Web Links to a Template for


Report HTML Output

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Adding Web links to a template definition for report HTML output does exist in
Oracle9i Reports. However, publishing paper reports on the Web in HTML conflicts
with the one of the key features and messages of this release: publishing true Web
reports using JSP technology. Emphasize this rather than the ability to push paper
reports onto the Web.
If asked, you can demonstrate Web links:
• Use l6weblink.rdf. Run the paper layout to show the output.
• Open the Property Inspector for the report and show the Before Report Type and
Before Report Value properties. These values add an HTML header document to
the report. The header document contains two links.
• The HTML output has already been generated for you. Start your browser and
open l6weblink.htm. Test the Web links.

......................................................................................................................................................
6-12 Oracle9i Reports Developer: Build Reports
Adding Web Links to a Template for Report HTML Output
.....................................................................................................................................................

Adding Web Links to a Template for Report HTML Output


Introduction
A paper report output in HTML format can include many types of Web links, such as a
document header or footer for placing a logo or a link at the beginning or end of a
document, or a page header or footer for placing a logo at the beginning or end of one
page or all pages of an HTML document.

How to Add a Web Link to a Template


1 In the Object Navigator, open the template Property Inspector.
2 Under the Report Escapes node, set the type for the property of choice:
– Use Text if you will enter the property value.
– Use File if you will import the property value from a file.
3 Under the Report Escapes node, set the value for the property of choice:
– Enter the value.
– Use the browse button to select an HTML file to import.

Customizing Web Links


In most cases, you can define the Web links in the Property Inspector of the object.
You can specify column and field names in the link value to create dynamic links at
run time. For more complex Web links, such as conditional settings, use PL/SQL
format triggers and the SRW built-in packaged procedures.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-13
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Predefining Your Own Templates

• Modify and save template file (mytemp.tdf)


• Move file to template directory:
<oracle_home>\reports\templates>
• Register name and description in cagprefs.ora

Reports.Tabular_Template_File =
(rwbeige, Reports.Tabular_Template_Desc =
rwblue, ("Beige",
mytemp, "Blue",
rwgray, "My Template Description",
rwgreen, "Gray",
rwpeach, "Green",
"Peach",

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Open the cagprefs.ora file and show the entries that define different template
files and the descriptions that appear in the predefined list.
Modify one or more entries to include your modified template file.
If your setup allows you to modify the installation directories, copy your template to
the template directory.

......................................................................................................................................................
6-14 Oracle9i Reports Developer: Build Reports
Predefining Your Own Templates
.....................................................................................................................................................

Predefining Your Own Templates


Introduction
When you create your own templates, you might want to include some in the
predefined template list that appears when creating a report using the Wizard.
You can then select the template from the descriptive list for all similar reports that
you create, instead of searching through your file system to find the template file that
you want.
This section describes how to register the template file as a predefined template by
inserting an entry in the preferences file and storing the template and (optional) image
in the correct template directory.

Editing the Preferences File


Reports Builder builds the list of predefined templates and their images by reading
template names from the Oracle Reports preferences file and mapping to similarly
named .bmp files (with a one-letter suffix to identify each report style).

Registering a Customized Template in the Predefined List of the Wizard


1 Open an existing template, modify the template objects as required, and save the
template as a .tdf file.
2 Move the template and the image files to the template directory:
<oracle_home>\reports\templates.
3 Add the template filename (excluding the suffix) to the entries in the Oracle
Reports preferences file, cagprefs.ora. Add the filename to each style of report
for which your template is applicable; for example:
Reports.Tabular_Template_File ,
Reports.Matrix_Template_File.
4 Add a short template description to the relevant
Reports.xxx_Template_Desc entry in cagprefs.ora, making sure that
the description is listed in the same position as the relevant file. These are the
descriptions that you see in the predefined list when you apply a template in the
Report Wizard.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-15
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Adding a Template Image

• Image area is 200 x 150 pixels


• Image filenames = template name + .bmp
• Move .bmp files to template directory

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Show the .bmp files in the template directory.
The .bmp files in the installed templates show data from the simple Oracle
demonstration tables EMP and DEPT in the SCOTT/TIGER schema.

......................................................................................................................................................
6-16 Oracle9i Reports Developer: Build Reports
Predefining Your Own Templates
.....................................................................................................................................................

Adding a Template Image


Each predefined template has a small image associated with it that is displayed on the
right side of the template page of the Report Wizard. The image is optional but is a
useful graphical example of how the report looks if you apply that template.
To display your own image, use the template to create a simple report and create an
image of the report output.

How to Create a Template Image


1 Create a simple report using your new template. For example, use the tables EMP
and DEPT.
2 Create a bitmap image (screenshot) of the top left corner, including enough data to
make the style clear to the user.
Note: The bitmaps supplied are 200 x 150 pixels.
3 Name the file *.bmp and store it in the same directory as the template
<oracle_home>\reports\templates.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-17
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Modify existing templates to create your own user-
defined template
• Modify the default section for all styles or override
for individual style changes
• Add your templates to the predefined list
• Display an image for a predefined template
• Add Web links for report HTML output

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
6-18 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Modifying a Template
In this lesson, you learned to open an existing template definition in the Template
Editor and make modifications to create your own customized templates.
You can use any customized template when creating a paper report in the Report
Wizard.
The template contains default and override sections.
• Default section: Modify objects to affect all styles of reports created with this
template.
• Override sections: Modify objects to make individual changes to one or more
styles: Tabular, Group Above, and so on.

Registering a Template
You learned how to register your templates so that they appear in the predefined list in
the Report Wizard. Optionally, you can include a small bitmap image for each style of
report, which is displayed when you select a predefined template.

Adding Web Links


In this lesson, you learned how to add a Web link to a paper template for report HTML
output.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-19
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Practice 6 Overview

• Customizing an existing template


• Applying the modified template to an existing report
• Adding a Web link

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
6-20 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 6
.....................................................................................................................................................

Practice Session Overview: Lesson 6


This practice session contains:
• Customizing an existing paper template
• Applying the modified template to an existing report

Introduction
In this practice session, you open an existing template, which is one of the standard
templates shipped with the Oracle9i Reports Developer installation.
You modify objects in the margin and body sections and save the template to a new
filename. Then, you apply the modified template to an existing report and note the
differences.

Instructor Note
The practice does not include modifying the preferences file to register a predefined
template. You can suggest that students do so, if you have time and if your class setup
allows students to modify the preference file and to write to the
<ORACLE_HOME>\reports\templates directory.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-21
Lesson 6: Managing Report Templates
.....................................................................................................................................................

Practice Session: Lesson 6


1 Customize an existing template, adding a company logo and report title to the
report margin, and modify the report body.
a Open rwblue.tdf. This file should exist in your working directory; it is a
copy of the Blue predefined template.
b Display the margin region. (This usually appears by default when you open a
template.)
c Delete the Your Company logo. Import towers2.jpg and place it in the top
left corner of the margin; this file should exist in your home directory.
d Add a report title:Lakeside Technologies.
e Display the body region to view the changes you will make in the next steps.
f Change the justification of numeric fields (number field and summary) to
Right. Do not forget to change the justification of labels for number fields to
Right.
g Save the template as laketech.tdf.
2 Apply the modified template to an existing report.
Hint: You must search for the template file; it does not appear in the list of
predefined templates.
Open p4q3.rdf.
a
b Apply laketech.tdf to the report.
c The report shows some changes but not all. Which template changes have been
applied and which have not?
d To apply all changes to your report, you will have to create the layout again.
From the menu, select Edit > Select All to select all layout objects. Now delete
them. Invoke the Report Wizard and reapply your template.
e Save the report as p6q2.rdf.
3 Continue to modify the template and test it using a new report.
a Change the text color of the master group fields to red for the Group Left style
only.
Hint: In the Template Editor, use the Report Style list to switch to a Group Left
style. This way you can select the correct group. You may also want to use the
Zoom Out tool so that you can see the entire template layout structure, and
recognize the difference between the master group fields and the detail group
fields.
b Save your template as laketech2.tdf and close it.

......................................................................................................................................................
6-22 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 6
.....................................................................................................................................................

c Create a new report, using the Report Wizard.


Use the layout style Group Left.
Import the query p6q3.sql from your working directory.
Make DEPARTMENT_NAME the group field.
Display all other columns.
Do not create summaries.
Change the width of SALARY to 6 and COMMISSION_PCT to 4.
Apply the Template file laketech2.tdf.
d Save the report as p6q3.rdf and close it.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 6-23
Lesson 6: Managing Report Templates
.....................................................................................................................................................

......................................................................................................................................................
6-24 Oracle9i Reports Developer: Build Reports
7
................................

Creating a Web Report


Lesson 7: Creating a Web Report
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Identify the options for designing a Web page
• Create a simple Web report using the Report Wizard
• Invoke the Web Source view of the Report Editor
• Describe the elements of the Web source code
• Preview a Web report

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 45 minutes
Practice 30 minutes
Total 75 minutes

......................................................................................................................................................
7-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
Oracle9i Reports is designed for the Internet. You can develop Web reports simply and
quickly in Reports Builder.
Earlier releases of Oracle Reports provided Web functionality for paper reports,
enabling you to publish corporate data on the Web in HTML and PDF formats.
However, this often resulted in large and somewhat inflexible HTML pages.
While all the previous Web report functionality remains (hyperlinks, bookmarks, and
so on), Oracle9i Reports takes advantage of JavaServer Page (JSP) technology to
deliver high quality HTML pages for Web publishing.
In this lesson, you will be introduced to JSP technology, learn how to create a Web
report using the Report Wizard, and learn how to use the Web Source view of the
Report Editor.

Objectives
After completing this lesson, you should be able to do the following:
• Describe JavaServer Page technology and list some of its advantages
• List the options for building a Web report
• Create a Web report using the Report Wizard
• Examine the source code for your Web report using the Web Source view of the
Report Editor
• Preview a report on the Web

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-3
Lesson 7: Creating a Web Report
.....................................................................................................................................................

What Is JSP Technology?

• Dynamic scripting capability for Web pages


• Server-side technology
• Enables the separation of dynamic and static
content in a Web page

Copyright © Oracle Corporation, 2002. All rights reserved.

JSP Advantages

• Separation of dynamic and static content


• Support for scripting and tags
• Reuse of components and tags
• Portable, powerful, and easy to use
• Accepted industry standard for building dynamic
Web pages

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
7-4 Oracle9i Reports Developer: Build Reports
JavaServer Page (JSP) Technology
.....................................................................................................................................................

JavaServer Page (JSP) Technology


What is JSP?
JavaServer Page technology is an extension to the Java servlet technology from Sun
that provides a simple programming vehicle for displaying dynamic content on a Web
page. JSP is a server-side technology. A JSP is an HTML page with embedded Java
source code that is executed in the Web server or application server. The HTML
provides the page layout that is returned to the Web browser, and the Java provides the
business logic.

Why Use JSP?


JSP technology enables the rapid development of Web-based applications that are
platform independent. Organizations typically have a team of Web designers and
developers to create visually appealing and effective Web pages for publishing. The
team may do this through HTML scripting, or by using any HTML authoring tool.
JSP technology lets you separate the dynamic portion of your Web page from the static
HTML. This enables Web designers to build the static portion of the page using their
favorite Web authoring tool, and you, as an application developer, to add the dynamic
data component using Oracle9i Reports custom JSP tags.
Since the JavaServer Pages cleanly separate dynamic application logic from static
HTML content, page designers who have limited or no Java programming expertise
can modify the appearance of the JSP page without affecting the generation of its
content. The separation of the HTML coding and the business logic in a Web page
allows HTML programmers and Java programmers to more easily collaborate in
creating and maintaining applications. The application logic itself can reside in server-
based resources that the Web page accesses through tags that are similar to XML tags.
Another advantage of using JSPs is that they are easy to code. JSPs are compiled “just
in time”, offering faster performance with maximum portability. JSPs are rapidly
becoming the standard environment for enterprise Web publishing. JavaServer Pages
are recursive and can execute different code streams within the HTML, making them
more versatile for deploying information on the Web.

Technical Note
For more information about JSP technology, see the JavaSoft Web site at http://
www.javasoft.com/products/jsp/.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-5
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Simple JSP Example

<HTML>
<HEAD><TITLE>Simple JSP Example</TITLE></HEAD>
<BODY>
Welcome to my page!!
Current time is :
<%= new java.util.Date() %>
</BODY>
</HTML>

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
7-6 Oracle9i Reports Developer: Build Reports
JavaServer Page (JSP) Technology
.....................................................................................................................................................

JSP Example
Before you learn about Reports JSPs, let’s look at a very basic JSP example.
This is the source code for a JSP that prints out a greeting and the current date:
<HTML>
<HEAD><TITLE>Simple JSP Example</TITLE></HEAD>
<BODY>
Welcome to my page!!
Current time is:
<%=new java.util.Date()%>
</BODY>
</HTML>
• The first five lines of code are standard HTML code, defining the title and start of
the body of the page.
• The line that follows prints the date and time using a Java expression between the
<%= and %> tags. This expression creates a new instance of the java.util.Date type,
which is set to the current time when the object executes.
• The object is then translated into a string and returned to the browser.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-7
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Building a Web Report

Two Options:
• Open an existing HTML page in Reports Builder
• Use one of the predefined HTML templates shipped
with Oracle9i Reports Developer

Copyright © Oracle Corporation, 2002. All rights reserved.

Using the Report Wizard

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
7-8 Oracle9i Reports Developer: Build Reports
Creating a Web Report Using the Report Wizard
.....................................................................................................................................................

Creating a Web Report Using the Report Wizard


Introduction
You can easily create Web reports using the declarative features in the Report Wizard.

Building a Web Page: Defining the Static Content


Oracle9i Reports gives you two options for building a Web report.
1 You can design a Web page using your favorite HTML authoring tool. You open
your HTML page in Reports Builder and add dynamic content to the page. The
dynamic data is “injected” into the appropriate sections of the page using JSP tags.
You can use the Report Block Wizard to do this or you can enter the code manually
using the Web Source view of the Report Editor.
2 You can use one of the predefined HTML templates that are shipped with Oracle9i
Reports and use the Report Wizard to define the data model and Web layout.
In this lesson, we will use a predefined HTML template and the Report Wizard to
build a Web report and save it in JSP format. In a later lesson, you will learn how to
add dynamic content to an existing Web page using the Report Block Wizard and the
Web Source view of the Report Editor.

Using the Report Wizard


You have already used the Report Wizard to create paper reports. The Wizard gives
you the option of generating a Web and/or paper layout for a single report definition.
The default option is to create both a Web and paper layout. Recall that every report
definition has a data model and a layout. The same data model can be shared by a Web
layout and paper layout.
To use the Report Wizard and a predefined HTML template, create the report
definition just as you would a paper report. Step through the pages of the Wizard and
select the report style, data source, fields to display, and so forth. From the templates
page, select one of the predefined templates. You will notice that the list of predefined
templates is the same as it is for paper reports. Oracle9i Reports provides
corresponding HTML templates and style sheets for your Web reports. You will learn
more about HTML templates and style sheets later in this course.
When you click Finish in the Wizard, Reports Builder generates the layout type that
you selected. If you opted for both Web and paper layout, the Paper Design view
displays by default. If you opted for Web layout only, the Web Source view of the
Report Editor displays.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-9
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Report Editor: Web Source View

Reports JSP
Custom Tag
Library
Start of report

HTML template
information

Data model
information

End of report

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: Show the standard and custom JSP tags that Reports Builder provides
for each report module.
• Create a new report
• Select Build a new report manually
• Invoke the Web Source view of the Report Editor
Point out the structure of a Reports JSP. Indicate the place holders in the JSP that will
be populated by the Report Wizard. Differentiate between standard JSP tags and
Reports custom JSP tags.

......................................................................................................................................................
7-10 Oracle9i Reports Developer: Build Reports
Web Source View
.....................................................................................................................................................

Web Source View


Introduction
The Web Source view of the Report Editor displays the source code for your Web
report, including HTML tags and JSP tags. The view presents a Web page in which
you can add dynamic report blocks using the Report Block Wizard, and graphs using
the Graph Wizard. You will do both in a later lesson.

Invoking the Web Source View


Every report module contains a Web Source component, whether a Web layout has
been created or not. If you open the Web Source view for a new report module for
which no data model or layout has been defined, you will see that the view is not
empty. Reports Builder provides the required JSP declarations for any report module,
as well as place holders for the content that the Report Wizard will create.
To display the Web Source view, do one of the following:
• Select View > Change View > Web Source from the menu in the Report Editor.
• Select the Web Source icon in the horizontal toolbar in the Report Editor.
• Double-click the icon next to the Web Source node in the Object Navigator.

JSP Tags
A Reports JSP includes both standard JSP tags and Reports custom JSP tags.
A JSP tag is a Java class that encapsulates functionality and can be used in a
JavaServer Page. The use of JSP tags keeps the JavaServer Pages manageable and
easy to read. You do not have to write a lot of inline Java code. You simply reference a
JSP tag. When a .jsp file is run, each tag is substituted with the corresponding code.
JSP 1.1 supports custom tag libraries. You can write your own set of tags and reference
them within your JSPs. A set of custom JSP tags was created for Oracle9i Reports to
facilitate the development of Reports JavaServer Pages. These tags provide scripting
shortcuts that hide the intricacies involved in querying data from the respective data
sources, access to the data model break group cursors, and retrieve and format data
from report columns and parameters.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-11
Lesson 7: Creating a Web Report
.....................................................................................................................................................

JSP Tags

• Standard JSP Tags


– taglib
– page
• Reports Custom JSP Tags
– rw:report
– rw:objects
– rw:foreach
– rw:field
– rw:include

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
7-12 Oracle9i Reports Developer: Build Reports
Web Source View
.....................................................................................................................................................

JSP Tags (continued)


The standard JSP tags, taglib and page, are required in the definition of a report
module.
• <taglib>: In order to use the custom tags in a Reports JSP, a declaration identifying
the custom tag library must be included. This declaration also identifies the custom
tag prefix letters. In Oracle9i Reports, the custom JSP tags are prefixed with rw.
The custom tag library is declared in the first line of the Web source:
<%@ taglib uri="/WEB-INF/lib/reports_tld.jar"
prefix="rw" %>
Note: tld stands for tag library descriptor.
• <page>: This tag identifies the scriplet language, the Java classes to import, and
the JSP to display for any unhandled runtime errors.
<%@ page language="java" import="java.io.*"
errorPage="rwerror.jsp" %>

Reports Custom JSP Tag Library


The table below lists some of the custom JSP tags used in Oracle9i Reports:

Custom JSP Tag Definition


rw:report Delimits a report object within a JSP.All other Reports
custom tags must exist within the scope of this tag.
rw:objects Adds or modifies the report definition. This tag iden-
tifies the beginning of the runtime metadata region,
i.e., the data for the report.
rw:foreach Indicates a loop through the data source group object
rw:field Provides formatting functionality to render a single
value source object (a column, user parameter, or sys-
tem parameter) in HTML
rw:include Provides for the formatting of any top level layout
object into HTML output. This tag is used to reference
a paper layout within a Reports JSP.
rw:graph Provides a graph definition in XML.

Technical Note
For a complete list of Reports custom JSP tags, consult the online Help system.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-13
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Web Source Example

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: Create a new report and select the option Create both Web and Paper
layout. The purpose of this demonstration is to show what the Report Wizard creates
in the Web source.
Use the EMPLOYEES table and select columns FIRST_NAME, LAST_NAME,
EMAIL, and HIRE_DATE.
Display the Web Source view, showing the different options for invoking the view.
In the Web Source view, point out the code that was generated by the Wizard in the
place holder areas, specifically the HTML template (rw:style) and report body
(rw:dataArea). Note that data source and layout information is hidden in the Builder;
it is delimited by the rw:objects tag. To view the code in this section, save the report
module as a .jsp, and use a text editor (WordPad) to view the .jsp file. Note all
the additional information that can be viewed and edited in a text editor.
Test your report in the browser by selecting the Run Web Layout button.
Continue with the same report. Reenter the Wizard and add the SALARY column to
the query. Display this column in the output, and include the average of SALARY.
Invoke the Web Source view and examine the data area, pointing out the additional
column in the query, as well as the report level summary.
Display the Web report in your browser.

......................................................................................................................................................
7-14 Oracle9i Reports Developer: Build Reports
Web Source View
.....................................................................................................................................................

Example
The Web Source on the previous page was generated by the Report Wizard using the
following specifications:
• Style: Tabular
• Data source: SQL query
• Data:
SELECT FIRST_NAME, LAST_NAME, EMAIL, HIRE_DATE
FROM EMPLOYEES
• Fields: display all fields
• Template: Blue
The code generated by Reports Builder for the data model of the report is shown in the
slide.

Modifying a Web Report Using the Report Wizard


You can modify a Web report using the reentrant feature of the Report Wizard just as
you did for paper reports. The Wizard preserves your current setting and data source
definition. You can make changes to these and other settings and click Finish when
you are ready to reapply the Wizard settings to your Web report.

Saving Your Web Report Defintion


The preferred format for saving a Web report is Reports JSP (*.jsp) and not HTM or
HTML. The reason for this is that certain Web servers (for example, Apache) see the
HTML extension, assume the document is static, and simply return the document to
the browser without ever executing the JSP code it contains. Furthermore, if your Web
report has a jsp extension, it is also recognizable to Java development environments,
such as Oracle9i JDeveloper, and you can utilize the Java debugging tools available in
these environments.

Technical Note
A Reports JSP contains the full definition of your report module. However, Reports
Builder hides a good deal of the code in the Web Source view. You can view the
module, <module_name>.jsp, outside the Builder using a text editor and see
much more—data source, data links, layout, and so forth.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-15
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Generating Output

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Explain the difference between this Web output and the output that is generated when
DESFORMAT = HTML or HTMLCSS. The underlying JSP technology in Oracle9i
Reports enables you to enhance Web pages with information retrieved using Reports
Builder.
DESFORMAT specifies the format for the job output. In bit-mapped environments,
DESFORMAT specifies the printer driver to be used when DESTYPE is FILE. In
character-mode environments, it specifies the characteristics of the printer named in
DESNAME.

......................................................................................................................................................
7-16 Oracle9i Reports Developer: Build Reports
Generating Output
.....................................................................................................................................................

Generating Output
Testing a Web Report
To preview your Web report in a browser:
1 Use the Run Web Layout button on the horizontal toolbar.
2 Select Program > Run Web Layout

Publishing a Web Report


To run a report from a browser, use a URL syntax. You can give your users the URL
syntax needed to make the report request from their browser, or you can add the URL
syntax to a Web site as a hyperlink. You will learn about URL syntax in a later lesson.
Another way to publish a report on a Web site is to create an Oracle9iAS Portal
component. The Oracle9iAS Portal component enables you to add a link to a report in
an Oracle9iAS Portal page or portlet, or to output report results directly into a portlet.

Technical Note
More information on publishing Web reports is covered in the eClass Oracle9i Reports
Services: Deploy Internet Reports. Also see the manual Oracle9iAS Application
Server: Publish Reports to the Web with Oracle9iAS Reports Services.
More information on using Oracle9iAS Portal for administering and publishing
reports is covered in the eClass Oracle9i Reports: Create Reports for the Web and
Portals.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-17
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Create a Web report using the Report Wizard and a
predefined HTML template
• Identify and describe standard and Reports custom
JSP tags
• Use the Run Web Layout feature to test Web
deployment

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
7-18 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Creating Web Reports
You can use a predefined HTML template and the Report Wizard to easily create Web
reports. As an alternative, you can develop an HTML page with your favorite Web
authoring tool and add dynamic content to the Web page using Reports Builder.

JSP Technology
Oracle9i Reports enables you to create JSP reports for Web deployment. A set of
Reports custom JSP tags facilitates easy Reports JSP development.The Web Source
view of the Report Editor allows you to edit the JSP source code. Because JSPs are
text files, you can also use a text editor and edit not only the static HTML portion of
your Reports JSP, but the dynamic portion as well.

Previewing Web Reports


Use the Run Web Layout feature in Reports Builder to test your Web report in a
browser.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-19
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Practice 7 Overview

• Creating Web reports using the Report Wizard


• Examining the Web source code
• Modifying a Web report using the Report Wizard

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
7-20 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 7
.....................................................................................................................................................

Practice Session Overview: Lesson 7


This practice session contains:
• Creating reports for the Web using the Report Wizard
• Examining the Web source code
• Modifying a Web report using the Report Wizard

Introduction:
In this practice session, you create simple reports for the Web using the Report
Wizard. You also examine the Web source code to identify specific JSP tags.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 7-21
Lesson 7: Creating a Web Report
.....................................................................................................................................................

Practice Session: Lesson 7


1 Create a tabular report, Web and paper layout, entitled Compensation Report. The
report should contain the following data:
SELECT d.department_name, e.first_name, e.last_name,
e.job_id, e.salary
FROM departments d, employees e
WHERE d.department_id = e.department_id
a Display all fields. Select the predefined Blue template. Do not make any
changes to the other Wizard pages.
b Run the Web layout to test.
c Examine the Web source. How many <rw:foreach> tags are in the code? Why
this number?
d Modify the report using the Report Wizard. Make this a Group Left break
report displaying employing information grouped by department. Include a
sum for salary.
e Examine the Web source again. Now how many <rw:foreach> tags are in the
code?
f Which JSP tag identifies the overall appearance and formatting of the data in
the Web report?
g Which JSP tag delimits the data model and layout information? Can you view
this information in the Reports Builder?
h Run the Web layout to test. Save the report as p7q1.jsp.
2 Create a report for the Web that displays current product information.
a Use the Report Wizard to create a new tabular report called Our Products.
Include the following data from the PRODUCT_INFORMATION table:
Column Label
product_id Product No.
product_name Name
product_description Description
catalog_url Catalog URL

Sort the output by product number.


b Select the predefined Beige template.
c Run the Web layout to test.
d Save the report as p7q2.jsp.

......................................................................................................................................................
7-22 Oracle9i Reports Developer: Build Reports
8
................................

Enhancing Reports
Using the Data Model:
Queries and Groups
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Describe the Data Model objects
• Modify query properties
• Modify the report hierarchy
• Change the order of data in a group
• Eliminate data from a report

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 40 minutes
Practice 20 minutes
Total 60 minutes

......................................................................................................................................................
8-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
You have learned to create simple, single-query paper and Web reports using Reports
Builder.
In this lesson, you learn about the Data Model structure and objects, how to modify
SQL queries created with the Report Wizard, and how to enhance reports by creating
additional groups to achieve more complex report structures.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the Data Model objects and their relationship
• Modify query properties
• Modify the report hierarchy by creating additional groups
• Change the order of data in a group
• Eliminate data from the report using a group filter

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-3
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

The Data Model Objects

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Open a report definition that contains a tabular report (l8demo1.jsp).
In the Object Navigator, show the Data Model node, including parameter nodes.
Show the Data Model and briefly describe the query, group, and columns that the
Report Wizard created.
Open a Group Left or Group Above report (example: l4above.jsp) and show the
additional groups in the Data Model editor. Explain the hierarchy.
Explain how to modify the existing query and create the extra group using the Data
Model instead of the Report Wizard. Obviously, if you can use the Report Wizard, it is
the simplest method, but sometimes, especially in more complex reports, you need to
be able to modify the Data Model. Oracle9i Reports has a Data Wizard that enables
you to modify multiple query reports more easily.

......................................................................................................................................................
8-4 Oracle9i Reports Developer: Build Reports
Describing the Report Data Model
.....................................................................................................................................................

Describing the Report Data Model


Introduction
The Data Model defines the report data and its hierarchy—that is, the report structure.
The Data Model does not define any formatting attributes for the report output. This
section introduces you to the objects in the Data Model and their appearance in the
Data Model editor.

The Data Model Objects


The Data Model consists of the objects listed below.
Object Description
Query You can create a report with one or more queries. The Report
Wizard creates a single-query report. Use the query tool or the
Data Wizard to create additional queries.
Group Each group is owned by a query. By default, Oracle9i Reports
creates one group for each query.
Column Columns are owned by the group to which they belong. By default,
the group contains one column for each select expression in the
query.
Link Links join a parent group to a child group. You can create links to
form a relationship between groups from different queries. Links
are never created by default.
Parameter Parameters are owned by the report. You can create parameters that
allow users to enter value restrictions at run time. Oracle9i Reports
also provides a number of system parameters by default.

What Does the Report Wizard Create?


The objects that the Report Wizard creates by default depend on the style of report that
you choose.
• Tabular style: One query, one group
• Group Above, Group Left: One query, two or more groups
The number of group objects depends on the number of break groups you define in the
Report Wizard.
The Report Wizard creates only one query.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-5
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Modifying Properties of a Query

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Use l8demo1.jsp.
With Data Model open, double-click Q_1 to open the SQL Query Statement dialog
box. Type E.FIRST_NAME before D.DEPARTMENT_NAME. Click OK to close the
Query dialog box and show how the FIRST_NAME column is added to the top of the
group, not in the same position as in the statement. All new columns are added as the
first column in the group.
Edit the statement again. Concatenate FIRST_NAME||’ ’||LAST_NAME and add an
alias EMPLOYEE.
Show EMPLOYEE at the top of the group. Point out the use of the meaningful column
alias. Drag this column down above JOB_ID.
Also point out that if the query contains duplicate column names, Reports Builder
appends a number to make the report column name unique. You can use column
aliases to give these columns more meaningful names.

......................................................................................................................................................
8-6 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Query
.....................................................................................................................................................

Modifying Properties of a Query


Introduction
You can modify a query, including the SQL statement, by changing properties in the
query Property Inspector.

Editing the SQL Query Statement


To edit the query statement, open the Property Inspector, choose the SQL Query
Statement property, and click the left button.
The SQL Query Statement dialog box appears.
You can also use the Data Wizard to make changes to the query. The Data Wizard is
covered in a later lesson.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-7
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................
M

Modifying Properties of a Query

• Modify SQL query statement:


– Add, rename, or delete columns
– Use column and table aliases
– Remove or modify schema name
• Syntax error checks occur when:
– Exiting SQL query statement
– Compiling or executing a report

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
8-8 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Query
.....................................................................................................................................................

Editing the SQL Query Statement (continued)

Modifying Columns If you add to, rename, or delete a column or expression in the
query statement, Oracle9i Reports automatically creates, revises, or deletes the
corresponding column in the Data Model.

Using Column and Table Aliases Remember that you can use aliases against the
database columns and tables in the query. Report Builder uses your column aliases to
create the relevant report column names. Table aliases help your query access the
database and return data as quickly as possible. Aliases therefore provide:
• Fast database access and return of data
• Shorter, more meaningful names for query expressions, such as Employee and
Annual_Salary as in this example:
SELECT d.department_id, d.department_name, e.job_id,
e.first_name ||’ ‘||e.last_name Employee,
e.salary*12 Annual_Salary
FROM employees e, departments d
WHERE e.department_id = d.department_id

Dealing with Error Messages


Oracle9i Reports checks the syntax when you try to leave the SQL Query Statement
dialog box and whenever you generate or execute the report.
If Oracle9i Reports detects an error, it displays the error in an alert.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-9
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

More Properties

Aid maintenance and testing:


• Rename queries in complex reports
• Add comments to describe queries:
– Use the Comment property
– -- comment for single lines
– /*comment*/ for multiple lines
• Set Maximum Rows to Fetch
to restrict data

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Continue demonstration:
Rename the query Q_EMP. Note that this does not rename the group.
Add a comment to the query. Show each method, either in the Comment property or
the Query statement, but recommend that the students use one or other, not both.
Run the report with no other changes. In the Paper Design view, LAST_NAME
appears crossed out because you altered the query and there is no longer a
LAST_NAME column. This is the original layout based on the previous Data Model,
so you must update the layout (on the next page).

......................................................................................................................................................
8-10 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Query
.....................................................................................................................................................

Renaming Queries
It is recommended that you rename queries in a complex report to make the Data
Model easy to understand.
Renaming a query does not automatically rename the group below it.

Commenting Your Queries


Use the Comment property to enter meaningful text that describes the query.
You can also insert comment lines directly in the SQL Query Statement area, using the
Oracle standard comment delimiters:
• --comment for a single line
• /*comment*/ for multiple lines
Note: For ease of maintenance, do not enter comments in different places for the same
query.

Restricting Rows
Set the Maximum Rows property to restrict the rows returned from a query. This is
useful for testing your report against a large data source.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-11
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Applying Changes

Update the paper layout and Web source to reflect


changes in the Data Model.
• For paper reports:
– Select Report Wizard.
– Alter the necessary tabbed pages.
The Wizard destroys previous layout and creates new
objects.
• For Web reports:
– Select the Report Wizard and navigate through each of
the tabbed pages, reselecting the desired options.
or
– Edit the Web source manually.

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Select the Report Wizard from the menu.
Go to the Fields tab and select all fields. Click Finish. Show the Employee field in the
Paper Design view.
The Report Wizard removes all existing layout objects and re-creates the layout with
new information from the Data Model.

......................................................................................................................................................
8-12 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Query
.....................................................................................................................................................

Updating the Layout


When you alter the Data Model, you must update your layout to see the changes.
For paper reports, select Tools > Report Wizard from the menu, and alter the tabs to
create a new layout with additional groups and columns.
For Web reports, reentering the Report Wizard will delete the layout that was
previously created. A new Web layout will be created based upon the selections you
make on each of the tab pages in the Wizard. You can also manually edit the Web
layout using the Web Source view of the Report Editor. You will learn more about this
in a later lesson.
Note: If you edit a query statement to alter any columns that are part of an existing
layout, and run the report without re-creating the layout, the Source property becomes
null, and the field in the previewer appears with a large cross.

Instructor Note
When you reenter the Report Wizard for a Web report, Oracle9i Reports deletes the
entire Web layout even though it appears that the previous selections are still in tact. If
you do reenter the Wizard to modify a Web report, you will have to navigate through
each of the tab pages and reselect the desired options on each page.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-13
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Groups

Groups determine hierarchy and frequency.


• Wizard creates default groups.
– Default naming conventions
– You can change query name.
– You can change group name.
• Developer-created groups for:
– Control break reports
– Complex matrix reports

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
In the Data Model, show how to rename the group G_EMP.
Double-click the group bar to display the Property Inspector.
Also show that you can change the name in the Object Navigator.

......................................................................................................................................................
8-14 Oracle9i Reports Developer: Build Reports
Changing the Group Structure
.....................................................................................................................................................

Changing the Group Structure


Introduction
Groups organize your data into sets of records and, in a hierarchy, determine the
frequency at which records in that group appear in the output. Each group contains
columns that Reports Builder assigns to the group by default, or that you specifically
assign.

Changing the Group Name


If you change a query name after the group has been created, the group name does not
change automatically.
There are two ways you can change the group name:
• Open the group Property Inspector and change the Name property.
• In the Object Navigator, select the node representing the group and then select the
group name again. This removes the highlight and changes the cursor to an I-beam.
Edit the group name. The next time you activate the Data Model editor, the new
group name is visible.
Note: If you create a Web layout and change the name of a group, the Web Source will
not reflect the change. You will get an error when you select Run Web Layout: “Cannot
create cursor for group <original_group_name>”. To update the Web Source, edit the
Web Source code, locate the rw:foreach tag for that group, and modify the
corresponding source (src) attribute.
Example: You create a Web layout using the Report Wizard and the default group name
is G_LAST_NAME. You change the name to G_EMP in the Property Inspector. Now do
the following:
1 Display the Web Source view of the Report Editor.
2 Locate <rw:foreach id="R_G_last_name_1"
src="G_last_name">.
3 Change the value of src to G_emp:
<rw:foreach id="R_G_last_name_1"
src="G_emp">

Developer-Created Groups
Sometimes you do not want to modify existing Data Model objects in the Report
Wizard; for example, during later maintenance. In this case, you might need to create
your own groups in the Data Model to perform the following actions:
• Produce control break (nested) reports
• Produce complex matrix reports

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-15
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Group Hierarchy

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Drag columns up or left to 2 Drag columns down or right to


create a parent group. create a child group.

Instructor Note
Demonstration:
Use [Shift]-click to select and drag DEPARTMENT_ID and DEPARTMENT_NAME
up out of G_EMP to create a new group. Rename it G_DEPT.
Select Report Wizard from the toolbar to update the layout. Select the Group Above
style. Show the Group tab. DEPARTMENT_ID and DEPARTMENT_NAME are
selected because you dragged them into the new group. You can modify the group
fields at any time by reentering the Report Wizard.
Reports Builder updates the Wizard information based on the changes you make in the
Data Model. Reports Builder also updates the Data Model with any changes that you
make in the reentrant wizards.
The default position of the objects in the Paper Design view depends on the query,
group, and column positions in the Data Model.

......................................................................................................................................................
8-16 Oracle9i Reports Developer: Build Reports
The Group Hierarchy
.....................................................................................................................................................

The Group Hierarchy


Introduction
The groups in Oracle9i Reports exist in a hierarchy. You can alter the group hierarchy
by creating new groups.
As you have already seen, a single query produces one default group. You can produce
a control break report structure by creating one or more additional groups above the
default. The following example of a single query, called Q_EMP, is the basis for the
hierarchical report.
SELECT e.first_name, e.last_name, e.job_id,
d.department_id, d.department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id

Creating a New Group


Select DEPARTMENT_ID and drag it out of and above the default group to create a
break group. Change the group name to make it more meaningful.
You can drag other columns, such as DEPARTMENT_NAME, into the new group.
Alternatively, move more than one column into a new group by using [Shift]-click to
select the columns before dragging them all together.
Note: You can also drag columns down a hierarchy, from a higher group into a new or
existing lower-level group. The order in which the groups exist in the Data Model has
an effect on the output. Always make sure that your parent (master) group is first and
the child (detail) group is second.

One-Level Limit
When you drag a column to create a new group, the new group is only one level above
or below the column’s original group in the hierarchy.
To create a group more than one level from the original group, follow these steps:
1 Move the column to the level immediately above or below the required position of
the new group.
2 Drag the column out to create the new group at the next level.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-17
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Ordering Data in a Group

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Break group controls primary sort; use the Break Order property
2 Order by DEPARTMENT_NAME column: Break Order =
Descending
3 Child group controls final sort; uses ORDER BY clause in the
query

Instructor Note
Demonstration:
Edit the query Q_EMP. Order by E.SALARY.
Run the report and show that the order of departments remains the same (ascending
numeric order of DEPARTMENT_ID); it is only each individual list of employees that
is sorted by salary within the department.
In the Data Model, show the two arrowheads beside DEPARTMENT_ID and
DEPARTMENT_NAME. Drag DEPARTMENT_NAME above DEPARTMENT_ID.
Do not update the layout; you still want DEPARTMENT_ID to be the first field on the
left.
Run the report. Show the different order; ascending alphabetical order of department
name. The break order for the first column takes precedence over the other columns,
from top to bottom in the group.
Open the Property Inspector for DEPARTMENT_ID (department number). Remove
the break (Break Order = None). Run the report. It sorts by DEPARTMENT_NAME
ascending.
Open the Property Inspector for DEPARTMENT_NAME and change the break to
Descending.

......................................................................................................................................................
8-18 Oracle9i Reports Developer: Build Reports
Ordering Data in a Group Hierarchy
.....................................................................................................................................................

Ordering Data in a Group Hierarchy


Introduction
Break groups that you create in a hierarchical report display data in a default order.
You can modify this default.

Break Order
Break order controls the break structure and the order in which to display the column’s
values. It is denoted by a solid arrowhead to the left of the column. For column values
in user-created groups, you must use the Break Order property to specify how to order
the break column’s values. The order of precedence depends on the order of columns,
from the top down, in the group.

Reversing the Break Order


To reverse the break order, double-click the column in the group to open up the
column Property Inspector. Change the break order from ascending to descending
using the pop-up list. In the Data Model, the arrowhead is displayed in reverse.
Note: All break groups must have at least one column with Break Order set.

Break Order in Break Groups


Remove unnecessary break columns in each break group to improve the performance
of your report. A break group is any group other than the lowest group of each query.
If several columns are all unique, such as the DEPARTMENT_ID and
DEPARTMENT_NAME columns, having break order set on both columns can
sometimes cause unnecessary sorting.
1 Open the DEPARTMENT_NAME column Property Inspector.
2 Alter Break Order to None.
3 Repeat for each column that is not part of the sort.

Break Order in Lower Groups


The Break Order property has no effect on columns in the lowest group of each query.
Modify the ORDER BY clause in the SQL query statement to control this group.
Removing the Break Order property from columns in this lowest group is optional and
has no effect on the output.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-19
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Query Modifications

In a break report, data order is determined by:


• Break order columns in the break groups
• Columns that you specify in the ORDER BY clause

SELECT d.department_id, d.department_name,


e.last_name...
FROM employees e, departments d
WHERE e.department_id = d.department_id
ORDER BY 2, e.salary

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The Break Order property uses the positional column number (2) instead of the
column name to build the ORDER BY clause at run time. Reports Builder uses this
notation to allow for the use of aliases in the SELECT clause, which was invalid
syntax for an ORDER BY clause in previous database releases.
It is not recommended that students use this notation when they explicitly write their
own ORDER BY clauses in their SQL queries.
If you want to see the SQL query that Reports Builder sends to the server at run time,
create a trace file using the Program > Tracing option. Specify a filename, including
pathname if you want. Select Execution of SQL and any other options you require.
This is the only way to see the ORDER BY clause that Reports Builder builds
dynamically at run time.

......................................................................................................................................................
8-20 Oracle9i Reports Developer: Build Reports
Ordering Data in a Group Hierarchy
.....................................................................................................................................................

Reports Query Modifications


The examples below show how the ORDER BY clause is modified.
For each database column with the Break Order property set, Oracle9i Reports
appends an ORDER BY clause to the query or modifies the existing ORDER BY
clause.
The break columns always take precedence over the lowest group columns. For
example, suppose that your report contains the following query:
SELECT d.department_id, d.department_name, e.last_name,
e.salary
FROM employees e, departments d
WHERE e.department_id = d.department_id
ORDER BY e.salary
If you create a break group containing DEPARTMENT_ID and
DEPARTMENT_NAME, but with DEPARTMENT_NAME as the only break column,
then at run time your query becomes:
SELECT d.department_id, d.department_name, e.last_name,
e.salary
FROM employees e, departments d
WHERE e.department_id = d.department_id
ORDER BY 2, e.salary

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-21
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Filtering Data in a Group

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: In the same report, restrict G_DEPT to the first two records.

Using a Packaged Filter

Reports Developer provides two packaged filters:


• First: Retrieves the first <n> records for the group
• Last: Retrieves the last <n> records for the group

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
8-22 Oracle9i Reports Developer: Build Reports
Filtering Data in a Group
.....................................................................................................................................................

Filtering Data in a Group


Introduction
A group filter allows you to control the processing of records in each group. This
section briefly describes the two types of filters available and how to use a packaged
filter to restrict the number of records returned.

Two Types of Group Filters


• A packaged filter allows you to restrict processing to a predetermined number of
records.
• A developer-created filter allows you to control processing dependent on
conditional PL/SQL code.
Note: Developer-created filters are covered in more detail later in the course.

Identifying an Active Filter In the Data Model editor, the circle above the group
object changes to green when a filter is active.

Using a Packaged Filter


A packaged filter allows you to specify the number of records that you wish to retrieve
in a group. You can use this to restrict the data while developing your reports.

The Two Packaged Filters


• The First filter retrieves the first <n> records for the group.
• The Last filter retrieves the last <n> records for the group.

How to Apply a Packaged Filter


1 Double-click the group title bar, or its icon in the Object Navigator, to display the
Property Inspector.
2 Change Filter Type to First or Last.
The Number of Records property appears.
3 Enter the number of records you require.

How Is Data Fetched in a Packaged Filter?


• First filter: Oracle9i Reports retrieves a multiple of the array size, sufficient to
satisfy the filter, based on a parameter value at run time.
• Last filter: Oracle9i Reports must retrieve all records to establish which are last.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-23
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Identify Data Model objects
• Modify query properties
• Modify the report hierarchy by creating additional
groups
• Filter data in a group

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
8-24 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Queries
A report performs well only if the SQL code that accesses the database is efficient.
Write well-constructed SELECT statements.
You can restrict the rows returned by a query using the Maximum Rows property. This
is useful for testing purposes.

Groups
Organize data into sets of records, to establish hierarchical reports to any depth and
width.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-25
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Practice 8: Overview

• Modifying report hierarchy


• Restricting records in a query
• Restricting records with a packaged filter

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
8-26 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 8
.....................................................................................................................................................

Practice Session Overview: Lesson 8


This practice session contains:
• Modifying report hierarchy by creating additional groups
• Restricting records in a query
• Restricting records with a packaged filter

Introduction
In this practice session, you modify an existing tabular report and create a break
report. Using two different techniques, you restrict the records in a report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 8-27
Lesson 8: Enhancing Reports Using the Data Model: Queries and Groups
.....................................................................................................................................................

Practice Session: Lesson 8


1 Open report p8q1_a.jsp, a tabular report showing customer information.
aRun the paper layout.
b In the Data Model view, create a break group using NLS_TERRITORY as the
break column. Rename the group G_COUNTRY.
c Reenter the Report Wizard to update the layout. Select the Group Left style.
Ensure that all fields are displayed.
d Save the report as p8q1.jsp. Do not close the report.
2 Modify the previous report to restrict the number of customer records processed by
the group.
a Place a filter on the G_CUSTOMER_ID group to display only the first ten
customers. Run to test.
b Save the report as p8q2.jsp and close it.
3 Modify p8q1.jsp to restrict the report to customers who have a credit limit
greater than 1500. You need to modify the query properties.
a Include CREDIT_LIMIT in the query statement, although you do not need to
display it. Restrict the query statement to show those customers who have a
credit limit greater than 1500.
b Save the report as p8q3.jsp and run the Web layout.

......................................................................................................................................................
8-28 Oracle9i Reports Developer: Build Reports
9
................................

Enhancing Reports Using the


Data Model: Data Sources
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Describe the various data source types
• Create reports using pluggable data sources
• Create supplemental rows of data by adding queries
• Reuse PL/SQL code to create a REF cursor
• Link data from multiple data sources using a data
link

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 40 minutes
Practice 40 minutes
Total 80 minutes

......................................................................................................................................................
9-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
To keep pace with today’s demand for information, you need to be able to access all
available data. You often need to access data from your corporate internal data sources
as well as data sources outside your corporation.
In this lesson, you learn about the different data source types that can be used for a
report. You will learn how to access data using the Pluggable Data Source (PDS)
feature in Oracle9i Reports and how to combine data from multiple sources to publish
meaningful information.

Objectives
After completing his lesson, you should be able to do the following:
• Describe the various data source types
• Create reports using pluggable data sources
• Create supplemental rows of data by adding queries
• Reuse PL/SQL code to create a REF cursor
• Link data from multiple data sources using a data link

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-3
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Data Source Types

Access data from a variety of sources:


• SQL-based
• Non SQL-based
• OLAP
• JDBC
• Metadata
• BC4J

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
With the implementation of PDSs, ODBC drivers are no longer supported in Oracle9i
Reports. The JDBC option can utilize the JDBC-ODBC bridge to allow access to other
data sources.

......................................................................................................................................................
9-4 Oracle9i Reports Developer: Build Reports
The Data Source Types
.....................................................................................................................................................

The Data Source Types


Introduction
With Oracle9i Reports, you can publish data from any data source, and even combine
data from one or more of these data sources in a single report.
For example, today e-businesses use XML as a means of data interchange. Imagine a
business-to-business scenario where a wholesaler’s inventory is available to a supplier
through XML. The supplier wants to see what products to ship to his customer, but
obviously, he can only ship those products he has in stock himself. This data is stored
in his internal relational database. Using Oracle9i Reports, you can create a report
merging the XML data and the relational data in real-time and display the results in a
Web page. The merge, or join, returns only the items the wholesaler needs and the
supplier has in stock.
In another scenario, you may need to combine data from a relational database with
data from a multidimensional database to compare trends and performance.
With Oracle9i Reports, you can access, combine, and publish any data.

Data Source Types


The information you need to publish is often derived from various data sources. These
data sources may be:
• SQL-based: relational databases like Oracle9i
• Non SQL-based: data, such as XML, that has been generated from outside the
corporation
• Online Analytical Processing (OLAP): multidimensional databases that store
decision support data, such as Oracle Express
• Java Database Connectivity (JDBC): other relational data sources such as SQL
Server, Sybase, or another Oracle database
• Metadata from another system
• Data in flat files

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-5
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Pluggable Data Sources

Your
Text
data Express XML JDBC
files
source

Oracle9i
Reports
Client Oracle9i

Copyright © Oracle Corporation, 2002. All rights reserved.

Out-of-the-Box Options

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
9-6 Oracle9i Reports Developer: Build Reports
Pluggable Data Sources
.....................................................................................................................................................

Pluggable Data Sources


Introduction
A pluggable data source, or PDS, is a new feature in Oracle9i Reports that enables
data input from numerous sources through the implementation of design time and
runtime Java application program interfaces (APIs). Reports Builder provides
interface definition, which acts as a translator between Reports Builder and the data
source by redefining the Builder’s requests in terms of the specific data source.
The PDS feature also enables you to leverage various capabilities in Oracle9i Reports
such as aggregation, summarization, formatting, and scheduling not only on data that
is accessed through SQL, but on data from any data source.

Data Sources at Design Time


In addition to traditional data sources such as SQL, PL/SQL, and Express, Oracle9i
Reports provides you with pluggable data sources supporting:
• XML data streams, both online and from a file
• JDBC connections
• Text files
The design time API makes it possible to open the appropriate editor to modify your
query: Query Builder is the interface to edit a relational query, while a text editor or
XML editor would be used to edit an XML data source query.
You can also write your own data source mechanism. If your business works with a
specific file and/or data format that you want to make available for reporting, you can
create a PDS for this particular format and incorporate it into Reports Builder to access
your own unique data source.

Technical Note
More information on defining pluggable data sources is covered in the course
Oracle9i Reports Developer New Features: Creating Pluggable Data Sources.

Instructor Note
Oracle9i OLAP Services as a PDS will not ship with 9.0.2 but should be available as a
download from OTN sometime after production. Express and Oracle9i OLAP
Services are two distinct options serving a similar purpose. The Express Query option
enables you to connect to an Express server, while the OLAP Services PDS allows you
to access the Oracle9i OLAP services, which are part of the Oracle9i database (version
9.2). Connectivity is provided to enable current Express users to connect to both
OLAP data sources. It is recommended that these users eventually migrate their data to
the OLAP Services in the Oracle9i database.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-7
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Using XML as a Data Source

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: Begin this demonstration after introducing the concepts on the facing
page. The scenario for this demonstration is provided for the students on the pages
following.
Create a new report using XML as the data source.
• Layout type: Create both Web and Paper Layout
• Style: Tabular
• Data source: XML Query
• Data: select Query Definition
– Data Definition: Use the Browse button to locate increase.dtd
– Data Source: Use the Browse button to locate salary.xml
• Fields: display all fields
• Select Finish

......................................................................................................................................................
9-8 Oracle9i Reports Developer: Build Reports
Using XML as a Data Source
.....................................................................................................................................................

Using XML as a Data Source


Introduction
XML enables business-to-business exchanges of data across applications and
platforms.

What Is XML?
Extensible Markup Language, or XML, is an open standard for describing data and is
used for defining data elements on a Web page and business-to-business documents.
XML uses tags, similar to the tags used in HTML. However, while HTML is primarily
used for formatting and displaying text and images in a browser, XML is used for
structuring data. XML enables the exchange of data between applications in a simple,
non proprietary format.

How to Define an XML Query


1 Select XML Query on the Query Type page of the Report Wizard.
2 On the Data page, select Edit Query. The Define XML Query dialog box displays.
Specify information about your XML query:
– Data Definition: The data definition file is a list of elements contained in an
XML document that is used to validate the XML document. You can specify a
Document Type Definition file (DTD) or an XML schema file (XSD). A DTD
supports character data only, while an XSD supports other data types.
– Data Source: This is the location of the XML data stream that you want to use
in your report. It is often referred to as an XML document.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-9
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Example: XML Data Stream

<TABLE>
<ROW>
<EMPID>100</EMPID>
<BONUS>2000</BONUS>
<PERINC>8</PERINC>
</ROW>
<ROW>
<EMPID>101</EMPID>
<BONUS>1000</BONUS>
<PERINC>5</PERINC>
</ROW>
.
.
.

Copyright © Oracle Corporation, 2002. All rights reserved.

XML Report

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
9-10 Oracle9i Reports Developer: Build Reports
XML Example
.....................................................................................................................................................

XML Example
Introduction
The Human Resource (HR) department is preparing for quarterly bonuses. Each
manager has submitted a percent increase for the employees in his group. HR has
compiled a list of employee ID numbers, the bonus amount, and the associated
percentage. You are preparing the Employee Compensation report and eventually need
to merge the data from HR with the employee data stored in the corporate database.

The Data
In our example, the data provided by HR is stored in the file system in an XML
document. An XML data stream can also be accessed remotely through a URL. A
subset of the data stream from HR follows. In this example, the employee with ID 100
is receiving a $2000 bonus, which is 8% of his compensation.
<ROW>
<EMPID>100</EMPID>
<BONUS>2000</BONUS>
<PERINC>8</PERINC>
</ROW>

The Document Type Definition


The DTD defines the structure of the data in the XML document. Like the XML
document, the DTD can be stored locally or remotely. For our example, the DTD
contains this definition:
<!ELEMENT TABLE (*ROW)>
<!ELEMENT ROW (EMPID?, BONUS?, PERINC?)>
<!ELEMENT EMPID (#PCDATA)>
<!ELEMENT BONUS (#PCDATA)>
<!ELEMENT PERINC(#PCDATA)>
It indicates that the XML document contains three data elements, EMPID, BONUS,
and PERINC. The content specification, #PCDATA, specifies that an element contains
only parsed character data, that is, ordinary text.

The XML Report


The output for the report is a simple tabular report.
Note: All the data is of type character; trying to format BONUS or PERINC
numerically in the Paper Design view will have no effect.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-11
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Adding New Data

1
4 2
5 3
6

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: Continue with the HR example. Add a SQL query to the data model.
• Select the SQL Query tool in the Data Model and click in the painter area.
• Define the query as
SELECT TO_CHAR(EMPLOYEE_ID), FIRST_NAME ||’ ‘||
LAST_NAME Employee, SALARY
FROM EMPLOYEES
In a later demonstration, you will link the data from the SQL query with the data from
the XML data source, basing the link on EMPLOYEE_ID. Because the DTD contains
only character data, you need to convert the EMPLOYEE_ID to the same data type.
Remind students that the layout must be updated when the data model changes. For
Web and paper reports, use the Report Wizard to update the layout. As an alernative
method for Web reports, use the Web Source view of the Report Editor and select
Insert > Report Block to update the Web layout.
• Reenter the Report Wizard. On the Groups and Fields tab pages, select the group
and columns, respectively, from the SQL query for display in the report.
• Run the Web layout. Point out that the data from both sources displays in the
output as two separate reports.

......................................................................................................................................................
9-12 Oracle9i Reports Developer: Build Reports
Adding New Data
.....................................................................................................................................................

Adding New Data


Introduction
For many standard reports, one query is sufficient. However, reports sometimes
require multiple queries. This section describes how to add data to your report by
creating additional queries, either by using the Data Wizard or by creating the query
manually.

How to Create a New Query Using the Data Wizard


1 In the Data Model view of the Report Editor, right mouse click and select Data
Wizard from the pop-up menu.
2 Name the query as required.
3 Select the Query type.
4 Enter the query as you would using the Report Wizard. For SQL queries, you can
create the query in one of three ways:
– Enter the syntax of a valid SELECT statement.
– Select Query Builder and build the query.
– Select Import Query and select a .sql file.
5 Create additional groups as required.
6 Create totals as required.

Creating a New Query Manually


To define an additional data source manually, open the Data Model view of the Report
Editor, select the appropriate tool in the vertical toolbar, and click in the Data Model
painter area to create a new query. Tools are provided for SQL Query, XML Query,
Ref Cursor Query, JDBC Query, Text Query, and Express Server Query.
A Query object appears and the corresponding editor opens. Create the query
statement as in the Data Wizard.
Note: If you have registered your own pluggable data source in Oracle9i Reports, a
tool is added to the toolbar for that data source. Use it as you would any of the standard
tools.

Default Groups
Each query that you create in the Data Model creates at least one group. Reports
Builder creates a unique group name by appending the first column name in the group,
G_employee_id, G_department_id, and so on.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-13
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

REF Cursor Queries

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Reports Builder has the ability to base a query on a REF cursor and the ability to use a
stored program unit to implement a REF cursor query.
Demonstration: Create a new report manually and save it as l9ref.jsp.
1 Create a local Package Spec named RefCurPack with the following type
definition: TYPE EmpCurType IS REF CURSOR RETURN
employees%rowtype;

If asked, explain that the package can also be part of an external PL/SQL library or
a stored program unit.
2 In the Data Model, create a ref cursor query using the PL/SQL Query tool.
3 Use the code in l9ref.txt. This creates the function.
The function associates the ref cursor variable with a query that must match the
type of the ref cursor declared in the package. There is a later demonstration that
shows how to associate the cursor variable with different queries to give you more
flexibility.
4 Explain that the group and the columns created are the same as those created from
a SQL query.
5 Use the Report Wizard to create a layout.
6 Run the Web layout. Save the report as l9ref.jsp. Close the report.

......................................................................................................................................................
9-14 Oracle9i Reports Developer: Build Reports
Using REF Cursor Queries
.....................................................................................................................................................

Using REF Cursor Queries


Introduction
A REF cursor query uses PL/SQL to fetch data. Each REF cursor query is associated
with a PL/SQL function that returns a REF cursor. The function must ensure that the
REF cursor is opened and associated with a SELECT statement that has a SELECT list
that matches the type of the REF cursor.

How to Create a REF Cursor Query


1 Create a package that defines a REF cursor type.
PACKAGE RefCurPack IS
TYPE EmpCurType IS REF CURSOR RETURN
employees%ROWTYPE;
END;
Note: The package can be a local program unit, part of a PL/SQL library, or a
stored program unit.
2 In the Data Model view of the Report Editor, select the Ref Cursor Query tool and
click in the Data Model painter area.
3 In the PL/SQL editor, enter the PL/SQL function that opens a cursor and returns a
cursor variable of the REF cursor type you defined in the package.
FUNCTION QR_1RefCurDS return RefCurPack.EmpCurType
is
V_EmpCur RefCurPack.EmpCurType;
BEGIN
OPEN V_EmpCur FOR SELECT * FROM employees;
RETURN V_EmpCur;
END;
4 Refine the query properties as desired.
5 Define break groups as required using the Data Wizard.

Reference
For further information on REF cursors, see: Reports Builder Online Help: Concepts
and Tasks > What Are... > Programmable Objects > About REF Cursor Queries.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-15
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Viewing Output from Multiple Query


Reports

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Use the HR demonstration to show how the position of the queries and groups in the
Data Model, determines the order in which unrelated records appear in the output.

......................................................................................................................................................
9-16 Oracle9i Reports Developer: Build Reports
Using REF Cursor Queries
.....................................................................................................................................................

Viewing Output from Multiple Query Reports


When you reenter the Report Wizard and update the paper layout based on multiple
queries in the Data Model, the order in which unrelated groups of records appear in the
output depends on the position of queries and groups in the Data Model.
It is the position of the group that determines the processing, not the query.
This is also the case for Web reports. You update the data model using the Data
Wizard, and then update the layout using the Web Source view. Unrelated groups of
records are processed in the order in which they appear in the Web Source.

Example
In the report opposite, the G_ORG group appears to the right of the hierarchical model
of G_DEPT and its related child group G_FIRST_NAME; therefore, the department
and employee records are formatted in the output before the department location
records.
The output shows a master-detail listing of departments and employees. After all
departments have been processed, a tabular list of departments appears.
If you want to output the department information first, move Q_DEPT and G_ORG to
the left of, or below, G_DEPT. G_FIRST_NAME is always related directly to
G_DEPT because the two groups are owned by the same query.
Remember to reenter the Report Wizard to update the layout after you modify the Data
Model.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-17
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Using Data Links

Equijoin
DEPARTMENTS

Department_Id Department_Name

90 Executive
EMPLOYEES
100 Finance
Last_Name Department_Id

DeHaan 90

Department_Id =
Greenberg 100
Department_Id
Faviet 100

Copyright © Oracle Corporation, 2002. All rights reserved.

Using Data Links

• Compound join:
– Multicolumn primary or foreign key
– Define multiple equijoins
• Nonequijoin:
– Primary key value between two other values
– Create two links:

employees.salary >= job_grades.lowest_sal


employees.salary <= job_grades.highest_sal

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
9-18 Oracle9i Reports Developer: Build Reports
Using Data Links to Structure Data
.....................................................................................................................................................

Using Data Links to Structure Data


Introduction
A data link defines a relationship between a group and a query, or between two data
sources in the data model. In Oracle9i Reports, you can combine data from one or
more data sources in the same report.
For SQL-based data sources, the data link defines a parent/child relationship by way of
a primary key and foreign key. The parent/child relationship causes the child query to
be executed for each instance (record) of the parent group, retrieving only rows that
match the conditions specified in the link.
For non SQL-based data sources, a data link defines a relationship between two data
sources that share a common data element.

Primary and Foreign Keys


A data link often corresponds to a primary/foreign key relationship between the
underlying database tables. The common SQL term for this is a join.

Defining Equijoins
Create a single link to define an equijoin.
An equijoin is a join condition where one value is equal to another.
...WHERE departments.department_id =
employees.department_id

Compound Keys
You can define multiple equijoins between the same group and query to implement a
compound primary/foreign key relationship—that is, a key that consists of more than
one column.

Defining Nonequijoins
Create two links to define a nonequijoin.
A nonequijoin is a condition where one value falls between a range of two other
values.
...WHERE employees.salary BETWEEN job_grades.lowest_sal
AND job_grades.highest_sal
In this example, you define links for two separate expressions:
employees.salary >= job_grades.lowest_sal
employees.salary <= job_grades.highest_sal

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-19
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Creating a Column-to-Column Link

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: Continue with the HR example. Create a data link between the data
sources, based on the employee ID.
1 In the Data Model view of the Report Editor, select the Data Link tool.
2 Click on EMPLOYEE_ID in the SQL query and drag the link to EMPID in the
XML query.
To complete this report, a formula column needs to be created in the XML group to
compute the new salary for each employee. The completed report is
l9xml_HR.jsp. Show the students the PL/SQL code that populates this column and
tell them they will learn about formula columns in the next lesson. Run the completed
report.

......................................................................................................................................................
9-20 Oracle9i Reports Developer: Build Reports
Using Data Links to Structure Data
.....................................................................................................................................................

Non SQL-Based Data Sources


As you have learned, Oracle9i Reports permits multiple queries in a single report and
each query can be based on a different data source. You can create a data link to merge
compatible data between any of the data sources. The links do not have to be between
data sources of the same type, but the data elements that define the link must be of the
same datatype.

How to Create a Column-to-Column Data Link


Use the Link tool to create a link between two columns.
1 In the Data Model editor, select the Link tool.
2 For SQL-based data sources, click the primary key column of the parent group and
drag a link to the foreign key column of the child query.
Note: Always create a link from the parent query to the child query.
For non SQL-based data sources, click the column in one data source and drag a
link to the same column in the other data source.

Modifying the Link Definition


Open the Property Inspector using the right mouse button or double-click the link
object in the Data Model or Object Navigator. You can modify the SQL Clause and
Condition properties; both have lists of values.
• Change the SQL Clause property from the default WHERE to HAVING or START
WITH.
• Change the Condition to any logical operator in the list, such as >= or <=.
The other properties are read-only. If you want to change the parent or child
properties, you must delete and re-create the link.

A Multiple-Query Linked Report


Assume the following two queries within a report.
Query: Q_EMP:
SELECT d.department_id, d.department_name,
e.last_name, e.job_id, e.salary
FROM employees e, departments d
WHERE e.department_id = d.department_id
Query: Q_JOB:
SELECT department_id, job_id,
count(employee_id) count_names
FROM employees
GROUP BY department_id, job_id
You need to link them to display job information for each department instead of one
separate list at the end. The link in the Data Model is from the
Q_EMP:DEPARTMENT_ID column to the G_JOB:DEPARTMENT_ID column.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-21
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Other Data Link Methods

Other methods of forming a link:


• Manual: Using a WHERE clause to form the link
(SQL queries + column objects)
• Manual: Using parameters to form the link (REF
cursor queries)
• Automatic: Using primary/foreign key constraints to
form the link (SQL queries)

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration: Use report l9reflk.rdf. The report contains all the PL/SQL
program units and the REF cursor query.
1 Explain the CurPack specification.
2 Explain the CurPack body.
3 Go to the Data Model.
4 Create a link between G_DEPT and G_LAST_NAME.
5 Open QR_1 and explain that the actual linking is done through the two parameters.

......................................................................................................................................................
9-22 Oracle9i Reports Developer: Build Reports
Using Data Links to Structure Data
.....................................................................................................................................................

Other Data Link Methods


There are two other types of data links that you can create:
• Manual group to group link
• Automatic query to query link

Creating a Manual Group-to-Group Link


A manual group-to-group link is a link between two group objects, not between
specific columns. The link does not define a join condition.
1 Select the Link tool.
2 Click on the parent group and drag it to the child group.
3 Edit the child query to include your own join condition, if applicable.
Note: Because the manual link does not define a join between specific columns, you
cannot modify the link definition in the Property Inspector.

Example Assume a simple example of a master query Q_DEPT and child query
Q_EMP. In Q_EMP, add the join condition:
...WHERE employees.department_id =:department_id
Note: “:department_id” is a bind reference to the primary key column in the master
query, Q_DEPT.

Why Create a Manual Link?


Create a manual link for the following reasons:
• Define a complex join condition in a query
• Implement a Cartesian product, linking two tables without a join condition
• Link a query that contains objects columns or REF columns
• Link a REF cursor query using parameters in the REF Cursor query function

Creating an Automatic Query-to-Query Link


An automatic query-to-query link is a link between two query objects that
automatically defines a join condition if the relevant primary/foreign key constraints
exist in the database for columns in the queries.
1 Select the Link tool.
2 Click on the parent query and drag it to the child query.
An error appears if no relevant constraints exist that match the columns in the master
and child queries. You must include the primary/foreign key columns in your queries.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-23
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Efficiency Implication of Multiple- or


Single-Query Hierarchy

• Outer joins
• Data ratio
• Multitier environment

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
You can use l9outer.jsp to demonstrate a full outer join. The report displays
departments without employees, and there is one employee without a department. The
SQL query uses the FULL OUTER JOIN syntax available in Oracle9i.

......................................................................................................................................................
9-24 Oracle9i Reports Developer: Build Reports
Efficiency Issues: Multiple- or Single-Query Hierarchy
.....................................................................................................................................................

Efficiency Issues: Multiple- or Single-Query Hierarchy


Introduction
You can create the department/employee group hierarchy with two queries instead of
one. If you link these two queries, the data structure is the same as the single-query
example; that is, a two-level, master-detail hierarchy.
Because you can build a similar report structure using a single-query or a multiple-
query data model, your choice depends partly on your report requirements—that is,
whether you require an outer join report, and on the ratio of master to detail records in
your data tables.

Outer Joins
Consider whether you want to display all master records, regardless of any existing
details (outer join), or only those master records that have related details.
You can add the outer join notation (+) to a single query, but if you require many or
complex outer joins, consider using multiple queries that fetch all records in the master
query even if there are no records in the detail query.

Data Ratio
Consider the likely ratio of master to detail rows. As a general guide, use a single
query for many master records with relatively few details.
If your data contains relatively few masters with many details each, however, consider
using two queries with a link. This means that you retrieve the columns for each
master record only once (in the master query) instead of repeating the master columns
for every detail row in a single query.

Multi-tier Environment
A multi-tier environment is a strong argument for reducing the number of queries on
the database to a minimum. Multiple queries for a hierarchical report result in far
greater network traffic in order to fetch records from each query separately.
Note: You can use SQL*Trace to analyze your report; for example, see how much
time it is taking to retrieve data from the database. You will learn more about
analyzing and tuning your report in a later lesson.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-25
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Publish data from any source using the Pluggable
Data Source feature
• Add additional queries using the Data Wizard
• Publish a report with data returned from a REF
cursor query
• Create a relationship between data in different
queries using a data link
• Design the data model to be most efficient

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
9-26 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Pluggable Data Sources
WIth Oracle9i Reports, it is possible to publish data from any data source. Oracle9i
Reports provides the support for SQL, Express, XML, JDBC, and text queries. You
can also write your own pluggable data source. With pluggable data sources, it is
possible to maintain multiple concurrent connections to different data sources.

Adding Additional Queries


You can use the Data Wizard to add additional queries to the data model. You need to
update your paper or Web layout to see changes in your report.

REF Cursor Queries


Publish data returned from a REF cursor query by associating the query in your data
model with a PL/SQL function that returns a REF cursor.

Data Links
Create a link between two queries, either manually or automatically. In Oracle9i
Reports, you can create links to merge data between data sources that are of different
types.

Efficiency
Consider outer joins, data ratios, and network traffic when designing your reports and
planning the number of queries.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-27
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Practice 9 Overview

• Creating a second query in an existing report


• Creating a data link
• Creating a report using a pluggable data source
• Creating a report containing a REF cursor query

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
9-28 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 9
.....................................................................................................................................................

Practice Session Overview: Lesson 9


This practice session contains:
• Creating a second query in an existing report
• Creating a data link
• Creating a report using a pluggable data source
• Creating a report containing a REF cursor query

Introduction
In this practice session, you include new data in a report by adding a query to an
existing single-query report using the Data Wizard. You also practice linking data
from different queries to alter the report structure. You will create a new report using
the XML pluggable data source and a SQL query.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-29
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

Practice Session: Lesson 9


1 Open p8q1_a.jsp.
In the Data Model, create the following query:
a
QUERY: Q_ORDERS
select customer_id, order_id, to_char(order_date,
'dd-Mon-yyyy') order_date,
order_total
from orders
b Change the name of the group to G_ORDERS.
c Open the Report Wizard, create both a Web and paper layout, and select a
Tabular style.
d Copy group G_ORDERS to the Displayed Groups area.
e Copy all remaining fields to the Displayed Fields area.
f Select a template and click Finish.
g Note how the data appears in the Paper Design view. The G_CUSTOMER_ID
data appears before the G_ORDERS data. Remember that you can alter the
order in which the data isdisplayed by modifying the query order in the Data
Model. You may want to try that.
Note: If you do adjust the order of the queries, put them back in the original
order and save before the next question.
h Save the report as p9q1.jsp.
2 Continue with the same report.
a In the Data Model, link the two queries together on the primary and foreign
keys.
Hint: To create the link, select the Link tool. Click and drag from the primary key
field in the Customer_Id group to the foreign key field in the Orders group.
b Redo the layout by opening the Report Wizard. Select the Group Above style.
Do not display CUSTOMER_ID.
c Save the report as p9q2.jsp.
d Run the Web layout.

......................................................................................................................................................
9-30 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 9
.....................................................................................................................................................

3 Create a new report that lists the sales representatives and the products they have
sold.
a Create both a Web and paper layout and select a Group Above report style.
b Import the query file p9q3_a.sql.
c Make NAME and EMPLOYEE_ID the group fields. Make sure that these
fields are in one group, at Level 1, and not two separate groups.
d Do not display EMPLOYEE_ID, but display all other fields in the order
described in the table below.
Hint: You can change the order of fields in the Report Wizard in the Displayed
Fields text region.
e Change the following field attributes:
Column Label Width
name Name 20
product Product 16
product_id ID 4
quantity Quantity 4
prod_total Total 9

f Use the predefined Gray template.


g Click Finish to run your paper layout.
h Now you need to show not only which products the sales representatives have
sold but also who are the customers they have done business with.
Go to the Data Model and add a new query, importing the file p9q3_b.sql.
This query returns the customer names, their IDs, and the total sales per
customer for each sales representative.
i Ensure that the group is named G_CUSTOMER.
j Link the second query to the correct group.
k Use the Report Wizard to display the new group. Do not display
SALES_REP_ID or EMPLOYEE_ID.
l Change the following field attributes:
Column Label Width
customer Customer 20
customer_id ID 2
cust_total Total 9

m Save the report as p9q3.jsp.


n Run the Web layout.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 9-31
Lesson 9: Enhancing Reports Using the Data Model: Data Sources
.....................................................................................................................................................

4 An international business has warehouses around the world. The database at


corporate headquarters maintains information about each of the warehouses
(warehouse id, name, city, country, and so forth). However, each warehouse stores
it operational data locally in a relational database. A planning team at headquarters
needs to access this inventory data for every warehouse. The warehouse data is
only available as an XML stream.
Create a report that combines general data stored in headquarters with the
inventory data from each warehouse location.
a Create a new report manually.
b In the Data Model view, create a SQL query. Import the SQL query
p9q4.sql.
c Create an XML Query. For the Data Definition, locate the file
warehouse_inventory.xsd. For the Data Source, locate the file
warehouse_inventory.xml.
d Link the two data sources together so that your report will provide a general
description of each warehouse along with the specific inventory for each
location.
e Create both a Web and paper layout for this report. Select the Group Above
style. Ensure that both groups are selected and display all fields. Use the Blue
template for this report.
f Save the report as p9q4.jsp.
g Run the Web layout.
5 Create a new report using a REF cursor query.
a In the Object Navigator, create a local package called RefCur defining a record
and a REF cursor. The record has the following fields:
Name Definition
last_name employees.last_name%type
first_name employees.first_name%type
salary employees.salary%type

bIn the Data Model, create a REF Cursor Query. The function opens the cursor
for the following SELECT statement:
SELECT last_name, first_name, salary
FROM employees
Note: The code is provided for you in the p9q5b.txt file.
c Open the Report Wizard to create the layout for the tabular report. Select all
the fields and choose a template. Click Finish to run the paper layout.
d Save the report as p9q5.jsp and close it.
If you still have any objects open in the Object Navigator, close them all.

......................................................................................................................................................
9-32 Oracle9i Reports Developer: Build Reports
10
................................

Enhancing Reports
Using the Data Model:
Creating Columns
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Describe various Data Model columns
• Display the contents of a file
• Identify characteristics of user-defined columns
• Create report summaries and subtotals
• Derive data using a formula column
• Create and populate a placeholder

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 50 minutes
Practice 45 minutes
Total 95 minutes

......................................................................................................................................................
10-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
When you define a query to extract the data from the database or from another data
source and modify the group structure, you might want to modify the Data Model
further to perform complex calculations not included in your query.
In this lesson, you learn more about the Data Model objects and how to enhance
reports by creating user-defined columns for summaries and calculations.

Objectives
After completing his lesson, you should be able to do the following:
• Describe the different types of Data Model columns
• Display the contents of a file by using a data source column
• Identify the characteristics of the three types of user-defined columns
• Create report summaries and subtotals by using summary columns
• Derive data using a formula column
• Create and populate a placeholder column

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-3
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Data Model Columns

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Data source columns 4 Placeholder column


2 Summary column 5 Summary column at report
level
3 Formula column

......................................................................................................................................................
10-4 Oracle9i Reports Developer: Build Reports
The Data Model Column Types
.....................................................................................................................................................

The Data Model Column Types


Introduction
A Data Model column is a data container. A column defines the type of data, but does
not include any formatting information relating to the report output.

The Column Types


There are two main types of columns: those that Reports Builder creates from your
data source definition and those that you create yourself.
• Data source columns: Reports Builder creates one column for each item in the data
source query or definition. Data source columns are directly associated with a
column or expression retrieved from the data source as specified by the data source
definition. You cannot modify most properties of a data source column.
• Developer-created columns: You can create columns, either in a specific group or
at report level.

Developer-Created Columns
A developer-created column can be one of three types:
• Summary column: Summarizes another column and can recalculate for each
record in a specified group
• Formula column: Uses a formula you have written in PL/SQL to calculate a value
from one or more other columns
• Placeholder column: Has its value set from another object at run time

Default Column Names


Each column that you create in the Data Model has an initial default name, which you
should change to a descriptive name.
Column Type Default Name
Summary CS_1
Formula CF_1
Placeholder CP_1

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-5
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Maintaining Data Source Columns

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Read-only properties

......................................................................................................................................................
10-6 Oracle9i Reports Developer: Build Reports
Maintaining Data Source Columns
.....................................................................................................................................................

Maintaining Data Source Columns


Introduction
Because Reports Builder creates data source columns from the contents of the query
statement, there are some restrictions on how you can modify these columns.

Displaying a Column Property Inspector


To display a column’s Property Inspector, as for other report objects, you can use one
of several methods:
• Double-click the Column icon in the Object Navigator.
• Double-click the column in the Data Model.
• Select the column and use the right-mouse-button menu.
• Select the column and use the Tools menu.

Editing Data Source Column Properties


For data source columns, some of the property settings are not editable in the Property
Inspector. You can see the values, but you cannot modify them. These values are
dependent on the column name and type in the data source definition.
The read-only properties are:
• Name
• Column Type
• Data type
• Width
All editable properties, except Value if Null, provide a list of values.
Some properties may or may not appear in the Property Inspector, depending on the
column datatype or on the value of another property.
Note: The column types Database - Object and Database - Ref refer to object columns
and reference columns in Oracle9i. Their properties should not be changed.

Deleting a Database Column


You cannot delete a data source column object directly from the group. To delete a
column, you must remove the corresponding expression from the data source
definition. For database columns, you must edit the SELECT statement in the query.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-7
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Producing File Content Output

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
10-8 Oracle9i Reports Developer: Build Reports
Using a Data Source Column to Output Contents of a File
.....................................................................................................................................................

Using a Data Source Column to Output Contents of a File


Introduction
You can include in your report the contents of a file for which the filename varies for
each record retrieved. The file can contain an image—for example, the picture of each
employee or of each product, as shown opposite.

What Is a File Column?


A file column is a data source column that contains the name of an operating system
file or a URL. The file can be text, image, or multimedia.
The Read from File property does not exist in the Property Inspector unless the
column is of the Database - Scalar type and has a data type of Character.

What File Formats Can You Output?


Reports Builder provides a list of values for the file type: Text, Image, CGM, and
Image URL.
Note: Text is the only valid format in character mode reports. Video and sound
formats are no longer supported in Oracle9i Reports. Refer to the Oracle9i Reports
Statement of Direction on the Oracle Technology Network (http://otn.oracle.com) for
more information.

How to Create a File Column


1 Open the column Property Inspector.
2 Set Read from File to Yes.
3 Select the appropriate file format from the list of valid types.

What Does the Report Wizard Create?


The Report Wizard creates a field for a file column and provides a default size for the
displayed field. However, you can resize it either in the Paper Design or the Paper
Layout.

File Search
For portability, do not prefix the full path to the filename in the column. If you do not
prefix a path, Reports Builder can use its file path search order to find the file.
Include the correct paths in the environment variable REPORTS_PATH.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-9
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Creating a Column

Summary column
• What type of value?
Choose the correct column Formula column
tool
Placeholder column

• What frequency? C_xxx


C_xxx
Create in a group or
at report level
C_xxx

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Describe the three column types briefly at this stage.
The following pages contain a definition and explanation of each, followed by some
example reports that demonstrate how to use each of the column types correctly.
The first example is a simplification of the Highest Earner report from a previous
course, and uses all three types together. The other examples demonstrate the various
property settings for Summary columns.

......................................................................................................................................................
10-10 Oracle9i Reports Developer: Build Reports
Creating a Column
.....................................................................................................................................................

Creating a Column
Introduction
There are two important questions to ask yourself before you create a column:
• What type of column do I require? The answer determines which one of the three
tools to select.
• How often do I want this column to be displayed? The frequency at which the
column value appears in the output determines the group in which you create the
column.

How to Create a Column


1 Select the appropriate tool from the toolbar in the Data Model editor. Click inside a
group to create the column at the same frequency as other columns in that group.
Note: To display the column once for the report, click in an open area of the Data
Model editor.
2 Double-click the column to display its Property Inspector.
3 Replace the default column number with a brief but descriptive name. Consider
standard naming conventions for different types of columns.
4 Fill in the rest of the settings as appropriate for the type of column you require.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-11
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Summary Column

• Specific properties:
– Function
– Source
– Reset At
– Compute At
• Data type depends on Source data type
• Page summaries: Not supported in the wizard

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
10-12 Oracle9i Reports Developer: Build Reports
Creating Summary Columns
.....................................................................................................................................................

Creating Summary Columns


Introduction
A summary column performs a computation on another column’s data.

Summary Column Properties


The following properties apply specifically to summary columns:
• Function: The calculation to be performed on the values of the column specified in
Source.
• Source: The name of the column whose values are to be summarized. Source is a
list of values containing those columns that are valid for the specified Function.
• Reset At: Τhe group at which the summary column value resets to zero.
• Compute At: The group for which a % of Total summary column is computed.
Compute At is used only for columns with a function of % of Total.

Summary Datatypes
The datatype of a summary column depends on the data type of the source of the
summary. If you change the data type of the source column, the datatype of the
summary also changes.

Page Summaries
The Report Wizard does not support page summaries. If you select a page summary in
the Field tab of the Report Wizard, an error message appears. Cleaar the page
summary from the Field tabbed page and create the field manually in the Paper
Layout. Creating fields in the Paper Layout is described later in the course.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-13
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Displaying Subtotals
Reset At:
G_DEPARTMENT_ID Report

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Department totals
2 Report total

Instructor Note
Demonstration: L10SUM.RDF.

......................................................................................................................................................
10-14 Oracle9i Reports Developer: Build Reports
Example Report Displaying Subtotals
.....................................................................................................................................................

Example Report Displaying Subtotals


Introduction
The control break report output shows two summary columns created by the Report
Wizard. One summary shows the total salary for each department, and the other shows
the total salary for the whole report.
The wizard creates these summaries at one or more levels above the salary source
column.

Resetting Summary Values


The Reset At property defines the group at which a summary resets to zero to enable
you to recalculate a number of subtotals.
The wizard chooses a default reset value for these summaries.
• The department total in G_DEPARTMENT_ID is reset at
G_DEPARTMENT_ID—that is, values start from zero for each new department
record.
• The report total at report level is reset at Report.
To create an accumulating total for the department total, change the Reset At property
to Report.

Valid Reset Options


The Reset At property displays only options that are valid for each summary.
There are two options, Report and Page, that are valid for all summaries. Depending
on the level of the summary, some groups are also available in the valid list.

Outputting Summary Values


The frequency at which the summary value is displayed depends on the group within
which you create the column.

Rule
To create your own summaries, use the following rule:
Discrete Total: Reset At value is the same as the summary group.
Accumulating Total: Reset At value is a higher group than the summary.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-15
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Displaying Percentages
Reset At: G_EMP G_EMP
Compute At: G_DEPT Report

Copyright © Oracle Corporation, 2002. All rights reserved.


0

1 Department total percentage


2 Employee total percentage

......................................................................................................................................................
10-16 Oracle9i Reports Developer: Build Reports
Example Report Displaying Percentages
.....................................................................................................................................................

Example Report Displaying Percentages


Introduction
The control break report shows the following two percentage totals created by the
Report Wizard:
• Employee’s salary as an individual percentage
Notice that this is a column in the G_EMP group. This is the only summary
function for which the wizard creates a column in the same group as its source.
• Department total as a percentage of the report total

Resetting Percentages
The Reset At property works the same way that the Sum function does. The default,
Reset At G_EMP, results in a discrete value for each employee.
For both summaries opposite, the Reset At property is G_EMP. Both percentages reset
to zero for each employee record. If you want to create a running percentage that
eventually accumulates to 100%, change the Reset At property to reset at a higher
level than its source column. For example, to create an accumulating percentage that
accumulates for each department and then resets to zero, change Reset At to G_DEPT.

The Compute At Property


The Compute At setting defines the total value that a % of Total summary uses in the
percentage calculation. This property is only applicable to % of Total summaries.
The wizard sets the Compute At property to one group above the source column. In the
left example opposite, the default is G_DEPT. To display the salary as a percentage of
the whole report value, change Compute At to Report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-17
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Resetting Summary Values

Reset At
Data Model
Group REPORT G_DEPT G_EMP

REPORT Grand Total XXXX XXXX

G_DEPT Running Total Sub Total XXXX

G_EMP Running Total Running Total Record Total

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
10-18 Oracle9i Reports Developer: Build Reports
Example Report Displaying Percentages
.....................................................................................................................................................

Resetting Summary Values


The Data Model group defines how often a value is calculated. Therefore, Reports
Builder does not allow you to reset a calculated value at a lower level of the hierarchy;
that is, you cannot reset a value more often than you calculate it.

Valid Group and Reset Options


The table shown identifies which combinations of group and reset options are valid.
The XXXX denotes invalid combinations.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-19
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Formula Column

• Performs a user-defined computation


• Executes a PL/SQL function
• Must return a value
• Can be Character, Number, or Date
• Returned value must match data type

function CF_SALCALCFormula return Number is


begin
return(my_function(:salary));
end;

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
10-20 Oracle9i Reports Developer: Build Reports
Creating Formula Columns
.....................................................................................................................................................

Creating Formula Columns


Introduction
A formula column performs a user-defined computation on the data of one or more
other columns.
The PL/SQL Formula property button opens the Program Unit editor where you enter
and edit your code.

Code in a Formula Column


The formula is a PL/SQL function that returns a single value. It must return a value of
the same type as specified in the data type property. The following code is a simple
example that calls another function, passing the :salary value as an argument, and
returns the result in the SALCOMM formula column.
function salcomm return number is
begin
return(my_function (:salary));
end;

Rule
Any columns referenced by the formula column are calculated first.

A Note on Efficiency
The code above is a simple example to illustrate the syntax. The MY_FUNCTION
function might be a local program unit at report level, a program unit in an attached
PL/SQL library, or a stored program unit.
Consider using a formula column only if you cannot include your calculation in the
query statement. It is always advisable to perform calculations on the server instead of
on the client.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-21
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Placeholder Column

• An empty container at
design time
CP_xxx • Populated by another
object at run time
– Before Report trigger
– Formula column at report
level
– Formula column in same
group or below
CF_xxx placeholder

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Stress that you must code the PL/SQL (to populate the placeholder) in another object,
not the placeholder column itself.
If students ask for more details about the PL/SQL Formula property:
A placeholder column cannot populate itself; therefore, you write the formula in a
Formula column (or trigger), not in the placeholder.
The only time you need the Formula property in a placeholder is if you populate the
placeholder from a user exit that you call in the other object.
In that case, Reports Builder cannot resolve possible dependencies that might be in the
user exit, so you must call SRW.REFERENCE() in the placeholder itself to declare
explicitly any column values on which the placeholder depends. (The SRW package is
discussed later in the course.)

......................................................................................................................................................
10-22 Oracle9i Reports Developer: Build Reports
Creating Placeholder Columns
.....................................................................................................................................................

Creating Placeholder Columns


Introduction
A placeholder column is an empty container at design time. The placeholder can hold
a value at run time that has been calculated and placed into it by PL/SQL code from
another object.

Setting the Value of a Placeholder Column


You can set the value of a placeholder column in the following places:
• A Before Report trigger
• A report-level formula column (if the placeholder column is at report level)
• A formula column in the placeholder group or a group below it

Uses of Placeholder Columns


• Using placeholder columns, you can populate multiple columns from one piece of
code. You can calculate several values in one block of PL/SQL code in a formula
column and assign each value to a different placeholder column. Thus, you create
and maintain only one program unit instead of many.
• Store a temporary value for future reference. For example, store the current
maximum salary as records are retrieved.

The Placeholder’s PL/SQL Formula Property


You cannot populate a placeholder by writing code in the placeholder’s own Formula
property.
The PL/SQL Formula button opens up the Program Unit editor where you enter and
edit your code. This is applicable only when you call a user exit.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-23
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Populating a Placeholder Column

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Demonstration:
Open the L10PLACE.RDF report. The report is prebuilt, because this is not an easy
demonstration to create from scratch and display neatly and quickly, especially
because the students have not seen the Paper Layout yet.
Show the report output in the Paper Design and explain the aim of the report. Point out
that this layout is not totally achievable in the Paper Design.
Then show the Data Model. Explain each of the three columns and show the properties
for each.
Remember to show the PL/SQL Formula for the formula column and explain the code.
The first block of code is a simple example. It returns only one employee. To allow for
multiple employees who earn the maximum salary, the code must test for an existing
string in the placeholder and concatenate with the current name.

......................................................................................................................................................
10-24 Oracle9i Reports Developer: Build Reports
Example Report to Populate a Placeholder
.....................................................................................................................................................

Example Report to Populate a Placeholder


Introduction
The sample report shown is a report of all employees. The aim of the report is to:
• Calculate and temporarily store the name of the employee who earns the highest
salary in the company
• Display the highest earner and the maximum salary once at the beginning of the
report

The Columns
You need to create the following columns:
• A summary to show the maximum salary for the company
• A placeholder to contain the highest earner’s name at run time
• A formula to:
– Compare each employee salary with the maximum salary
– Populate the placeholder with the employee name if salary equals maximum
salary

How to Create the Columns


1 Create a summary column CS_MAX_SALARY at report level (outside all
groups). Data type: Number; Width: 10; Function: Maximum; Source: Salary;
Reset At: Report
2 Create a placeholder column CP_MAX_EARNER at report level (outside all
groups). Data type: Character; Width: 80
3 Create a formula column CF_CALC_MAX in the G_EMP group. Data type:
Number; Width: 10 (these are the default values)
4 Open the Program Unit editor from the PL/SQL Formula property in
CF_CALC_MAX. Create a function:
function CF_CALC_MAXFormula return Number is
begin
if :salary = :CS_MAX_SALARY then
:CP_MAX_EARNER := (:LAST_NAME||’ in
Department ’||:DEPARTMENT_ID||’--’
||:DEPARTMENT_NAME);
end if;
return(0);
end;

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-25
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Identify column types and their uses
• Create Summary columns
• Define valid summary levels in a report
• Specify column properties based on required
output:
– Reset At: Resets to zero
– Compute At: % of Total only
• Create Formula columns to return values
• Create Placeholder columns to hold values

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
10-26 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Column Types
• A data source column exists for each column or expression in the query or data
definition.
• Create summary columns for computations and summaries.
• Create formula columns to perform a calculation or to populate a placeholder
column.
• Create a placeholder column to provide an empty container that is populated from
another object at run time.

Summary Levels
• Report
• Page (not supported by the Report Wizard)
• Groups within the report

Reset At
The level at which to reset the summary back to zero

Compute At
Valid only for summary columns with a function of % of Total

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-27
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Practice 10 Overview

• Creating a new report with summaries


• Adding summary calculations to an existing report
• Creating a new report with ranking summary
columns
• Adding placeholders for highest and lowest values

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
10-28 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 10
.....................................................................................................................................................

Practice Session Overview: Lesson 10


This practice session contains:
• Creating a new report with summaries
• Opening an existing report to add summary calculations to the columns
• Creating a new report with ranking summary columns
• Opening an existing report to add placeholders for the highest and lowest values in
the report

Introduction
In your reports, you might need to include additional columns with summary
functions—or even add summaries, such as break totals and report totals. This practice
provides the opportunity for you to create summaries and additional columns with
functionality that cannot be achieved using SQL alone.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-29
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

Practice Session: Lesson 10


1 Create a new report using the Report Wizard. Create both a Web and paper layout
and select a Group Above report style.
a Display the following data:
Table Column Definition Group Label Width
orders order_id G_order_ Ord. No. 4
id
order_date dd-Mon-yyyy Order Date 10
order_items line_item_id G_line_ No. 2
item_id
product_id Product No. 5
unit_price Price 4
quantity Quantity 4
line_total unit_price*quantity Total 4

Hint: Read through all the steps of this exercise before creating your report.
You can use Query Builder to define the initial query for this report. You can
then manually edit the query to modify the display of order_date using the
TO_CHAR function: TO_CHAR(order_date, ‘dd-Mon-yyyy’).
b Do you need a formula column to calculate the line_total?
c Create the following summaries. Can you use the Report Wizard to create the
summaries?
Column Summary
line_total sum
line_total % Total

d Use the Gray template file from the file system.


e In the Data Model, alter the position of columns in the G_ORDER_ID group
so that ORDER_DATE is above ORDER_ID, and change the break order on
ORDER_DATE so that it is sorted in descending order.
f Run both the paper and Web layouts to test the report (do not reenter the
Wizard).
g Save the report as p10q1.rdf and close it.

......................................................................................................................................................
10-30 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 10
.....................................................................................................................................................

2 Open the p9q3.jsp report .


Create columns to show the percentage of the total per sales representative for
a
PROD_TOTAL and CUST_TOTAL.
b Update the layout. Make all the new summaries four characters wide.
c Save the report as p10q2.jsp.
d Run the Web layout.
3 Create a new report to list employees by department ranked by their salaries.
Create both a Web and paper layout and select the Group Left report style. You can
import the query from p10q3.sql.
a Display the following data.
Table Column Label Width
departments department_name Department 10
employees employee_id ID 2
first_name First Name 6
last_name Last Name 6
salary Salary 8

Include a summary of the salary column in the report.


b Use the Beige template and finish the Wizard.
c Modify the report to list employees by salary, beginning with the highest paid
in each department.
d To display the ranking, add a column call RANK in the group
G_EMPLOYEE_ID.
e Use the Report Wizard to display the rank, giving it a width of 2.
f Run the paper layout to test.
g Save the report as p10q3.rdf.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 10-31
Lesson 10: Enhancing Reports Using the Data Model: Creating Columns
.....................................................................................................................................................

4 Open the p10q1.rdf report to display the highest and lowest orders at the end of
the report.
a In the Data Model, add the columns necessary to list the maximum order total
and the corresponding ORDER_ID, as well as the minimum order total and the
corresponding ORDER_ID.
Hint: You need one formula column and two summaries and two placeholders.
You can copy the code for the formula column from the file p10q4.txt.
b Use the Report Wizard to add the new columns to the layout. Display the
maximum order total, the maximum ORDER_ID, the minimum order total,
and the minimum ORDER_ID.
c Run the paper layout to test. Scroll down to the last page to see the new
columns.
d Save the report as p10q4.rdf and close it.

......................................................................................................................................................
10-32 Oracle9i Reports Developer: Build Reports
11
................................

Enhancing Reports Using


the Paper Layout
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Identify the paper report sections
• Design multipanel reports
• Distribute a report to various destinations
• Describe the layout objects and relationships
• Modify an existing paper report layout
• Create variable length lines

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 45 minutes
Practice 40 minutes
Total 85 minutes

......................................................................................................................................................
11-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
You can fulfill many of your paper report requirements simply by making
modifications in the Paper Design view. However, for more complex paper reports you
need to modify or create objects in the Paper Layout editor.
The layout can be a complex area to view and modify. This lesson aims to give you an
appreciation of the layout sections, as well as the objects that you see and create using
object tools in the toolbar.

Objectives
After completing this lesson, you should be able to do the following:
• Distinguish the different sections of a report
• Design multipanel reports
• Apply report bursting
• Describe the layout objects and their relationships
• Modify an existing report layout using the Paper Layout tools
• Separate report data using variable length lines

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-3
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Viewing the Sections

Header Compensation
section Report

Page 1 of 1
Main
section

Trailer End of report


section

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The report l11layout.rdf has data in all three sections. Make sure to show this.

......................................................................................................................................................
11-4 Oracle9i Reports Developer: Build Reports
Viewing the Paper Layout
.....................................................................................................................................................

Viewing the Paper Layout


Introduction
The Report Editor Paper Layout view enables you to define and modify the layout
objects for a paper report. Layout objects define the report’s appearance and are
displayed in the Paper Layout view.

The Paper Layout Sections


The Paper Layout editor allows you to modify the report layout in three sections:
header, main, and trailer. Each section has its own body and margin area. Report
sectioning allows you to define multiple layouts for the same data model, producing
output in a number of styles. For example, a single report can include an executive
summary in the header section, and a detailed breakdown in the main section.
When you enter the Paper Layout editor, you see the body region of the main section
of your report. To change the section, choose the Main Section, Header Section, or
Trailer Section tool, or choose View > Layout Section > Header, Main, or Trailer.

Header Section
The header section consists of one or more pages that appear once, on a separate set of
pages, as the first part of the report.

Main Section
By default, the Report Wizard creates the paper layout in the Main Section of a report,
positioned between the header and trailer pages.

Trailer Section
The trailer section consists of one or more pages that appear once, on a separate set of
pages, as the last part of the report.
Note: In the Object Navigator window, the three report sections are listed under the
Paper Layout node.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-5
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Viewing the Section Areas

Header Compensation Body/


section Report Margin

Page 1 of 1
Main Body/
section Margin

Trailer Body/
End of report
section Margin

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Both the header section and main section of the report l11layout.rdf use the
body and the margin area.

......................................................................................................................................................
11-6 Oracle9i Reports Developer: Build Reports
Viewing the Paper Layout
.....................................................................................................................................................

The Paper Layout Section Areas


The Paper Layout editor allows you to modify the body and margin report areas in one
of three sections at any time. This enables you to separate the formatting of margins
from the body of your report pages in any section. Each physical page consists of a
body and margin area.

Body
The body area of a section can contain text, graphics, data, computations, and
summaries.

Margin
Margins can contain text, graphics, page numbers, page totals, and grand totals.
When you choose the margin view, the body also remains visible, but read-only, in the
editor. The body appears within a black rectangle that defines the size of margin and
body. You cannot modify objects in the body while working in the margin view.

Adjusting the Margin Size


To adjust the size of the margin, choose the margin view, select the margin rectangle,
click on a select handle, and drag to resize.
Modify margins in your template definition to apply the same dimensions to many
reports, or to apply the same dimensions to several sections of the same report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-7
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Designing Multipanel Reports

Logical Page 1
Panel 1
Physical Page 1
Header Logical Page 1
Panel 2
Physical Page 2

Logical Page 1 Logical Page 1


Panel 1 Panel 2
Physical Page 3 Physical Page 4
Main
Logical Page 1 Logical Page 1
Panel 3 Panel 4
Physical Page 5 Physical Page 6

Logical Page 1
Trailer Panel 1
Physical Page 7

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
11-8 Oracle9i Reports Developer: Build Reports
Designing Multipanel Reports
.....................................................................................................................................................

Designing Multipanel Reports


Introduction
Reports Builder enables you to design large, or multipanel, report layouts by
maintaining two different definitions of a page.
• A physical page represents the actual paper page size.
• A logical page represents a conceptual page on which you can design the layout of
your report.

Logical Panels and Physical Pages


Reports Builder enables you to design multipanel reports where the logical design of
the report output is wider than the physical (printer) page. A report might need a layout
width of 16 inches that can be printed on two physical printer pages, each 8 inches
wide.
The unit of measurement is a property of the report object itself.

How to Define Dimensions for a Section of the Report


1 Select the Header Section, Main Section, or Trailer Section node in the Object
Navigator.
2 Open the Property Inspector.
3 Specify physical page size: Width and Height properties.
4 Specify logical page size: Horizontal Panels per Page/Vertical Panels per Page
properties.
Define the logical dimensions in multiples of the physical page width and height.
5 Define the page orientation as required.

Example In the diagram opposite, the layout is twice the width of the physical page.
For example, to output a logical design of 16 inches across 8-inch pages, the settings
are:
• Unit of Measurement: Inch
• Physical Page Height: 8
• Horizontal Panels per Page: 2
• Vertical Panels per Page: 1

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-9
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Printing Multipanel Reports

Page 1-1 Page 1-2

Page 2-1 Page 2-2

Logical horizontal panels = 2

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
11-10 Oracle9i Reports Developer: Build Reports
Designing Multipanel Reports
.....................................................................................................................................................

How to Print Panels


The default order in which panels are printed is across/down. That means that
horizontal panels are printed before vertical panels. To change this order, modify the
Panel Print Order property of the report object.
1 Select the report node in the Object Navigator.
2 Open the Property Inspector.
3 Specify the Panel Print Order property.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-11
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Different Objects in the Paper Layout

4
5
1
2
3

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Frame 4 Boilerplate
2 Repeating frame 5 Imported boilerplate image
3 Field 6 Graph

......................................................................................................................................................
11-12 Oracle9i Reports Developer: Build Reports
Recognizing Layout Objects
.....................................................................................................................................................

Recognizing Layout Objects


The Report Editor Paper Layout view supports a large number of different objects.
The Paper Layout objects and their properties are represented symbolically to
distinguish their types and relationships.
• Frame: This object encloses other layout objects and controls formatting,
frequency, and positioning of several objects simultaneously. Created by default or
by the developer
• Repeating Frame: This object displays rows of data that are retrieved for a group.
Created by default or by the developer
• Field: A field defines the appearance of a column’s data. It may contain character,
number, date, graphics, image, or sound data. Created by default or by the
developer
• Boilerplate: Hard-coded text or graphics that appears in a report every time it is
run. Created by default or by the developer
• External Boilerplate: Text or graphics that appears in a report every time it is run,
but read from a file. Created by the developer
• Graph: An object that allows data to be represented in a graphical way

Object Property Inspector


Every object has a property sheet. You can invoke the Property Inspector in a number
of ways:
• Double-click the object
• Highlight the object and use the right mouse button menu to choose Property
Inspector
• Highlight the object and choose Tools > Property Inspector

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-13
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Layers of a Tabular Report

F_xxx F_xxx
R_G_xxx
M_G_xxx

Body

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Make sure the students understand this important concept. Walk them through a
Tabular and Group report, highlighting the objects in the Paper Layout editor and
pointing them out in the Object Navigator as well. You can use layers.rdf to
show the different frames. This Group Above report has the Vertical and Horizontal
Gap set to 2 in order to see all the frames.
Using a different fill color for each frame helps to illustrate the layering concept.
Remind students that, as long as they create and modify reports using the Report
Wizard, they do not have to worry about the layering. The Report Wizard creates
everything correctly for them. You should also remind them that if they reenter the
Report Wizard, any modifications previously made using the Paper Design will be
lost.
If they have to modify the layout themselves, recommend that they test and save their
report frequently, in case they make a big mistake and want to return to a previous
version. Point out that the File > Revert menu option is very useful for this.

......................................................................................................................................................
11-14 Oracle9i Reports Developer: Build Reports
The Paper Layout Layers
.....................................................................................................................................................

The Paper Layout Layers


Introduction
All layout objects exist in a hierarchy. Each object is contained inside and on a layer
above another object. The hierarchy is very important in the processing of report
objects. If you destroy the correct layering, you receive error or warning messages,
and the report might not run.
The bottom layer of a paper report is effectively the page itself.

Layers of a Tabular Report


To explain the concept of layers, the exploded diagram shows the objects in a simple
tabular report. From bottom up, the layers are:
• Body
• M_G_xxx: Group frame encloses other objects and controls the format, frequency,
and position of several objects simultaneously
• R_G_xxx: Repeating frame is displayed for each row of data that is retrieved for a
group
• F_xxx: Fields define the appearance of columns; can contain character, number,
and date for each column in the data source
In addition, the tabular style creates a boilerplate text object, B_xxx, for each field
label; these objects occur outside the repeating frame, not once for each record.

Group Reports
Group Left and Group Above reports create two repeating frames; the detail group
frame is nested inside the master repeating frame to produce a detail tabular listing for
each master record.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-15
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Avoiding Layout Errors

• Confine Mode

• Flex Mode

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The slide shows:
• The effect of Confine Mode when Flex Mode is disabled; the parent enclosing
object does not flex
• The effect of Flex Mode when Confine Mode is enabled (locked); the enclosed
object cannot move outside its parent enclosing object
Flex Mode flexes in only one direction at a time, either horizontally or vertically, but
not diagonally. To flex the layout when moving diagonally, first move or resize the
object in one direction, horizontally or vertically, and then in the other direction as a
separate movement.

......................................................................................................................................................
11-16 Oracle9i Reports Developer: Build Reports
The Paper Layout Layers
.....................................................................................................................................................

Avoiding Layout Errors


To avoid common hierarchy errors in your report layout, always work in the Paper
Layout using the Confine and Flex modes.
• Confine Mode
– Work with Confine Mode enabled (on) to avoid accidently moving one object
outside or below its correct enclosing object.
– Work with Confine Mode disabled (off) when you want to move one object
outside its enclosing object.
• Flex Mode
– Work with Flex Mode enabled (on) to adjust all affected objects when you
move or resize one object; the whole layout flexes to accommodate your
changes.
– Work with Flex Mode disabled (off) when you want to move an individual
object without moving other objects.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-17
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Report Processing

BEGIN M_G_master…

REPEAT R_G_master
f_xxx f_xxx
BEGIN M_G_detail
REPEAT R_G_detail

f_xxx f_xxx f_xxx

END M_G_detail

END M_G_master

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Explain the 3GL way of understanding the report processing.
Also briefly explain the meaning of the arrowhead (repeating frame) and the diamond
(variable size).
This is a good time to make a remind students about the rw:foreach tag. In a Reports
JSP, it indicates a loop through the data source group object

......................................................................................................................................................
11-18 Oracle9i Reports Developer: Build Reports
The Paper Layout Layers
.....................................................................................................................................................

Report Processing
To understand how the Paper Layout maps to the output that you see in the Paper
Design view, consider the layout as a 3GL program, where the group frame is a
WHILE loop and the repeating frame is a block.
In a two-level group report, the report processes a master record, including all details
that relate to each master record, and then processes the next master.
BEGIN M_G_master
while M_G_master has records to process
REPEAT R_G_master
BEGIN M_G_detail
while M_G_detail has records to process
BEGIN R_G_detail
end R_G_detail;
END M_G_detail;
END R_G_master;
END M_G_master;

Layout Symbols
Layout objects often show symbols and icons that indicate their characteristics. The
diagram opposite shows two of these symbols:
• Black arrowhead: Indicates a repeating frame object
• Diamond: Indicates that the object is a variable size; it can increase or decrease in
size depending on the contents

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-19
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Creating Layout Objects

The tool palette contains:


• Standard GUI drawing tools
• Frame, repeating frame, field objects 6
• Other layout objects
1

2 7
3 8
4 9
5

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Drawing objects 6 Text


2 Frame 7 Repeating frame
3 Graph 8 Field
4 Anchor 9 File Link
5 Report Block

......................................................................................................................................................
11-20 Oracle9i Reports Developer: Build Reports
Creating Layout Objects
.....................................................................................................................................................

Creating Layout Objects


Introduction
When you create or modify your paper report using the Report Wizard, Reports
Builder automatically creates many objects, such as the frame, repeating frame, fields,
and labels for a tabular report style.
The tool palette provides tools for you to create these and other types of objects. The
tools available depend on the view currently in the Paper Layout.

Layout Object Naming Conventions


When you create a layout object, the default name is an alphabetic character that
indicates the object type, followed by a number. Rename your layout objects
meaningfully to help you in developing and maintaining the report.

Additional Layout Objects


Object Default Description
Type Name
Graph CT_ A display object that represents data as a graph, such as a pie or
bar chart
Boilerplate B_ Constant text or an image that appears in a report every time it is
run, and that is not dynamic; example: the Report Wizard creates
column labels and template objects
File Link B_ Constant text or an image that appears in a report every time it is
run, but is read from a file on disk
Anchor None A layout object that anchors the position of one object relative to
another; create an anchor to override the default position

Technical Note
The ability to embed an OLE2 object in a report is obsolete in Oracle9i Reports. While
existing applications using OLE2 objects should continue to run without modification,
this functionality can be mimicked by using mime types with associated plug-ins and
hyperlinks.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-21
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Layout Tools

• Pin a tool: Double-click

• Shift for constrained objects

• Magnify

• Frame Select

• Report Block

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
11-22 Oracle9i Reports Developer: Build Reports
The Paper Layout Tools
.....................................................................................................................................................

The Paper Layout Tools


Introduction
In addition to the object tools in the tool palette, the Paper Layout provides some
specific tools to help you modify layout objects.

Pinning a Tool
If you want to create several objects of the same type, double-click the drawing tool. A
small red pin appears on the tool icon, and the tool remains active until you click the
tool again or choose a different tool.

Drawing Constrained Objects


To create a constrained object, such as a perfect circle or square, hold down the
constrain [Shift] key when drawing the object.
To resize an object to scale, hold down the constrain key when resizing the object.

Magnifying the Layout


Select the magnify tool when you want to focus on one part of a large report. The
Magnify tool centers the layout area on the point that you choose and enlarges objects
to twice their size.
Hold down the constrain key when using the magnify tool to reduce objects by half.
There are also zoom in and zoom out buttons in the toolbar.

Selecting All Objects in a Frame


Choose the Frame Select tool and then click a frame or repeating frame in the layout.
This selects the frame and all objects inside it.

Report Block
The Report Block tool invokes the Report Block Wizard to enable you to create
additional layouts in your report without deleting existing objects, and to let you mix
multiple report styles in the same section of a report.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-23
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Report Bursting

Header à e-mail
Body à PDF
Trailer à HTML

Copyright © Oracle Corporation, 2002. All rights reserved.

Report Bursting

Dept 10
West East

Dept 20
West East

;
Dept 30
West East

Dept 40


Dept 80

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Use l11distr.rdf to show different layouts for each report section, and to
demonstrate report bursting and distribution.
This report will be used for several demonstrations in this lesson.

......................................................................................................................................................
11-24 Oracle9i Reports Developer: Build Reports
Report Bursting
.....................................................................................................................................................

Report Bursting
Introduction
The capability of producing multiple copies of a given report or portions of it in
different output formats is referred to as report bursting.
Oracle9i Reports enables you to deliver a single report to multiple destinations
simultaneously. Each of the three report sections may have a completely different
structure, page layout, page size, destination, and output format, yet be based on the
same data. At run time, each section may be selectively turned on or off to produce
multiple reports in a single run. You can also specify the desired destination at either
the report or section levels. In this way, a single report execution can produce multiple
copies of the output (or portions thereof) in different physical formats, whether it is to
a printer, e-mail, the file system, or the Web. A remote office, for example, may
require nothing but an executive summary sent by way of e-mail, while the local office
may prefer a complete physical printout, and an overseas office may want nothing but
detailed output available on the Web.
With Oracle9i Reports, you are also able to burst on repeating data within a report.
This ensures that each user only receives information that is relevant and appropriate
for them. For example, suppose you have created an employee salary report. The
manager of Department 10 will receive an e-mail with the salary information for
employees in Department 10; the manager of Department 20 will only be e-mailed the
salary information for employees in Department 20, while a summary will be printed
out for the president of the company. More importantly, the report is actually run only
once, and the output is sent to the different sets of users according to the requirements.
You only have the overhead of a single data fetch and format in order to distribute the
report. This is called one-pass reporting and is a key feature in Oracle9i Reports.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-25
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Bursting on a Repeating Group

Copyright © Oracle Corporation, 2002. All rights reserved.

Setting the Repeat On Property

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
You can use l11distr.rdf to demonstrate bursting on a repeating group. Follow
the steps on the opposite page.

......................................................................................................................................................
11-26 Oracle9i Reports Developer: Build Reports
Report Bursting
.....................................................................................................................................................

Bursting on a Repeating Group


To set up a report to burst on a repeating group, follow these steps.
1 Open your report in Reports Builder and display the Paper Layout.
2 In the Paper Layout, select the outermost repeating frame. Hint:
– You can locate and select the outermost repeating frame in the Object
Navigator.
– The repeating frame will then be selected in the Paper Layout view.
3 Delete the repeating frame in the Paper Layout.
Note: Do not delete the repeating frame in the Object Navigator as you will also
delete all the objects within the frame.
4 In the Object Navigator, select the Main Section node and invoke its Property
Inspector.
5 Set the Repeat On property by selecting the repeating group on which the report
will be burst.
You are now able to distribute the data resulting from each section as an individual
report.

Example
The group left report on the opposite page generates salary information for employees
for each department. In order to distribute the salary information to each respective
department manager, you have to set up the report to burst on the department ID
group.
1 Display the Paper Layout for the report. Select the outermost repeating frame,
R_G_DEPARTMENT_ID, in the Object Navigator.
2 Delete R_G_DEPARTMENT_ID in the Paper Layout.
3 In the Object Navigator, select the Main Section node and open its Property
Inspector.
4 Locate the Repeat On property, and select G_DEPARTMENT_ID from the drop-
down list.
The report is now set up to burst on each new value of G_DEPARTMENT_ID.
You will learn how to distribute the report shortly.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-27
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Creating an Additional Layout

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The header and trailer sections of l11distr.rdf contain layouts. Show these to the
students using the Paper Layout and the Object Navigator.
Feel free to create an additional layout in any of the report sections to demonstrate the
Report Block tool.

......................................................................................................................................................
11-28 Oracle9i Reports Developer: Build Reports
Report Bursting
.....................................................................................................................................................

Creating a Layout for a Section


Follow these steps to create a layout for the header and trailer section of your paper
report.
1 In the Report Editor Paper Layout, display the layout view for the section.
Note: To create a layout in the margin area of the section, click on the Edit Margin
button in the horizontal toolbar.
2 Select Tools > Report Wizard.
3 Step through the wizard tab pages to create the default layout.
4 To add an additional layout, use the Report Block tool.
5 Make further manual modifications as required.
6 Set the properties for the section as desired.

Using the Report Block Tool


The Report Wizard creates the initial layout for your report. You might want to create
additional parts of the layout without affecting the layout that is already there. Both
layouts use the same data; there is no need to create additional queries.
Reports Builder provides the Report Block tool, which enables you to build an
indefinite number of additional layouts based on all or part of the Data Model.

How to Create an Additional Layout


1 Select the report section.
2 Select the Report Block tool from the tool palette.
3 Drag an area in the Paper Layout defining where to place the new objects.
The Report Block Wizard opens.
4 Select the report style for the additional layout.
5 Select the group you want and the direction to print the records.
6 Complete the Wizard tabs as before.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-29
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Report Distribution

Copyright © Oracle Corporation, 2002. All rights reserved.

Report Distribution

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Using the same l11distr.rdf report, demonstrate the distribution for the sections.
Details are continued in the next Instructor Note.

......................................................................................................................................................
11-30 Oracle9i Reports Developer: Build Reports
Report Bursting
.....................................................................................................................................................

Distributing the Report


Report distribution enables you to send all or part of a report to numerous destinations,
each with different characteristics from a single run of the report. It is often necessary
to distribute a report to different media, such as paper, e-mail, Web formats, and
delimited output (e.g., Excel). Often, you are required to distribute different sections
of a single report in different formats to different groups of people.
You can create distribution lists for an entire report and for individual sections of the
report.
Distributing the report requires two steps:
1 Defining the distribution
Use the Distribution property for each section to invoke the Distribution dialog
box and set up the distribution list for that section.
or
On the command line, use the Destination keyword to specify the name of an XML
file that defines the distribution for the current run of the report.
2 Activating the distribution
From the menu, select File > Distribute.
or
On the command line, specify Distribute=YES.

For more information on the .xml file, refer to Reports Builder Online Help.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-31
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Tracing the Report Distribution

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Distribution demonstration, continued. You will generate a PDF file for each
department.
1 In the Property Inspector for the main section, invoke the Distribution dialog box.
2 Enter a Distribution ID.
3 Enter a value for DESNAME that contains a parameter for department_id. For
example: rpt&<department_id>.pdf
4 Set DESFORMAT to PDF and DESTYPE to File.
If you need it, the file l11distr2.rdf contains the bursting and distribution
settings. You will need to delete the printer destination for the Trailer section before
running the report.
If you want, you can invoke the Distribution property for the Header and Trailer
sections and specify distribution settings for these as well.
Demonstrate how to trace the report distribution.
Finally, run the report by selecting File > Distribute. Show the students the output files
in your directory. View one or two of them. Using a text editor, show them the trace
file.
Note: If asked, for complex distributions an XML file is needed; for example, the user
wants to customize the subject line or body of an e-mail. For more information, see
Reports Builder Online Help and the eClass Oracle9i Reports: Publish Any Data to
Any Destination.

......................................................................................................................................................
11-32 Oracle9i Reports Developer: Build Reports
Report Bursting
.....................................................................................................................................................

Tracing the Report Distribution


You can check a report’s distribution without actually distributing the report through
the Reports Builder Trace facility. It will state which distribution lists were used and
which section was sent to which destination.
To trace the report distribution, follow these steps:
1 From the menu, select Program > Tracing to invoke the Trace dialog box.
2 Specify a name for the trace file in the Trace File field.
3 Select the Distribution check box.
4 Click OK.
5 Run the report.
6 Use a text editor to open and view the recorded trace file.
Note: The trace file format is very similar to the .xml file format. You could cut and
paste from the trace file to create the .xml file. Trace information can only be
generated when running a .rdf file.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-33
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Flex Lines

Flex lines adjust to fit variable frames


and repeating frames.

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
You can create variable lines in the Paper Design or the Paper Layout; demonstrate in
the Paper Design and show the object in the Paper Layout also.
Demonstration: l11flex.rdf, tabular report of PRODUCT_DESCRIPTIONS,
with several translated descriptions wrapping onto more than one line.
In the Paper Design, go to page 2 or 3 and locate a description that does not wrap onto
a second line. Magnify the layout. Draw a vertical line between TRANSLATED
NAME and TRANSLATED DESCRIPTION to fill the repeating frame. Show that the
fixed line does not stretch to fill the records that wrap onto two lines. Select the line,
open the Property Inspector, and set the Line Stretch with Frame property to
R_G_product_id; the line expands for each repeating frame.
Ask: What if you want the line to fill the whole group frame including the column
headings? Answer: Create the line starting at the top of the column headings and
change Line Stretch with Frame to the group frame.
Demonstrate this example: In the Paper Design, you cannot extend the line upward,
because the layout is protected, so delete and re-create the line from the top of the
column label through the repeating frame. Set Line Stretch with Frame to
M_G_product_id_GRPFR. Alternatively, change to the Paper Layout, disable Confine
Mode, and extend the line. Remember to reenable Confine Mode.

......................................................................................................................................................
11-34 Oracle9i Reports Developer: Build Reports
Creating Variable Length Lines
.....................................................................................................................................................

Creating Variable Length Lines


Introduction
The line drawing tool enables you to draw straight vertical lines between columns of a
report. However, these lines are a fixed length, whereas the data in your report might
be variable. Reports Builder enables you to specify that a line varies in length or width
to fill a chosen frame.

Separating Vertical Columns in a Tabular Report


In the report opposite, the translated description has a variable number of characters;
sometimes the characters require a single line field, sometimes more. The field
expands vertically if necessary at run time. The repeating frame also expands to
contain the field.
If you draw a vertical line inside the repeating frame, the line is not long enough to
span the extra line of characters at run time.
• To make the line stretch to fit the repeating frame, open the Property Inspector for
the line object. Select Line Stretch with Frame and select the repeating frame you
require, such as the repeating frame, R_xxx.
• To make the line stretch to fit the group frame, draw the line from the top of the
column labels through the repeating frame. Change the property Line Stretch with
Frame to the group frame, M_xxx_GRPFR.

Paper Design Versus Paper Layout


You can create and modify a line in the Paper Design or in the Paper Layout. There are
advantages and disadvantages to both:
• Paper Design: It is easy to create a line and change the property. You can easily see
the line stretching with the data, but you cannot move the line outside its enclosing
object, because you cannot disable Confine Mode.
• Paper Layout: You can disable Confine Mode to change the position of the line,
but you cannot see the effect of Line Stretch with Frame until you view the report
in the Paper Design.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-35
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to modify


the Paper Layout using:
• Report sections
• Layout objects and tools
• Report bursting and distribution features
• Variable length lines

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
11-36 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Introduction
In this lesson, you learned to modify a paper report layout in the Paper Layout.

Modifying the Paper Layout


• There are three report sections, Header, Main and Trailer. Each of them has two
areas, Body and Margin.
• You can use the tool palette to create standard drawing objects and report objects.
The tool palette also provides some useful editing tools, such as the Frame Select
tool.
• Report bursting enables you to send report output or portions thereof to multiple
output destinations in multiple formats in a single report execution. You can burst
and distribute on repeating data with Oracle9i Reports.
• You can create many additional layouts in the same report by using the Report
Block tool.

Example Reports
This lesson discussed solutions to the following report requirements:
• A report with sections
• Distributing reports such that each user only receives information that is relevant
and appropriate
• Creating variable length lines

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-37
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Practice 11 Overview

• Using report sections


• Adding a repeating frame to the header page
• Adding flexible lines
• Distributing a report

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
11-38 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 11
.....................................................................................................................................................

Practice Session Overview: Lesson 11


This practice session contains:
• Opening an existing report to add header and trailer pages
• Distributing a report to various destinations
• Modifying an existing report to add a repeating frame to the header section
displaying order information
• Opening an existing report and adding flexible lines

Introduction
In this practice session, you use reports created in earlier practice sessions. The aim is
to familiarize you with the different layout sections and regions of a report, and to use
report bursting. You also add flexible lines to a frame.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-39
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

Practice Session: Lesson 11


1 Open report p10q1.rdf. Modify the report as follows:
Create a header section.
a
Display the monitor.jpg file as fixed boilerplate in the Body region.
Add a rectangle boilerplate object. Give it fill color.
Place the image on top of the rectangle. Center the two objects.
Hint: Use the Layout option from the menu.
Include today’s date in the top right portion of the margin.
b Add a report title in the body region.
Use Arial bold as the font and 20 as the size.
c Add a trailer section that displays today’s date with the text “End of Report” on
one line, and “Report run on: ” on the second line in the body region. Select a
larger font.
Hint: Copy and paste the date from the Margin Area of the of the header
section of the report.
d Save the report as p11q1.rdf.
e Run the Paper Layout. Run the Web layout. What is different?
2 Open report p10q1.rdf.
a Modify the report to add a header section that lists all order numbers, order
dates, and order totals in the body region.
b Add “Executive Summary” as boilerplate text in the margin region of the
header section.
c Set the distribution for the header section to an HTMLCSS file.
d Set the distibution for the main section to a PDF file.
e Run and test the report using the Distribute facility in Reports Builder.
f Look at the output generated for both file formats.
g Save the report as p11q2.rdf and close it.
3 Open report p11q3.rdf. Modify the report to burst on repeating data, based on
warehouse ID, and distibute a PDF report for each warehouse.
a In the Paper Layout view of the Report Editor, select the outermost repeating
frame and delete it.
Hint: Use the Object Navigator to locate the frame.
b Set the property for the main section of the report to burst on each warehouse
ID.

......................................................................................................................................................
11-40 Oracle9i Reports Developer: Build Reports
Practice Session: Lesson 11
.....................................................................................................................................................

Define the distribution for the report. Generate a PDF file for each warehouse,
c
using the warehouse name as a unique identifier for each PDF file, such as
rptBejiing.pdf.
d Activate the distribution.
e Save the report.
f Look at the output generated for several of the warehouses.
4 Open report p11q4.rdf.
a Use the Report Wizard to increase the width of PRODUCT_DESCRIPTION to
30.
b Add a flexible line vertically between the PRODUCT_NAME and
PRODUCT_DESCRIPTION fields.
c Run the Paper Layout to test.
d Save the report as p11q4.rdf.
5 Open and run report p2q10.rdf.
a Using the Paper Design view, compare the output with s11q5a.rdf. What is
different? Change the report so that it looks like s11q5a.rdf.
b Fully expand the Paper Layout node for p2q10.rdf.
c Open the Paper Layout and move the window to the right. Make sure it doesn’t
obscure the Object Navigator window.
d Move the F_EMPLOYEE field down 2 inches. It should not be enclosed by
any frame.
e Resize the R_G_EMPLOYEE frame so that it only encloses the F_SALARY
and F_JOB_ID fields.
f Resize the M_G_EMPLOYEE_GRPFR frame so that it encloses the
R_G_EMPLOYEE repeating frame.
g Move the F_DEPARTMENT_NAME and F_DEPARTMENT_ID fields to the
right.
h Create a new repeating frame in the free space. Set the Line color attribute to
No line.
i Link the repeating frame to the G_EMPLOYEE group.
j Move the F_EMPLOYEE field inside the repeating frame R_1.
k Save the report as p11q5a.rdf and run the paper layout. What happens?
l Fix the layout hierarchy error.
m Rearrange the column headers
n Run the paper layout.
o Close the report. Save as p11q5a.rdf.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 11-41
Lesson 11: Enhancing Reports Using the Paper Layout
.....................................................................................................................................................

......................................................................................................................................................
11-42 Oracle9i Reports Developer: Build Reports
12
................................

Controlling the Paper Layout:


Common Properties
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to do


the following:
• Identify common paper layout properties
• Modify common paper layout properties
• Explain the use of format triggers
• Modify Web Settings properties

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 30 minutes
Practice 30 minutes
Total 60 minutes

......................................................................................................................................................
12-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
All Reports Builder objects have properties that provide default settings, which in
many cases are suitable for your report. However, you can modify these property
values; for example, to change the pagination of objects in the report output.
In this lesson, you learn about properties that are common to all paper layout objects.
These are properties that enable you to control the size, placement, and pagination of
objects in the paper report output, as well as properties for Web support of paper
reports.

Objectives
After completing this lesson, you should be able to do the following:
• Identify layout properties common to all types of objects
• Control the sizing of layout objects
• Control pagination of layout objects
• Control printing and formatting of layout objects
• Explain the use of format triggers
• Modify Web Settings properties

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-3
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Selecting an Object in Lower Layers

Accessing a Property Inspector:


• Object Navigator:
– Select object
– Double-click node icon abc
• Paper Design or Paper Layout view:
– Use Select Parent Frame tool
– Select Tools > Property Inspector

Copyright © Oracle Corporation, 2002. All rights reserved.

Comparing Properties
Intersection Freeze

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Remind students of the exploding layer view of a tabular report and a group report
covered in the previous lesson. Verify the object name before modifying the
properties.

......................................................................................................................................................
12-4 Oracle9i Reports Developer: Build Reports
Modifying Paper Layout Object Properties
.....................................................................................................................................................

Modifying Paper Layout Object Properties


Introduction
You have already seen that you can access the Property Inspector for any object in
several different ways. For layout objects, you can access the same properties by
selecting the object in one of the following windows:
• Object Navigator
• Paper Layout
• Paper Design

Selecting an Object in Lower Layers


Because there are several layers in even a simple report, it is sometimes difficult to
select the correct object in the Paper Layout or Paper Design view when other objects
overlay the object you want.
• Using the Object Navigator:
– Select the object directly in the Object Navigator, where you can easily see the
name and type of object.
– To open the Property Inspector, click the node icon to the left of the object
name, or use the right-mouse-button menu.
• Using the Select Parent Frame tool:
– Select the top object in the Paper Layout or Paper Design. Choose Select
Parent Frame to select the enclosing object on the layer below. For example,
select a field, choose Select Parent Frame to select the repeating frame, and
choose Select Parent Frame again to select the group frame.
– To open the Property Inspector, select Tools > Property Inspector or use the
Object Navigator.
Do not double-click the object in the Paper Design, because you will probably select
the wrong object on the top layer.

How to Compare Properties of Two Objects


1 Select one or multiple objects and open the Property Inspector.
Note: Selecting multiple objects results in an intersection of properties.
2 Select the Pin tool to “freeze” the Property Inspector.
3 Select the second object and open the Property Inspector.
4 Reposition the Property Inspectors to view them side by side.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-5
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Layout Object Properties

Four objects with common properties:


• Frames
• Repeating Frames
• Fields
• Boilerplate Objects

Some common properties affect:


• Sizing
• Pagination
• Frequency of display

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
12-6 Oracle9i Reports Developer: Build Reports
Modifying Common Layout Properties
.....................................................................................................................................................

Modifying Common Layout Properties


Introduction
Most layout objects share a number of common properties. This section explains how
to use these common properties.

The Four Layout Objects That Have Common Properties


• Frames
• Repeating Frames
• Fields
• Boilerplate Objects

Some Common Properties


• Sizing: Horizontal and Vertical Elasticity
• Pagination: Page Break Before, Page Break After, Page Protect, and Keep with
Anchoring Object
• Frequency of Display: Print Object On and Base Printing On

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-7
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Sizing Objects
Layout icons
Elasticity Vertical Horizontal

fixed

expand

contract

variable

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
There is a demonstration report to illustrate the slide on page 12-10 (Layout Object
Relationships) and page breaks. The file is l12anc1.rdf.
Use this to remind students of the differences between explicit and implicit anchors. If
you want, you can also show the anchor icons in the Object Navigator.
Continue using this file to show the effect of the pagination options: Page Break
Before and Page Break After.
Suggestion: In the preferences, go to Runtime Settings and make sure that Run Debug
is enabled, so that you see the warning message when Page Break After has no effect.

......................................................................................................................................................
12-8 Oracle9i Reports Developer: Build Reports
Sizing Objects
.....................................................................................................................................................

Sizing Objects
Introduction
You can create objects of any size in the Paper Layout. The elasticity properties enable
you to specify whether the object can change size at run time.

The Four Types of Object Elasticity


Elasticity Output Object Size
Fixed Identical to layout object size
Expand Can be larger than layout, but not smaller
Contract Can be smaller than layout, but not larger
Variable Can be larger or smaller than layout

How Wizard Report Styles Affect Elasticity


Frames: The Report Wizard sets the elasticity of enclosing objects, such as a group
frame, to allow for multiple occurrences of a repeating frame.
Fields: When you reduce the size of a character field in the Labels tab, the Report
Wizard, depending on the report style, sometimes alters the vertical elasticity of the
field to allow for additional characters.
Layout Style Horizontal Elasticity Vertical Elasticity
Tabular Fixed Expand
Group Above Fixed Expand
Form Fixed Expand
Form Letter N/A N/A
Mailing Label N/A N/A

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-9
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................
M

Anchors

• Objects in the push path have implicit anchors (not


visible in Paper Layout)

• Explicit anchors override implicit anchors


• All anchors appear in Object Navigator

Implicit (shaded)
Explicit (solid)

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Enable Anchoring Information (Tools > Options > Layout tab) and explain how to
read the symbols:
• Blue = Parent object
• Red = Child object
A large blob identifies the current node. Therefore a large blue blob indicates that the
current node is the parent; a large red blob indicates that the current node is the child.
• Solid fill = Explicit anchor
• Shaded fill = Implicit anchor

......................................................................................................................................................
12-10 Oracle9i Reports Developer: Build Reports
Anchors
.....................................................................................................................................................

Anchors
Introduction
Anchors are used to determine the vertical and horizontal positioning of a child object
relative to its parent. An anchor defines the relative position of a child object to the
parent object to which it is anchored. An object is called an internal child object when
it is enclosed by the parent object. An external child object is not enclosed by its parent
object.
The absolute position of each layout object is, by default, related to the position of its
enclosing object at run time, unless one of the following is true:
• Reports Builder determines that the position causes a conflict with other objects,
so Reports Builder creates an implicit anchor.
• You decide to override the default position of an object, so you create an explicit
anchor.

Push Path
Reports Builder creates an implicit anchor for any object that it considers to be in the
push path of another object. For example:
• An object occurring below a vertical repeating frame
• An object occurring to the right of a horizontal repeating frame
• An object occurring below an object that has a variable vertical size
• An object occurring to the right of an object that has a variable horizontal size

Contrasting Implicit and Explicit Anchors


Implicit Explicit
Not visible in the Paper Layout Visible in the Paper Layout
Created and maintained automatically by Created by the developer using the anchor tool
Reports Builder in the tool palette
Visible in the Object Navigator if Anchoring Information is enabled (Navigator option)

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-11
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Layout Object Relationships

1
2

Copyright © Oracle Corporation, 2002. All rights reserved.

1 No relationship, no anchor
2 Explicit anchor to enforce relationship
3 Implicit anchor because object is in the push path of a frame

Instructor Note
Use the following questions to determine how well students understand anchors; for
example, What do we mean by push path?
Draw a diagram, including all or some of the suggested objects:
Draw a field (F_1) enclosed in repeating frame R_1 (down direction, fixed size),
enclosed in a frame, M_1 (draw diamonds to show variable size).
Add an object (B_1) below the repeating frame, but inside the group frame.
Add an object (B_2) to the right of the repeating frame.
Add an object (B_3) below the group frame.
To which object is the field related? (repeating frame, enclosing object)
To which object is the repeating frame related? (group frame, enclosing object)
To which object is B_1 related? (repeating frame, implicit anchor)
To which object is B_2 related? (group frame, enclosing object)
To which object is B_3 related? (group frame, implicit anchor)
Remind students that they can create an explicit anchor to override the defaults.

......................................................................................................................................................
12-12 Oracle9i Reports Developer: Build Reports
Layout Object Relationships
.....................................................................................................................................................

Layout Object Relationships


Introduction
To understand how the pagination properties work, you must remember that all objects
in the Paper Layout are related in a hierarchical structure.
You learned that the relationship depends on anchors, either explicit or implicit. Each
object is anchored either to the logical page or to another object.
You can use this hierarchical relationship to control the display of related objects, for
example, if you want to force a page break between related objects, or keep related
objects together on a page.

More About the Push Path


By default, Reports Builder implicitly anchors each object to its immediate enclosing
object. However, sometimes Reports Builder must alter the implicit anchor to ensure
that objects do not overlap at run time when their size is not fixed.
Reports Builder uses an implicit anchoring algorithm to determine whether an object
lies in the push path of another object.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-13
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Pagination Icons in the Paper Layout

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
12-14 Oracle9i Reports Developer: Build Reports
Layout Object Relationships
.....................................................................................................................................................

The Four Pagination Properties


The four common properties that affect whether and where additional page breaks
occur in your paper report are Page Break Before, Page Break After, Page Protect, and
Keep with Anchoring Object (Advanced Layout).
Property Description
Page Break Before Force the object to be formatted on the next logical page
after the one on which it would initially print. All external
child objects also print on the new page. Unrelated
objects may print on the original page.
Page Break After Force all external child objects to print on the next logical
page. That is, every child object that is attached by an
anchor (explicit or implicit) reacts as if it has Page Break
Before set on itself.
Page Protect Cause the entire object and its enclosed objects to be kept
together on the same logical page. This is a useful way of
keeping the entire contents of a frame or repeating frame
on the same logical page, without using anchors.
Keep with Anchoring Cause the current object and the object to which it is
Object anchored to be kept together on the same logical page.

How to Change Visual Pagination Settings in the Paper Layout


The Paper Layout displays icons representing each of the properties when they are set
to Yes (this is the default). These icons are very useful, especially for maintenance and
support. However, you can suppress these and other icons in the Paper Layout options.
1 Select Tools > Options > Paper Layout.
2 Click the Options tab.
3 Select or clear the options as required.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-15
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Using Page Break Before

-1-
1

-2-
xxx
xxx

-1-
xxx -2-
2 xxx

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Image is not related to repeating frame


2 Image is in the push path of and implicitly related to the repeating
frame

Instructor Note
Explain Example 1: The image is to the side of the repeating frame, not in the push
path, and therefore not related. Page Break Before forces the repeating frame to the
second page, but the image remains on the first page.
Ask the students how they could make the image move to the second page in
Example 1. (Create an explicit anchor from image to repeating frame, so that the
image waits for the repeating frame to be formatted.)
In Example 2, the image is implicitly anchored because it is in the push path of the
repeating frame.
Point out that the Page Break Before happens only before the first instance of the
repeating frame, not between each instance.
If students ask how to do it, discuss the property Maximum Records per Page later in
this lesson.

......................................................................................................................................................
12-16 Oracle9i Reports Developer: Build Reports
Layout Object Relationships
.....................................................................................................................................................

Using Page Break Before


Page Break Before delays the formatting of the current object and its anchored child
objects until the next page. Objects that are not implicitly or explicitly anchored to the
current object do not move to the next page, even if they appear below the current
object in the layout.
Note: Remember to use the Navigator options to view implicit and explicit anchor
information in the Object Navigator. This helps you to understand the relationship
between layout objects, and which objects are affected by setting a page break.

Examples
Example 1: The repeating frame and image are not related. Therefore, when you select
the Page Break Before check box for the repeating frame, the image does not move to
the next page.
Example 2: The image is below, and in the push path of, the repeating frame.
Therefore, there is an implicit anchor between the repeating frame (parent) and the
image (child). The image formats after the repeating frame on the same page as the
repeating frame.
Note: Setting Page Break Before on a repeating frame gives a page break before the
first occurrence of the repeating frame only. It does not provide a page break between
each record.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-17
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Using Page Break After

-1-
xxx
1 xxx

-1-
xxx -2-
2 xxx

Copyright © Oracle Corporation, 2002. All rights reserved.

1 Image and rectangle are not related to repeating frame; Page


Break After has no effect
2 Image and rectangle are in the push path of and are implicitly
related to the repeating frame

Instructor Note
Point out that:
• Page Break After is useful for forcing several child objects onto a new page.
• Page Break Before is useful for forcing one object onto a new page.
For example, if you only want the image to move to a new page, you can set Page
Break Before on the image.

......................................................................................................................................................
12-18 Oracle9i Reports Developer: Build Reports
Layout Object Relationships
.....................................................................................................................................................

Using Page Break After


Page Break After delays only the formatting of those objects that are anchored either
implicitly or explicitly to the current object.
Use Page Break After when you want to move multiple related objects to a new page.
This is quicker and easier to maintain than setting Page Break Before on each of the
individual child objects.
Note: Remember to use the Object Navigator to view implicit and explicit anchor
information.
Example 1: The repeating frame and image are not related. Therefore, when you set
Page Break After to Yes for the repeating frame, the image does not move to the next
page.
Example 2: The image and rectangle are below, and in the push path of, the repeating
frame. Therefore, there is an implicit anchor between the repeating frame (parent) and
the image and rectangle (children). The page break occurs immediately after the last
instance of the repeating frame, and the image and rectangle appear on the new page.
Note: Setting Page Break After on a repeating frame gives a page break after the last
occurrence of the repeating frame only. It does not provide a page break between each
record.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-19
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Using Page Protect

-1-
40
xxxxxxxx
f_dept_id
xxxxxxxx
Employee
-2-
f_ename
41
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Page Protect is useful to protect a number of objects together on the same page.
Mention Keep with Anchoring Object to keep two related objects together on the same
page. This property works with implicit and explicit anchors.

......................................................................................................................................................
12-20 Oracle9i Reports Developer: Build Reports
Layout Object Relationships
.....................................................................................................................................................

Using Page Protect


Page Protect indicates whether to keep the entire object and its internal child
(enclosed) objects on the same logical page.
Page Protect applies only to the first logical page on which the object normally
formats; Reports Builder ignores Page Protect on subsequent pages to avoid an infinite
loop.

Example A particular instance of a master repeating frame might contain so many


detail records at run time that it is not possible to display them all on the same page. If
so, you can force a page break before the master instance begins.
• To start the master on a new page, set Page Protect to Yes on the master repeating
frame.
• If there is no suitable frame to protect several objects, create your own frame,
enclose the objects in the frame, and set Page Protect on the frame.
Hint: If you create your own frame to protect several objects, give the frame a solid
fill so that you can ensure that you place it at the correct layer of the layout. The frame
must be behind all the objects it encloses.
Remember to remove the fill when you are satisfied with the layout.
Ensure that the frame’s elasticity properties are set to Variable, Expand, or Contract,
depending on the sizing of the objects it encloses.

Using Keep with Anchoring Object


The Keep with Anchoring Object property is similar to Page Protect, except that it
affects anchored objects instead of enclosing objects.
Keep with Anchoring Object is useful when you want to keep two objects together on
the same page.
If there is not enough room to display the child object on the same page as its parent,
Keep with Anchoring Object moves both parent and child objects to a new page.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-21
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Controlling Print Frequency

-1-
Your Company Your Company
-2-
Your Company
-3-
Your Company

Print Object On = All Pages


Base Printing On = Enclosing Object

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The default value for Base Printing On is Enclosing Object, so if Print Object On is set
to All Pages, Summit Goods is printed for all pages of the group frame.
Mention that you do not often need to change Base Printing On to Anchoring Object.
It may be necessary in some layouts if the text is explicitly or implicitly anchored to a
parent object and you want to control the printing of the text on the same pages as its
parent object. Therefore, the combination of options depends on the layout of different
reports and objects.
Here is a suggested demonstration or group exercise to break up the long lesson and to
summarize some of the properties discussed so far. Use this to encourage discussion
among students by asking them how to achieve each step:
Use a master-detail report; for example, DEPARTMENTS/EMPLOYEES (or you
might prefer the simple example of DEPT/EMP).
Result you want to achieve: Each master is to be a title page with its details on a
subsequent page. The master information must not repeat on the detail pages.
A detailed step-by-step description is on the following page.

......................................................................................................................................................
12-22 Oracle9i Reports Developer: Build Reports
Layout Object Relationships
.....................................................................................................................................................

Controlling Print Frequency


Two related properties, Print Object On and Base Printing On, control how often to
print the object in relation to another object.

Which Page?
Print Object On determines on which of the parent’s logical pages the object is printed.
Print Object on Object Prints on
All Pages All logical pages of the parent
All But First Page All logical pages except the first or last page
All But Last Page
First Page/Last Page The first or last logical page only
Default The option that Reports Builder chooses; Reports Builder resets
the property, using an internal algorithm; use the default setting
if you have made a mistake and want to return to the report
default

Which Parent?
Base Printing On determines whether the parent object is to be the Enclosing Object or
the Anchoring Object.

Example
The report opposite shows a text title inside the group frame. The output for this frame
shows there are several records that span three pages.
When you create a piece of text, by default it is printed on the First Page only of its
enclosing object. In this case, the enclosing object is the group frame. You can modify
the properties to select the pages on which the text is printed.
To print the text on all pages of the group frame, set Print Object On to All Pages; set
Base Printing On to Enclosing Object (default).
Note: If the text is outside all group frames, its parent is the body page itself.
Therefore, you can use these two properties to display “Continued...” on all but the last
page, or “...continued” on all but the first page.
There are several restrictions that apply to these settings. If you receive an “invalid
setting error,” look at the explanation and restrictions in the Reports Builder Help
Topics.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-23
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Format Triggers

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Explain the use of format triggers briefly to show their power. Stress that format
triggers are available on all layout objects. Remind the students that quite a lot can be
done using conditional formatting. The Coding PL/SQL Triggers lesson covers this in
more detail.
You can also use format triggers in a Web layout, specifically with the rw:field tag.
This is addressed in the Coding PL/SQL Triggers lesson as well.

......................................................................................................................................................
12-24 Oracle9i Reports Developer: Build Reports
Using Format Triggers
.....................................................................................................................................................

Using Format Triggers


What Is a Format Trigger?
A format trigger is a user-written PL/SQL function that executes each time before the
object containing the trigger is formatted.

Which Objects Contain Format Triggers?


All the main layout objects, frames, repeating frames, fields and boilerplate objects,
can contain a format trigger.

Why Use a Format Trigger?


You can use a format trigger to dynamically change the formatting attributes of an
object. The PL/SQL function must return a Boolean value (TRUE or FALSE). This
dictates whether the current instance of the object is included or excluded from the
report output.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-25
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Layout Object Properties for Web Support

• Hyperlink
• Hyperlink
Destination
• Bookmark
• Application
Command Line

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
12-26 Oracle9i Reports Developer: Build Reports
Layout Object Properties for Web Support
.....................................................................................................................................................

Layout Object Properties for Web Support


All paper layout objects support Web features. Use the following Web Settings
properties:
• Hyperlink
This is a URL link specification that displays a document or destination within a
document. The document or document destination can be local or remote, dynamic
or static.
• Hyperlink Destination
A unique dynamic or static object identifier that can be used as a Web link
destination.
• Bookmark
A Web link that will serve as a bookmark in a bookmark frame. Bookmarks
facilitate navigation within a report. When you click a bookmark, it displays the
associated object at the top of the window.
• Application Command Line
This adds a link to an object executing the specified command when you click the
link.

Examples
• Dynamic Hyperlink
‘Dept Details ’ || to_char(:deptno)
• Dynamic Bookmark
‘Company Car Policy, Category ’ || :level
• Application Command Line
C:\orawin90\bin\rwrun.exe report=payload_det.rdf

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-27
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Identify common properties for most layout objects:
– Size
– Pagination
– Print frequency
– Format trigger
– Web settings
• Modify common properties for special reporting
needs

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
12-28 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Report objects provide many properties that you can modify in the Property Inspector
to alter the appearance and position of objects in your report output.
• Common properties exist for most layout objects.
• You do not have to make many alterations for most standard reporting needs.
This lesson explained how to use common object properties and gave examples of
some common uses, such as:
• Forcing pagination by setting Page Break Before or Page Break After
• Format triggers
• Web settings

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-29
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Practice 12 Overview

• Creating a break report with continuation pages


displaying limited information
• Modifying properties for object Web support

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
12-30 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 12
.....................................................................................................................................................

Practice Session Overview: Lesson 12


This practice session contains:
• Creating a break report with continuation pages displaying limited information
• Modifying properties for object Web support

Introduction
Sometimes detail records get separated from their master header. You ensure that this
does not happen.
All paper layout objects support Web features. You will create a report that takes you
to a PDF document with a simple click using a hyperlink.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 12-31
Lesson 12: Controlling the Paper Layout: Common Properties
.....................................................................................................................................................

Practice Session: Lesson 12


1 Create a new break report showing each customer and the relevant orders.
a Use the query p12_1.sql to create the report.
b Create a group above master detail report with all the customer data in the
break group. Create a sum for the quantity.
c Modify the width for the fields listed below:
Column Label Width
name Name: 20
street_address Address: 10
city City: 10
state_province State / Province: 10
postal_code Zip: 5
country_id Country: 2
credit_limit Credit Limit: 6

Resize the customer repeating frame to 3 inches high.


d
e Run the paper layout. What do you see?
f Ensure that no customer data displays on a page without details.
g Save the report as p12q1.rdf.
h Run the paper layout again to test.
2 Create a new tabular report.
a Define the SQL query as:
select last_name, first_name, hire_date
from employees
Display all fields. Choose the Wine template.
b In the margin region of the report’s Main Section, delete the company logo.
Resize the margin to 1.75 inches. Insert the image dinner1.bmp. Create a
rectangle around it and give it a solid fill.
c When you click on the image in HTML output you want to open a local .pdf
file named mousse.pdf.
d Save the report as p12q2.rdf and generate a file in paginated HTMLCSS
format. Open the file in your browser and test the hyperlink.

......................................................................................................................................................
12-32 Oracle9i Reports Developer: Build Reports
13
................................

Controlling the Paper Layout:


Specific Properties
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Identify specific layout properties
• Modify specific layout properties
• Explain the use of specific properties
• Create a file link

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Topic Timing
Lecture 30 minutes
Practice 30 minutes
Total 60 minutes

......................................................................................................................................................
13-2 Oracle9i Reports Developer: Build Reports
Overview
.....................................................................................................................................................

Overview
Introduction
In the previous lesson you looked at common object properties. There are however a
number of properties that are unique to specific types of layout objects.
In this lesson, you learn about specific properties for repeating frames, fields, and
boilerplate. You will also learn to reference the contents of a file at run time.

Objectives
After completing this lesson, you should be able to do the following:
• Identify properties that are specific to certain types of paper layout objects
• Explain the use of properties that are specific to certain types of paper layout
objects
• Display the contents of a file in the report layout

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-3
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Properties of a Repeating Frame

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-4 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Repeating Frame
.....................................................................................................................................................

Modifying Properties of a Repeating Frame


Introduction
A repeating frame is record-related, and its properties allow you to modify specific
attributes associated to the display of the records.

Specific Properties of a Repeating Frame


Property Name Description
Source Name of the Data Model group that
provides the source data for this repeating
frame; you must source every repeating
frame to a valid group
Print Direction Direction in which records are printed:
Down or Across, Across/Down, or Down/
Across
Maximum Records per Page Maximum number of records that can be
displayed on a single page
Minimum Widow Records Minimum number of records from a group
that can be displayed at the bottom of a page
Column Mode Whether to maintain the column for each
record across multiple pages
Horiz. Space Between Frames Spacing between each record, horizontally
Vert. Space Between Frames and vertically

The most commonly used properties are discussed in more detail on the following
pages.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-5
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Print Direction

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-6 Oracle9i Reports Developer: Build Reports
Print Direction
.....................................................................................................................................................

Print Direction
Print direction specifies the direction in which to print the repeating frame’s records,
and may be any one of the values below:
Print Direction Description
Down Prints sequential records down the page. At the end of
the page, records overflow onto the next page.
Down/Across Prints sequential records down the page. At the end of
the page, records move across to form a new column if
there is room; otherwise they overflow onto a new
page.
Across Prints sequential records across the page. When records
reach the right edge of the page, they overflow onto a
new page.
Across/Down Prints sequential records across the page. When records
reach the right edge of the page, they move down
below the previous set of records if there is room;
otherwise they overflow onto a new page.

Taking Responsibility for Enclosing Objects


When you alter the print direction of a repeating frame, you must consider the
properties of any enclosing objects. Enclosing objects may include other repeating
frames and group frames.

Example
In diagram 1 opposite, the default print direction of the records is Down. Therefore,
the vertical elasticity property of the enclosing group frame is set to Variable to allow
for a variable number of records, but the horizontal size is fixed.
If you decide to alter the print direction to Down/Across as in diagram 2, you may
need to modify the properties of the enclosing group frame to be variable (diagram 3).
If not, the records still overflow to the next page.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-7
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Records per Page

1 2
-1- -1-

-2-

-3- -2-

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-8 Oracle9i Reports Developer: Build Reports
Print Direction
.....................................................................................................................................................

Controlling the Number of Records per Page


You can specify the maximum number of records that you want to display on each
logical page.
In the repeating frame Property Inspector, choose the Maximum Records per Page
property. The value you enter for this property can be any positive whole number or
blank.
If this setting is 0 (zero), Reports Builder formats as many records as possible on the
logical page.

Examples Recall the Form and Form Letter report styles. Reports Builder
automatically sets Maximum Records per Page to 1. If you require more than one
record on each page, you can modify this property.
In the Group Above report style, Reports Builder formats as many records as possible
on a page. (Maximum Records per Page is null.) Modify this property for the master
repeating frame to display one master record per page.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-9
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Spacing Between Records


Mailing Labels

1
2

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
If you want to demonstrate this, use a mailing label layout style and give the label
repeating frame a color fill. Run the report and show how the color fills the entire
page, meaning there are no gaps. Now alter the horizontal and vertical spacing using a
different value for each and run the report again.

......................................................................................................................................................
13-10 Oracle9i Reports Developer: Build Reports
Print Direction
.....................................................................................................................................................

Controlling Spacing Between Records


The properties Horiz. Space Between Frames and Vert. Space Between Frames control
the amount of space between occurrences of a repeating frame; that is, record spacing.

Horizontal Space Between Frames Define the amount of space you want between
records horizontally across the page by entering zero or any positive number for this
setting.
This setting has no effect if the repeating frame has a print direction of Down.

Vertical Space Between Frames Define the distance you want between records
vertically down the page by entering zero or any positive number for this setting.
This setting has no effect if the repeating frame has a print direction of Across.
Note: In bitmapped reports, the distance is a whole or part of the unit of measurement,
for example,.25 (of an inch).
In character mode reports, the distance is the number of blank characters (horizontal)
or lines (vertical). Therefore, you must enter a whole number, for example, 10
(characters).

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-11
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Minimum Widow Records

Without widow control With widow control


(Min Widow Records = 3)

Page 1 Page 1

Page 2 Page 2

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
If asked, the term widow record refers to a single record separated from the other
records in that group.

......................................................................................................................................................
13-12 Oracle9i Reports Developer: Build Reports
Minimum Widow Records
.....................................................................................................................................................

Minimum Widow Records


You can specify the minimum number of records that must display on a page. The
default is zero, which means a single record may display alone on a page.

Example
In the diagram are two separate repeating frames printing down the page. The second
repeating frame is near the end of the page, and there is only room for two records.
If you want to force at least three records on a page, enter 3 in the Minimum Widow
Records property so that the repeating frame starts to format on the next page.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-13
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Column Mode

Column Mode Off Column Mode On

Page 1 Page 1

10 20 10 20 30

Page 2 Page 2

20 30 20

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Column Mode is only relevant to some layout styles.
It has two effects:
• Maintains same column for records spanning a page
• Allows subsequent records to start formatting before the previous record has
finished printing

......................................................................................................................................................
13-14 Oracle9i Reports Developer: Build Reports
Column Mode
.....................................................................................................................................................

Column Mode
You can set Column Mode to Yes to allow the next instance of a repeating frame to
begin formatting before the previous instance completes. Column Mode is used
mainly for master repeating frames or repeating frames that contain fields that may
expand vertically or horizontally (for example, elasticity is Variable or Expand).

Example
The example opposite shows the use of Column Mode for the department master
repeating frame given three records, 10, 20, and 30. The department repeating frame’s
print direction is Across, and the employee repeating frame’s print direction is Down.
Use Column Mode to start formatting department 30 on page 1, and also to align the
overflow for department 20 on page 2.
Note: Column Mode does not make sense for repeating frames that have a print
direction of Across/Down or Down/Across.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-15
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Properties of a Field

• Fields define formatting attributes and logic


• Wizard creates a field for each column
• You create additional fields in the Paper Layout:
– Source: Column, parameter, or system variable
– Format mask: Standard Oracle format symbols

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
Remind students that you can easily create page numbers and the current date in the
Paper Design view; however, creating your own fields provides more control over the
property settings for page numbering. Open l13field.rdf.
1 Change Maximum Records per Page to 1 (master repeating frame).
2 Select Page Break Before (detail group frame).
3 Change Print Object to First Page for all objects in the master repeating frame (use
[Shift]-click + select and show how to change the property for several objects at
the same time on one Property Inspector).
Point out that alternatively you can create a frame to enclose all these objects and
set the property on the frame instead. This method is used in the Carry Over
example in the practice session at the end of this lesson.
4 If you have extra time, you may want to continue with the demonstration after
discussing the field properties and create a field for page numbering and reset for
each department (master record).

......................................................................................................................................................
13-16 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Field
.....................................................................................................................................................

Modifying Properties of a Field


Introduction
A field is a layout container for a column or a parameter.
A field defines formatting attributes or logic for the data of its related column or
parameter.

Fields and Their Relationship to Data Model Objects


The Report Wizard creates one field for each column and places these fields inside a
repeating frame or at report level.
You can create a field in the Paper Layout and relate it to a Data Model column or
parameter.

Defining the Source of a Field


The Source property provides a list of columns, of which there are three categories:
• Columns in the Data Model
• Parameters (always listed in uppercase)
• System variables, such as today’s date and current page number
The datatype of a field depends on its source.

Defining a Format Mask


When you insert a page number object in the Paper Design or the Paper Layout,
Reports Builder provides sample dates to enable you to pick a format easily.
The format mask property appears in the standard Oracle date format symbols, such as
MM, which displays the number of the month, or Month, which spells out the name of
the month in full.
The list provides all the format masks that exist in your preferences. Modify your
preferences to include the common masks that you use, or enter a different mask in
this property.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-17
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

System Variables

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-18 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Field
.....................................................................................................................................................

System Variables as the Source of a Field


The following table lists the variables and describes their display values.
Variable Name Description
Current Date The operating system date, at run time, after the
Runtime Parameter Form has been displayed
Page Number The current page number, based on the
output numbered by logical page
Panel Number The current panel number in the current logical page
Physical Page Number The current page number, based on the
output numbered by physical page
Total Pages The total number of logical pages in the
current report run
Total Panels The total number of panels in a logical page
Total Physical Pages The total number of pages, based on the output
numbered by physical page

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-19
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Page Numbering

Page 4 of 4
Example 1
Page 3 of 4
End
Page 2 of 4
Page 1 of 4
Example 2
Report
Title
Page 1 of 1
End
Page 2 of 2
Page 1 of 2
Report
Title

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-20 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Field
.....................................................................................................................................................

Page Numbering
When the source of a field is one of the system variables for page or panel numbers,
you can define where and how your page numbers are calculated by choosing the Page
Numbering property.

Example 1 To number all the pages in the main section of a report and include
trailer section pages but exclude header section pages, you would specify:
Page Numbering Property Value
Include Main Section, Trailer Section
Start At 1
Increment By 1
Reset At Report

Example 2 To number all pages in the main section of a report, excluding header
and trailer pages, and to restart the numbering at 1 for each new department record in
the repeating frame R_Dept, you would specify:
Page Numbering Property Value
Include Main Section
Start At 1
Increment By 1
Reset At R_Dept

Note: When resetting page numbers for each record in a repeating frame, make sure
that each record starts on a new page. Use the Maximum Records per Page property;
this property of the repeating frame was discussed earlier in this lesson.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-21
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Valid Source Columns

G_Region

R_Region

F_1 R_Dept
G_Dept R_Emp

G_Emp F_REPORT

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-22 Oracle9i Reports Developer: Build Reports
Modifying Properties of a Field
.....................................................................................................................................................

Valid Source Columns


When creating new fields, make sure that they exist at the correct level within the
report; otherwise frequency errors occur.
If you create a field in a repeating frame, the column you choose as the source must be
in the relevant group for the repeating frame or in an ancestor of that group.
In the diagram opposite, the Data Model shows a three-level hierarchy:
• G_Region is the parent of G_Dept.
• G_Dept is the parent G_Emp.
The layout shows the three nested repeating frames, R_Region, R_Dept, and R_Emp.
If you create another field in the R_Dept repeating frame, the source column must
come from either G_Dept or G_Region; a column in G_Emp would be an invalid
source, because values in the G_Emp group occur more often than R_Dept would be
printed.

Report-Level Fields
If you create a field outside any repeating frame, that is, at report level, the source
column must be a report-level column—outside all groups in the Data Model.
System columns, such as current date or page numbers, are report-level columns; you
can use these in report-level fields, or at any lower level of your report. For example,
you can display the current date at report level or within a repeating frame.
You often use the Header section or margin region of each section to display report-
level information.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-23
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Displaying File Contents

Copyright © Oracle Corporation, 2002. All rights reserved.

Instructor Note
The File Link tool is available in the Paper Design, as well as in the Paper Layout.
Note: The Property Inspector for the File Link object indicates ‘Link File’. This is a
bug (#2129653) in release 9.0.2 and will be fixed in release 9.0.3.
Also, Oracle Drawing Format is no longer supported.

......................................................................................................................................................
13-24 Oracle9i Reports Developer: Build Reports
Displaying File Contents with a File Link
.....................................................................................................................................................

Displaying File Contents with a File Link


Introduction
There is a special type of boilerplate object, called a file link, that does not have to
remain constant for each report run.
A file link allows you to create an external boilerplate object that displays the contents
of a file.

File Link Properties


The specific properties for this type of object are as follows:
Property Name Description
Source File Format The type of file contents; contents can be Text, Image, CGM,
or Image URL
Source Filename The name of the file that you want to link to the report

In character-mode reports, Text is the only valid format.

How to Create a File Link Object


1 In the Paper Layout toolbar, select the File Link tool. Drag an area in the layout to
create a file link object of the required size.
2 In the Property Inspector, change the name of the object.
3 Enter the name of the file link that you want to include in the output, and the
format of the file.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-25
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

When Are Contents Updated?

Reports Builder reads the file contents when you:


• Modify the Property Inspector
• Open a report definition
• Run a report

Copyright © Oracle Corporation, 2002. All rights reserved.

Linking and Importing Files

1 2
Import

Link

3 4

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-26 Oracle9i Reports Developer: Build Reports
Displaying File Contents with a File Link
.....................................................................................................................................................

When Are the Contents Updated?


Oracle9i Reports picks up the contents of a file link at run time. Therefore, the file
contents can change dynamically for each report run.
The file link object automatically redisplays the current contents of the file when you:
• Modify the source filename in the Property Inspector
• Open the report (in Reports Builder)
• Run the report
Note: The file must exist at run time; otherwise the report fails with an error message.

Choosing Between Linking and Importing File Contents


If the contents of a file might change, and especially if you want to use the same
contents in many reports, use a file link so that the contents are included dynamically
at run time.
If the file contents are not likely to change often, you can import the contents.
Note: An imported image is stored in the report definition file, and therefore increases
the size of the file. However, the report runs faster if the image is imported rather than
linked to a file.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-27
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Comparing a File Link and a File Column

Q_EMP

G_EMP

PICTURE F_PICTURE
1

Copyright © Oracle Corporation, 2002. All rights reserved.

1 The layout field F_Picture depends on its source column


PICTURE in the Data Model. The filename, and therefore the
picture, can be different for each record.
2 File Link exists as a layout object only. The same picture repeats
for each record.

......................................................................................................................................................
13-28 Oracle9i Reports Developer: Build Reports
Displaying File Contents with a File Link
.....................................................................................................................................................

Comparing a File Link and a File Column


The main difference in creating a file link and a file column is that you create a file
link in the Paper Layout, whereas you create a file column in the Data Model.
The following table shows the differences between a link file and a file column.
File Link File Column
Is an explicit boilerplate object Is a database column
Represents one file only Represents a different value for each record
Displays the same file contents for every Can display different file contents for each
occurrence of a repeating frame record
Exists in the Paper Layout Exists in the Data Model and is the source of
a layout field

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-29
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Summary

In this lesson, you should have learned how to:


• Identify object-specific properties
• Modify these properties when necessary
• Create a file link in your report

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-30 Oracle9i Reports Developer: Build Reports
Summary
.....................................................................................................................................................

Summary
Report objects provide many properties that you can modify in the Property Inspector.
You do not have to make many alterations for most standard reporting needs.
• Common properties exist for most layout objects.
• Specific properties exist for individual object types, such as fields and repeating
frames.
This lesson explained how to modify object-specific properties and gave examples of
some common uses, such as:
• Controlling spacing between records
• Creating a file link

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-31
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Practice 13 Overview

• Modifying the printing of a mailing label report


• Controlling the number of records on a page
• Adding a file link to a report
• Ensuring all details of a master print on the same
page

Copyright © Oracle Corporation, 2002. All rights reserved.

......................................................................................................................................................
13-32 Oracle9i Reports Developer: Build Reports
Practice Session Overview: Lesson 13
.....................................................................................................................................................

Practice Session Overview: Lesson 13


This practice session contains:
• Modifying the printing of a mailing label report
• Controlling the number of records on a page
• Adding a file link to a report
• Ensuring that all details of a master are printed on the same page

Introduction
Modify a mailing label report to ensure you fill the printed page with label records.
You then restrict the number of labels that are printed on each page.
You add a file link to display a company logo by dynamically referencing a file at run
time.

......................................................................................................................................................
Oracle9i Reports Developer: Build Reports 13-33
Lesson 13: Controlling the Paper Layout: Specific Properties
.....................................................................................................................................................

Practice Session: Lesson 13


1 Open report p4q4.rdf.
Modify the layout so that the mailing labels are 2 inches wide and 1 inch high.
a
Use the Layout option on the menu. Ensure that the customer names are
printed in alphabetical order across the page.
b Give each label a solid fill.
c Make the boilerplate object 1.8 inches wide and center it horizontally and
vertically in the repeating frame.
d Add spacing between the labels: .25 inch between each column of labels across
the page; .5 inch between each row of labels down the page.
e Run the paper layout to test. Save the report as p13q1.rdf.
2 Continue with report p13q1.rdf.
a Modify the report so that only six labels are printed on each page.
b Run the paper layout to test. Save the report as p13q2.rdf and close it.
3 Open p10q1.rdf.
a On the operating system, copy the file summitlo.tif to a file logo.tif.
b Delete the logo in the margin area and create a file link in its place to display
the contents of logo.tif.
c Run the paper layout.
d On the operating system, copy any other .tif file to logo.tif.
e Rerun your report.
f Save the report as p13q3.rdf.
4 Continue with report p13q3.rdf.
a Ensure that all items of one order are printed on the same page.
b Save the report as p13q4.rdf and close it.

......................................................................................................................................................
13-34 Oracle9i Reports Developer: Build Reports

You might also like