Вы находитесь на странице: 1из 760

Oracle University Internal and TransAmerica Training Management Inc Partner use only

Oracle Reports Developer 10g:


Build Reports

Student Guide Volume 1

D17075GC10
Production 1.0
June 2004
D39520

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Authors Copyright 2004, Oracle. All rights reserved.
Ellen Gravina This documentation contains proprietary information of Oracle Corporation. It is
Smitha Keshav provided under a license agreement containing restrictions on use and disclosure and
is also protected by copyright law. Reverse engineering of the software is prohibited.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Technical Contributors If this documentation is delivered to a U.S. Government Agency of the Department of
Defense, then it is delivered with Restricted Rights and the following legend is
and Reviewers applicable:
Cem Ayberkin
Restricted Rights Legend
Christian Bauwens
Alena Bugarova Use, duplication or disclosure by the Government is subject to restrictions for
commercial computer software and shall be deemed to be Restricted Rights software
Kathryn Cunningham under Federal law, as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013,
Laurent Dereac Rights in Technical Data and Computer Software (October 1988).

Mark Fleming This material or any portion of it may not be copied in any form or by any means
Warren Lord without the express prior written permission of Oracle Corporation. Any other copying
is a violation of copyright law and may result in civil and/or criminal penalties.
Marcelo Manzano
If this documentation is delivered to a U.S. Government Agency not within the
Darren McBurney Department of Defense, then it is delivered with Restricted Rights, as defined in
Paul Narth 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 any
Miyuki Ohsato problems in the documentation, please report them in writing to Education Products,
Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores, CA 94065.
Ligia Jasmin Robayo Oracle Corporation does not warrant that this document is error-free.
Jim Safcik All references to Oracle and Oracle products are trademarks or registered trademarks
Rie Saitoh of Oracle Corporation.
Navneet Singh All other products or company names are used for identification purposes only, and
Sarah Spicer may be trademarks of their respective owners.

Martijn van der Bruggen


Vanessa Wang
Philipp Weckerle
Ted Witiuk
Publisher
Sujatha Nagendra

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Contents

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Preface
I Introduction
Course Objectives I-2
Course Content I-3
1 Introduction to Oracle Reports Developer
Objectives 1-2
Business Intelligence 1-3
Enterprise Reporting 1-5
Web Publishing 1-9
Paper Publishing 1-10
Oracle Reports Developer 1-11
Benefits 1-12
Oracle 10g Products 1-13
Oracle Database 10g 1-14
Oracle Developer Suite 10g 1-15
Oracle Application Server 10g 1-18
Oracle Reports Developer 1-20
OracleAS Reports Services 1-22
OracleAS Reports Services Architecture for the Web 1-23
Summary 1-25
2 Designing and Running Reports
Objectives 2-2
Understanding User Requirements 2-3
Designing Reports 2-5
Tabular 2-7
Master-Detail 2-8
Master with Two Details 2-9
Matrix 2-10
Retrieving and Sharing Data 2-11
Running a Report 2-13
Previewing Reports 2-15
Print Preview 2-16
Supported File Types 2-19
Summary 2-21
Practice 2 Overview 2-22
3 Working in Oracle Reports Developer
Objectives 3-2
Reports Developer Executables 3-3
Invoking Reports Builder 3-5
Reports Builder Modules 3-6
Report Data and Layout 3-7
Reports Builder Components 3-8
Main Menu Structure 3-10
Wizards 3-12
Report Editor 3-13
PL/SQL Development Environment: Syntax Palette 3-15
iii

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Object Navigator 3-16
Report-Level Objects 3-17
Data Model Objects 3-18
Paper Layout Objects 3-19
Paper Parameter Form Objects 3-20
Object Interrelationship 3-21
Customizing Your Oracle Reports Developer Session 3-22
Saving Preferences 3-23
Oracle Reports Environment Variables 3-24
Using the Online Help System 3-26
Summary 3-28
Practice 3 Overview 3-29
4 Creating a Paper Report
Objectives 4-2
Report Module Components 4-3
Building a Paper Report 4-4
Invoking the Report Wizard 4-5
Choosing the Layout Type 4-6
Creating a Tabular Report 4-7
Selecting the Data Source Type 4-9
Using Query Builder 4-10
Building a Query 4-11
Query Builder Functions 4-12
Selecting Displayed Fields 4-14
Totals and Labels 4-15
Selecting a Report Template 4-16
Viewing the Paper Report Output 4-17
Saving the Report Definition 4-18
Reentering the Wizard 4-19
Creating a New Report 4-21
Creating Break Reports 4-22
Break Report Labels 4-23
Creating Mailing Labels and Letters 4-24
Creating a Matrix Report 4-26
Previewing a Paper Report in a Browser 4-28
Summary 4-30
Practice 4 Overview 4-31
5 Enhancing a Basic Paper Report
Objectives 5-2
What Is the Paper Design? 5-3
The Paper Design Window 5-4
Modifying a Report 5-5
Aligning Columns 5-6
Setting a Format Mask 5-7
Manipulating Objects 5-9
iv

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modifying Visual Attributes 5-10
Applying Conditional Formatting 5-12
Inserting Page Numbers, Dates, and Times 5-14
Customizing Dates 5-16
Summary 5-17
Practice 5 Overview 5-18
6 Managing Report Templates
Objectives 6-2
Using Report Templates 6-3
Modifying a Template 6-4
Customizing the Template Margin 6-6
Customizing the Template Body 6-7
Adding Web Links to a Template for Report HTML Output 6-8
Predefining Your Own Templates 6-10
Adding a Template Preview Image 6-12
Summary 6-13
Practice 6 Overview 6-14
7 Creating a Web Report
Objectives 7-2
What Is JSP Technology? 7-3
JSP Advantages 7-4
Simple JSP Example 7-6
Building a Web Report 7-7
Using the Report Wizard 7-8
Report Editor: Web Source View 7-9
JSP Tags 7-11
Web Source Example 7-13
Generating Output 7-15
Image Format Support 7-17
Summary 7-19
Practice 7 Overview 7-20
8 Enhancing Reports Using the Data Model: Queries and Groups
Objectives 8-2
The Data Model Objects 8-3
Modifying Properties of a Query 8-5
More Properties 8-8
Applying Changes 8-10
Changing the Group Structure 8-12
Group Hierarchy 8-14
Ordering Data in a Group 8-16
Query Modifications 8-18
Filtering Data in a Group 8-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using a Packaged Filter 8-21
Summary 8-22
Practice 8: Overview 8-23

9 Enhancing Reports Using the Data Model: Data Sources


Objectives 9-2
Data Source Types 9-3
Pluggable Data Sources 9-5
Out-of-the-Box Options 9-6
Using XML as a Data Source 9-7
Example: XML Data Stream 9-9
Document Type Definition File 9-10
XML Report 9-11
OLAP Data Source 9-12
Defining an OLAP Query 9-13
Example: OLAP Report 9-14
Using Text as a Data Source 9-15
Setting Up the textpds.conf File 9-16
Defining a Text Query 9-18
Sample Text PDS Report 9-19
Using JDBC as a Data Source 9-20
Configuring the jdbcpds.conf File 9-21
Defining a JDBC Query 9-23
Adding New Data 9-25
Using REF Cursor Queries 9-28
Viewing Output from Multiple Query Reports 9-30
Using Data Links 9-32
Creating a Column-to-Column Link 9-34
Other Data Link Methods 9-36
Efficiency Issues: Multiple- or Single-Query Hierarchy 9-38
Summary 9-40
Practice 9 Overview 9-41

10 Enhancing Reports Using the Data Model: Creating Columns


Objectives 10-2
Data Model Columns 10-3
Maintaining Data Source Columns 10-5
Producing File Content Output 10-7
Creating a Column 10-9
Creating Summary Columns 10-11
Displaying Subtotals 10-13
Displaying Percentages 10-15

vi

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Resetting Summary Values 10-17
Creating a Formula Column 10-18
Creating a Placeholder Column 10-20
Populating a Placeholder Column 10-22
Summary 10-24
Practice 10 Overview 10-25
11 Enhancing Reports Using the Paper Layout
Objectives 11-2
Viewing the Paper Layout 11-3
Viewing the Section Areas 11-5
Designing Multipanel Reports 11-6
Printing Multipanel Reports 11-8
Different Objects in the Paper Layout 11-9
The Paper Layout Layers 11-11
Avoiding Layout Errors 11-13
Report Processing 11-15
Creating Layout Objects 11-17
Paper Layout Tools 11-19
Report Bursting 11-20
Bursting on a Repeating Group 11-22
Creating an Additional Layout 11-24
Distributing a Report 11-26
Tracing the Report Distribution 11-28
Creating Variable Length Lines 11-30
Summary 11-32
Practice 11 Overview 11-33
12 Controlling the Paper Layout: Common Properties
Objectives 12-2
Modifying Paper Layout Object Properties 12-3
Comparing Properties 12-5
Common Layout Properties 12-6
Sizing Objects 12-7
Anchors 12-9
Layout Object Relationships 12-11
Pagination Icons in the Paper Layout 12-14
Using Page Break Before 12-16
Using Page Break After 12-18
Using Page Protect 12-20
Controlling Print Frequency 12-22
Using Format Triggers 12-24
Layout Object Properties for Web Support 12-25
Summary 12-27
Practice 12 Overview 12-28

vii

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
13 Controlling the Paper Layout: Specific Properties
Objectives 13-2
Properties of a Repeating Frame 13-3
Specifying Print Direction 13-4
Controlling the Number of Records per Page 13-6
Controlling Spacing Between Records 13-7
Minimum Widow Records 13-8
Column Mode 13-9
Properties of a Field 13-10
System Variables 13-12
Page Numbering 13-13
Valid Source Columns 13-15
Displaying File Contents 13-17
When Are the Contents Updated? 13-19
Linking and Importing Files 13-20
Comparing a File Link and a File Column 13-21
Specifying the Format Order 13-22
PDF Document Taxonomy Properties 13-24
Summary 13-25
Practice 13 Overview 13-26
14 Web Reporting
Objectives 14-2
High Quality Web Publishing 14-3
Comparing Static and Dynamic Reporting 14-5
Adding Dynamic Content 14-7
Creating a Report Block 14-9
Invoking the Report Block Wizard 14-11
Examining the Web Source Code 14-12
rw:foreach Tag 14-14
rw:field Tag 14-15
Customizing Reports JSPs 14-16
Customizing Reports JSPs Using Style Sheets 14-17
Customizing Reports JSPs Using HTML Tags and Attributes 14-19
Customizing Reports JSPs Using Reports Custom Tags 14-20
Summary 14-24
Practice 14 Overview 14-25
15 Extending Functionality Using XML
Objectives 15-2
Why Use XML Report Definitions? 15-3
Creating XML Report Definitions 15-5
Partial Report Definitions: Format Modification Example 15-7
Partial Report Definitions: Format Exception Example 15-9

viii

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Full Report Definition: Data Model Modification Example 15-11
Running XML Report Definitions 15-15
Debugging XML Report Definitions 15-19
Summary 15-21
Practice 15 Overview 15-22
16 Creating and Using Report Parameters
Objectives 16-2
Creating User Parameters 16-3
Referencing Parameters in a Report Query 16-6
Using Bind References 16-8
Using Lexical References 16-10
Hints and Tips When Referencing Parameters 16-12
Creating a List of Values 16-14
Referencing System Parameters 16-18
Building a Paper Parameter Form 16-20
Customizing a Paper Parameter Form 16-22
Using Parameter Form HTML Extensions 16-24
Parameter Form Header and Footer 16-26
Summary 16-27
Practice 16 Overview 16-28
17 Embedding a Graph in a Report
Objectives 17-2
Adding a Graph to a Paper Report 17-3
Adding a Graph to a Web Report 17-5
Selecting the Graph Type 17-6
Selecting the Graph Data 17-7
Adding Options to the Graph 17-8
Customizing Web Graphs 17-10
The rw:graph Tag 17-11
Customizing Graphs Using the Graph.XML File 17-13
Using Graph Hyperlinks 17-15
Summary 17-18
Practice 17 Overview 17-19
18 Enhancing Matrix Reports
Objectives 18-2
The Matrix Data Model 18-3
The Matrix Paper Layout 18-5
Creating Matrix Summaries 18-7
Creating the Matrix Manually 18-9
The Matrix with Group Data Model 18-11
The Matrix with Group Layout 18-12
Building a Nested Matrix 18-13
Nested Matrix Paper Layout 18-15

ix

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Nested Matrix Summaries 18-17
Displaying Zeros 18-19
Summary 18-21
Practice 18 Overview 18-22
19 Coding PL/SQL Triggers
Objectives 19-2
Types of Triggers in Reports 19-3
Trigger Code 19-5
Using Report Triggers 19-6
Using Data Model Triggers: PL/SQL Group Filter 19-10
Using Data Model Triggers: Parameter Validation 19-12
Using Layout Triggers 19-14
Using a Format Trigger on a Frame 19-16
Using a Format Trigger on a Repeating Frame 19-18
Using a Format Trigger on a Field 19-20
Using a Format Trigger in a Web Layout 19-21
Using a Format Trigger on a Boilerplate Object 19-22
Writing Common Code 19-24
Event-Based Reporting 19-26
Event-Driven Publishing API 19-27
Invoking a Report from a Database Event 19-29
Summary 19-31
Practice 19 Overview 19-33
20 Extending Functionality Using the SRW Package
Objectives 20-2
Contents of the SRW Package 20-3
Outputting Messages 20-5
Executing a Nested Report 20-7
Restricting Data 20-11
Initializing Fields 20-13
Creating a Table of Contents 20-15
Performing DDL Statements 20-17
Setting Format Attributes 20-19
Using Format Attributes in a Web Layout 20-22
Summary 20-24
Practice 20 Overview 20-25
21 Maximizing Performance Using OracleAS Reports Services
Objectives 21-2
Running Reports Using OracleAS Reports Services 21-3
Report Request Methods 21-5
Oracle Application Server Components 21-7
Enabling Single Sign-On Access 21-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running the Web Layout: JSP Run-time Architecture 21-11
Running the Paper Layout: Servlet Run-time Architecture 21-12
Running a Paper Report on the Web 21-13
Running a Report from the Command Line 21-15
The OUTPUTIMAGEFORMAT Parameter 21-16
The Schedule Parameter 21-17
Reports Caching 21-19
Using Oracle Enterprise Manager 21-20
Managing and Monitoring OracleAS Reports Services 21-21
What Is the Queue Manager? 21-22
Queue Manager 21-23
Using the Queue Manager 21-25
Summary 21-26
Practice 21 Overview 21-27

22 Building Reports: Efficiency Guidelines


Objectives 22-2
Tuning Reports 22-3
Performance Measurement 22-5
Non SQL Data Sources 22-6
Investigating the Data Model 22-8
Investigating the Paper Layout 22-12
Running the Report 22-14
Different Development and Run-Time Environments 22-16
Developing Reports to Run in Different GUIs 22-18
Setting NLS Language Environment Variables 22-20
Translating an Oracle Reports Application 22-22
Summary 22-24
Practice 22 Overview 22-25

Appendix A - Practice Solutions

Appendix B - Table Descriptions

Appendix C - Creating Web Layout Templates

Glossary

xi

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Preface

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Profile
Before You Begin This Course
Before you begin this course, you should have:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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:
Oracle Database 10g: SQL Fundamentals I
Oracle Database 10g: PL/SQL Fundamentals
Oracle Database 10g: Develop PL/SQL Program Units
Or the following Self-Study CD courses:
Introduction to Oracle9i: SQL
Oracle SQL: Basic SELECT Statements
Oracle SQL: Data Retrieval Techniques
Oracle SQL: DDL and DML
Oracle9i PL/SQL Fundamentals
PL/SQL: Basics
Oracle9i: Develop PL/SQL Program Units
PL/SQL: Database Programming
PL/SQL: Procedures, Functions and Packages
Note: Use the Oracle9i Self-Study CD courses until the equivalent Oracle Database
10g courses become available.
Suggested
Oracle Database 10g: SQL Fundamentals II (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)

Preface - 3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
How This Course Is Organized
Oracle Reports Developer 10g: Build Reports is an instructor-led course featuring lecture
and hands-on exercises. Online demonstrations and written practice sessions reinforce the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
concepts and skills introduced.

Preface - 4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Executing Reports Using Reports Services with Oracle Developer Suite 10g
Oracle Developer Suite 10g contains an embedded Oracle Container for J2EE (OC4J) and
OracleAS Reports Services. This enables developers to test the reports deployment without

Oracle University Internal and TransAmerica Training Management Inc Partner use only
installing Oracle Application Server. This environment is provided as a testing environment
only, and is not a replacement for an appropriate production environment using Oracle
Application Server.
To test your reports:
1. Create the following directories:
a. $ORACLE_HOME\reports\j2ee\reports_ids\web\test
b. $ORACLE_HOME\reports\j2ee\reports_ids\web\test\css
c. $ORACLE_HOME\reports\j2ee\reports_ids\web\test\images
2. Copy the template images and style sheets as follows:
a. Copy $ORACLE_HOME\reports\docroot\css to
$ORACLE_HOME\reports\j2ee\reports_ids\web\test\css
b. Copy $ORACLE_HOME\reports\docroot\images to
$ORACLE_HOME\reports\j2ee\reports_ids\web\test\images
3. Add the $ORACLE_HOME\reports\j2ee\reports_ids\web\test directory
to the "REPORTS_PATH" environment variable using Start > Run > regedit
4. Start OC4J using Start > Programs > Oracle Developer Suite oracle_home >
Reports Developer > Start OC4J instance
Note: Do not close the DOS window since it is being used by the running OC4J
instance.
5. Copy your reports to $ORACLE_HOME\reports\j2ee\reports_ids\web\test
6. Locate your computer name using Start > Settings > Control Panel > System >
Network Identification Tab
7. Locate the Web site port number by inspecting the file $ORACLE_HOME
\j2ee\DevSuite\config\default-web-site.xml (e.g. 8889)
8. Test your paper reports using the reports servlet, for example,
http://Computer_Name:port_number/reports/rwservlet?report=
myReport.jsp&userid=username/password@dbName&destype=cache
&desformat=PDF
9. Test your Web reports using the JSP Engine, for example,
http://Computer_Name:port_number/reports/test/
myReport.jsp?userid=username/password@dbName
Note: The first time a Web report executes using the JSP engine, the OC4J needs to
compile the JSP report and it typically takes some time. All the subsequent report
executions using the JSP engine are fast.

Preface - 5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Resources
Oracle Publications

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Title Part Number
Oracle Reports Tutorial B10612-01

Oracle Reports Building Reports, Volumes 1 and 2 B10602-01

Oracle Developer Suite 10g (9.0.4) Release Notes for Windows and B10668-01
UNIX [Chapter 9: Oracle Reports]
Oracle Application Server Reports Services Publishing Reports to B10314-01
the Web

Additional Publications
System release bulletins
Installation and users guides
read.me files
International Oracle Users Group (IOUG) articles
Oracle Magazine
Web Sites
Oracle Technology Network: http://otn.oracle.com
Oracle Reports Frequently Asked Questions (FAQ):
http://otn.oracle.com/products/reports/htdocs/faq.htm
Oracle Reports whitepapers, presentations, and viewlets:
http://otn.oracle.com/products/reports/content.html
Getting Started with Oracle Reports:
http://otn.oracle.com/products/reports/htdocs/getstart/
GettingStarted/index/index.html

Preface - 6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Typographic Conventions
Typographic Conventions In Text

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Convention Element Example
Bold Emphasized words and phrases To navigate within this application, do not
in Web content only click the Back and Forward buttons.

Bold italic Glossary terms (if there is a The algorithm inserts the new key.
glossary)

Brackets Key names Press [Enter].

Caps and Buttons, Click the Executable button.


lowercase check boxes, Select the Registration Required check
triggers, box.
windows
Assign a When-Validate-Item trigger.
Open the Master Schedule window.

Carets Menu paths Select File > Save.

Commas Key sequences Press and release these keys one at a


time:
[Alt], [F], [D]

Preface - 7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Typographic Conventions (continued)
Typographic Conventions In Text (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Convention Object or Term Example
Courier New, Code output, Code output: debug.seti (I,300);
case sensitive SQL and PL/SQL SQL code elements: Use the SELECT command to view
code elements, Java
information stored in the last_name column of the emp
code elements,
table.
directory names,
filenames, Java code elements: Java programming involves the
passwords, String and StringBuffer classes.
pathnames, URLs, Directory names: bin (DOS), $FMHOME (UNIX)
user input,
usernames Filenames: Locate the init.ora file.
Passwords: Use tiger as your password.
Pathnames: Open c:\my_docs\projects.
URLs: Go to http://www.oracle.com.
User input: Enter 300.
Usernames: 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 in print For further information, see Oracle7 Server SQL
publications, titles of Language Reference Manual.
books and courses,
variables Enter user_id@us.oracle.com, where user_id is
the name of the user.
Plus signs Key combinations Press and hold these keys simultaneously:
[Control] + [Alt] + [Delete]

Quotation Lesson and chapter This subject is covered in Unit II, Lesson 3, Working with
marks titles in cross Objects.
references, interface
elements with long Select the Include a reusable module component and
names that have only click Finish.
initial caps
Use the WHERE clause of query property.

Preface - 8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Typographic Conventions (continued)
Typographic Conventions in Navigation Paths

Oracle University Internal and TransAmerica Training Management Inc Partner use only
This course uses simplified navigation paths, such as the following example, to direct you
through Oracle Applications.
Example:
Invoice Batch 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, select Query > Find.
3. (B) Click the Approve button.
Notation:
(N) = Navigator (I) = Icon
(M) = Menu (H) = Hyperlink
(T) = Tab (B) = Button

Preface - 9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Introduction

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Course Objectives

After completing this course, you should be able to do


the following:
Describe the capabilities of Oracle 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 2004, Oracle. All rights reserved.

Course Objectives
This course enables you to design and build a variety of standard and custom Web and
paper reports using Oracle 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 OracleAS Reports Services to deploy your reports.

Oracle Reports Developer 10g: Build Reports I-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Course Content

Day 1:
Introducing Oracle Reports Developer
Designing and running reports
Working in Oracle 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 2004, Oracle. All rights reserved.

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 Oracle Reports Developer
Designing and Running Reports
Working in Oracle 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

Oracle Reports Developer 10g: Build Reports I-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Course Content (continued)


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

Oracle Reports Developer 10g: Build Reports I-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Course Content

Day 5:
Extending functionality using the SRW package
Using OracleAS Reports Services
Efficiency and performance guidelines

Copyright 2004, Oracle. All rights reserved.

Course Content (continued)


Day 5
Extending Functionality Using the SRW Package
Maximizing Performance Using OracleAS Reports Services
Building Reports: Efficiency Guidelines

Oracle Reports Developer 10g: Build Reports I-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Introduction to Oracle Reports Developer

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle Reports
Developer
Describe the architecture of Oracle Application
Server
Describe OracleAS Reports Services

Copyright 2004, Oracle. All rights reserved.

Overview
Oracle Reports Developer is a powerful enterprise 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 Oracle Reports Developer and its
relationship with Oracles end-to-end business intelligence solution.

Oracle Reports Developer 10g: Build Reports 1-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Business Intelligence
Discoverer Server Reports Server

XML

Copyright 2004, Oracle. All rights reserved.

What Is Business Intelligence?


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).
Oracle offers an integrated business intelligence solution that provides the user with a
complete picture across the entire organization. The Oracle 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 Reports Developer 10g: Build Reports 1-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
What Is Business Intelligence? (continued)
Oracles set of integrated BI tools allow you to seamlessly move between the roles of

Oracle University Internal and TransAmerica Training Management Inc Partner use only
information consumer and information investigator:
Oracle Warehouse Builder (OWB) is designed to consolidate disparate data sources,
performs any required data transformations, manage warehouse lifecycle, and
integrate with analysis tools.
OracleAS 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.
Oracle 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. Oracle Reports is the solution for Web and paper
publishing, enabling you to publish any data, in any format, anywhere. Oracle 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 OracleAS Reports Services.

Oracle Reports Developer 10g: Build Reports 1-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 1-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Enterprise Reporting (continued)
Enterprise reporting offers a number of important benefits. These include:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 1-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enterprise Reporting

Reporting

Ad hoc query

Advanced
Web Client analysis

Data Server
Application Server

Copyright 2004, Oracle. All rights reserved.

Enterprise Reporting (continued)


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 Oracles reporting
architecture is Oracle Application Server. OracleAS Reports Services, the report
publishing component of Oracle Application Server, provides out-of-the-box
optimized performance and scalability to run Oracle Reports applications in Web and
non Web environments.
High quality reports:
Enterprise reporting uses the Internet as its conduit for information delivery. Oracle
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.

Oracle Reports Developer 10g: Build Reports 1-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Enterprise Reporting (continued)
Reduced time to market:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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. Oracle 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 Oracle Reports
Developer generates the code automatically, making this an extremely productive
development environment.

Oracle Reports Developer 10g: Build Reports 1-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Web Publishing

GIF89a

hyperlinks

JavaScript

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 1-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Paper Publishing

8.5

GIF89a

hyperlinks
11

JavaScript

Copyright 2004, Oracle. All rights reserved.

Web Publishing and Paper Publishing (continued)


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, Oracle
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.

Oracle Reports Developer 10g: Build Reports 1-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Reports Developer

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


destination with high fidelity.

JDBC

OLAP

XML

TEXT

<Your Data Source>

Copyright 2004, Oracle. All rights reserved.

Oracle Reports Developer


Oracle 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 Oracle 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 Oracle Reports is to be the universal publishing solution of choice for any
publishing need within an organization.

Oracle Reports Developer 10g: Build Reports 1-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Benefits

Publish data from any source, in any format, with


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

Copyright 2004, Oracle. All rights reserved.

Benefits
Oracle 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 your 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.
Oracle 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 Oracle Reports: JavaServer
Pages (JSPs), servlets, JavaBeans, CORBA, and IIOP information protocol.
- Flexible design fits any middle-tier configuration.
Oracle Reports Developer 10g: Build Reports 1-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle 10g Products

Oracle 10g provides the complete solution:


Oracle Database 10g
Oracle Developer Suite 10g
Oracle Application Server 10g

Copyright 2004, Oracle. All rights reserved.

Oracle 10g Products


Oracle 10g 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: Oracle Database 10g, Oracle Application
Server 10g and Oracle Developer Suite 10g.

Oracle Reports Developer 10g: Build Reports 1-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Database 10g

Oracle Database 10g manages all of your data:


Relational Data

Documents

Multimedia

Copyright 2004, Oracle. All rights reserved.

Oracle Database 10g


The Oracle 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.

Oracle Reports Developer 10g: Build Reports 1-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Developer Suite 10g

Application Development

Copyright 2004, Oracle. All rights reserved.

Oracle Developer Suite 10g


The Oracle 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. Oracle Developer Suite 10g combines leading Oracle
application development and business intelligence tools into a single integrated product.
Built on Internet standards such as Java and XML, Oracle Developer Suite provides a
complete development environment.
The components of Oracle Developer Suite 10g include Oracle Designer, Oracle Forms
Developer, Oracle JDeveloper, Oracle Software Configuration Manager, Oracle
Discoverer, Oracle Reports Developer, Oracle Warehouse Builder, and Oracle Business
Intelligence Beans.

Oracle Reports Developer 10g: Build Reports 1-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle Developer Suite 10g (continued)
For application development, Oracle Developer Suite 10g provides capabilities in:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modeling: Oracle Designer 10g delivers dramatic increases in productivity for
database application developers. Oracle Designer provides a complete toolset to
model, design, generate, and capture the enterprise application requirements.
Rapid Application Development (RAD): RAD capabilities in Oracle Developer
Suite feature integrated builders, reentrant wizards, live previewers, and property
inspectors.
Oracle JDeveloper is an integrated development environment with end-to-end support
for modeling, developing, debugging, optimizing, and deploying Java applications and
Web services. Oracle JDeveloper 10g introduces a new approach to J2EE
development with features that enable visual and declarative development. The
innovative Oracle Application Development Framework simplifies J2EE
development. Oracle Jdevelopers productivity with choice offers a choice of:
development approach, technology scope, and deployment platform.
J2EE and Web Services: Oracle Developer Suite 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: Oracle Software Configuration Management provides versioning,
dependency management, and impact analysis for all objects and file types.

Oracle Reports Developer 10g: Build Reports 1-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Developer Suite 10g

Business Intelligence

Copyright 2004, Oracle. All rights reserved.

Oracle Developer Suite 10g (continued)


For business intelligence, Oracle Developer Suite provides the capabilities for:
Extract, Transform, and Load: Oracle Warehouse Builder provides an easy to use,
graphical environment for rapidly designing, deploying, and managing business
intelligence systems. It also provides an extensible framework for integrating a diverse
set of data sources with BI tools.
End User Query and Analysis: With Oracle Discoverer, you can create, modify, and
execute ad hoc queries and reports. More casual users can view and navigate through
predefined reports and graphs. Discoverer provides a business view to hide the
complexity of the underlying data structure. It enables you to focus on solving
business problems and brings insight to your data.
Enterprise Reporting: Oracle Reports Developer enables you to access any data,
publish it in any format, and send it to any destination.

Oracle Reports Developer 10g: Build Reports 1-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Application Server 10g

Oracle DB
Browser Non-Oracle

Packaged
Wireless Apps

Web B2B Apps


Services

Copyright 2004, Oracle. All rights reserved.

Oracle Application Server 10g


Oracle Application Server 10g is a comprehensive and integrated application server that
runs any Web site, portal, or Internet application. Oracle Application Server 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
Oracle Application Server. Some of these requests are processed by the Oracle HTTP
Server and some requests are routed to other areas of Oracle Application Server for
processing.
Presentation Services: The presentation services of Oracle Application Server
generally output some kind of graphical representation, often in the form of HTML.
Oracle Application Server 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.

Oracle Reports Developer 10g: Build Reports 1-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle Application Server 10g (continued)
Business Logic Services: Oracle Application Server provides several ways to develop

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle Forms Developer and
Oracle Reports Developer.
Data Management Services: To reduce the load on the database instance and to
avoid network roundtrips for read-only data, Oracle Application Server includes
Oracle Application Server Web Cache.
System Services: To provide system management and security services, Oracle
Application Server 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.
Technical Note
For more information on Oracle Application Server, refer to the Oracle Technology
Network: http://otn.oracle.com.

Oracle Reports Developer 10g: Build Reports 1-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle 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 2004, Oracle. All rights reserved.

What Is Oracle Reports Developer?


Oracle Reports Developer is a component of the Oracle Developer Suite. Oracle 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 Oracle 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

Oracle Reports Developer 10g: Build Reports 1-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
What Is Oracle Reports Developer? (continued)
Web publishing tools that dynamically generate Web pages based on your data

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle Reports with OracleAS Portal for administering report
security
The ability to publish report output to portlets
Report execution based on database events

Oracle Reports Developer 10g: Build Reports 1-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
OracleAS Reports Services

Flexible reporting
Reduced overhead
Fast distribution
Real time publishing

Copyright 2004, Oracle. All rights reserved.

OracleAS Reports Services


OracleAS Reports Services, a component of Oracle Application Server, provides the
deployment environment for Oracle Reports Developer applications. OracleAS Reports
Services executes, distributes, and publishes your reports for enterprise wide reporting.
Using OracleAS 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.
OracleAS 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.

Oracle Reports Developer 10g: Build Reports 1-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
OracleAS Reports Services Architecture
for the Web

HTTP

Oracle HTTP Listener


mod_OC4J
JSP Engine
Oracle Internet Directory

CORBA/IIOP CORBA/IIOP
Reports
OracleAS
Engine
Reports Services
PDS

Copyright 2004, Oracle. All rights reserved.

OracleAS Reports Services Architecture


In a Web environment, OracleAS Reports Services can consist of four tiers:
The client tier (a Web browser)
The Web server tier
The OracleAS Reports Services tier
The data tier (databases and pluggable data sources)

Oracle Reports Developer 10g: Build Reports 1-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
OracleAS Reports Services Architecture (continued)
The major components of OracleAS Reports Services include:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
OracleAS 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: OracleAS Reports Services and report deployment will be covered in more detail in
a later lesson.

Oracle Reports Developer 10g: Build Reports 1-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle 10g products
List the key features and benefits of Oracle Reports
Developer
Describe OracleAS Reports Services

Copyright 2004, Oracle. All rights reserved.

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.
Oracle Reports Developer enables you to create and deploy reports using any data, in
any format, for any medium.
The Oracle 10g products provide the infrastructure to easily develop, deploy, and
manage Internet applications and Web sites. Oracle Reports Developer is a component
of the Oracle Developer Suite. Reports created with Oracle Reports are deployed by
Oracle Application Server, specifically OracleAS Reports Services.

Oracle Reports Developer 10g: Build Reports 1-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Designing and Running Reports

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 2-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Understanding User Requirements

What data Web features


Parameters Security

Web or Charts
Paper Drill down

Copyright 2004, Oracle. All rights reserved.

Understanding 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

Oracle Reports Developer 10g: Build Reports 2-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Understanding User Requirements (continued)
Helpful questions to help you determine the user requirements:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 OracleAS Portal Reports Security option.
Will the users want run-time customizations? If so, plan on using XML files.

Oracle Reports Developer 10g: Build Reports 2-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Designing Reports

Before you start development, consider:

Specification
Data retrieval
Common features
Structure

Style

Publishing
Medium

Copyright 2004, Oracle. All rights reserved.

Designing Reports
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.

Oracle Reports Developer 10g: Build Reports 2-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Designing Reports (continued)
The majority of report requirements fall into the following categories:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Tabular
Master-detail
Master and multiple details
Matrix

Oracle Reports Developer 10g: Build Reports 2-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Tabular
List of Products

Product
Number Description Price

Copyright 2004, Oracle. All rights reserved.

Tabular Report Style


You 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.
In the List of Products report displayed above, 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.

Oracle Reports Developer 10g: Build Reports 2-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Master-Detail
Outstanding Customer Items

Customer Name
Product
Number Price

Customer Name
Product
Number Price

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 2-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Master with Two Details
Customer Statistics

Customer

Outstanding Orders in Last


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

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 2-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Matrix

Customer Matrix

Product ID
Customer

Copyright 2004, Oracle. All rights reserved.

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.
The matrix style is the only style in which a detail group is related to two different master
groups at the same level.

Oracle Reports Developer 10g: Build Reports 2-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Retrieving and Sharing Data


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

Oracle Reports Developer 10g: Build Reports 2-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Retrieving and Sharing Data (continued)
Report Structures

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle 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.

Oracle Reports Developer 10g: Build Reports 2-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running a Report

Your browser
OracleAS Portal application
Command line (Start > Run)
OracleAS Reports Queue Manager
Java application
Database trigger
Menu integrated with a Forms application
Button in a Forms application

Copyright 2004, Oracle. All rights reserved.

Running a Report
There are many ways of running a report, depending on the application design. You can
call a report from:
A Web browser
An OracleAS Portal application
The command line, using the Start > Run option in Windows
The OracleAS Reports Queue Manager

Oracle Reports Developer 10g: Build Reports 2-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Running a Report (continued)
A Java application

Oracle University Internal and TransAmerica Training Management Inc Partner use only
A database trigger
A customized menu in a Forms application
A button in a Forms application

Oracle Reports Developer 10g: Build Reports 2-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Previewing Reports

Copyright 2004, Oracle. All rights reserved.

Previewing Reports
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 iconic 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.

Oracle Reports Developer 10g: Build Reports 2-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Print Preview

1
2

Copyright 2004, Oracle. All rights reserved.

1 Print, Page Setup, and Mail options


2 Page options: First, Previous, Next, Last
3 Go to specific page number
Previewing Reports (continued)
Print Preview
Select File > Print Preview to display your formatted paper report. Your output displays
in 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 Button Description


First Page Go to first page Page Go to the page number
Previous Page Go to previous page that you enter in the field
Next Page Go to next page Print Print the report
Last Page Go to last page Mail Send report to a SMTP-
compliant mail system

Oracle Reports Developer 10g: Build Reports 2-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Print Preview

1 2 3

Copyright 2004, Oracle. All rights reserved.

1 New Previewer, Close Previewer options


2 Zoom in, zoom out tools
3 Drag this rectangle to split Previewer horizontally
4 Drag this rectangle to split Previewer vertically

Previewing Reports (continued)


To view the contents of more than one page at the same time, click New Previewer to
open another Previewer window. Close each Previewer window individually.
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.
Note: To remove the split, drag the rectangle back to its original position.

Oracle Reports Developer 10g: Build Reports 2-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Previewing Reports (continued)
Zoom in and zoom out buttons are available on the toolbar. Select the large plus sign to

Oracle University Internal and TransAmerica Training Management Inc Partner use only
zoom in and the small minus sign to zoom out.

Oracle Reports Developer 10g: Build Reports 2-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Supported File Types

RDF
REP
JSP
HTML
XML

Copyright 2004, Oracle. All rights reserved.

Supported File Types


As you will learn in later lessons, report definitions created with Oracle Reports can be
saved in a variety of formats and then deployed with Oracle Application Server.

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

Oracle Reports Developer 10g: Build Reports 2-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Supported File Types (continued)
Reports defintions RDF and REP are owned by Oracle Reports. In other words, you will

Oracle University Internal and TransAmerica Training Management Inc Partner use only
need to use Oracle 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 Oracle 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.

Oracle Reports Developer 10g: Build Reports 2-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 2-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 2 Overview

Executing existing reports

Copyright 2004, Oracle. All rights reserved.

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
This practice session consists of a combination of practical and paper-based questions.

Oracle Reports Developer 10g: Build Reports 2-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 2
1. Invoke the Reports Builder executable.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
e. Run the paper layout again. This time do not specify a customer ID.
i. What is the result?
ii.In a production situation, what should happen in this instance?
f. Close the Paper Design view.

Oracle Reports Developer 10g: Build Reports 2-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 2 (continued)
g. Run the paper layout again. This time enter Customer ID 999.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 2-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Working in Oracle Reports Developer

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


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

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 3-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Reports Developer Executables


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

Oracle Reports Developer 10g: Build Reports 3-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Reports Developer Executables (continued)
The main Reports Developer executables are:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
NT Filename Executable Title Description

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.

Oracle Reports Developer 10g: Build Reports 3-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Invoking Reports Builder

Copyright 2004, Oracle. All rights reserved.

Invoking Reports Builder


In this lesson, you invoke Reports Builder, the rwbuilder executable, and look at the
definitions of some reports to describe the components and objects in the builder.
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.
To display the Welcome dialog box:
1. Select Edit > Preferences.
2. Select the Wizards tab.
3. Select the Welcome Dialog check box.

Oracle Reports Developer 10g: Build Reports 3-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Reports Builder Modules

Report Template PL/SQL Library

Copyright 2004, Oracle. All rights reserved.

Reports Builder
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.
The Reports Builder module types are:
Module Type Description
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 unitsprocedures,
Library functions, packagesthat can be called from multiple reports

Oracle Reports Developer 10g: Build Reports 3-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Data and Layout

Paper

Web

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 3-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Reports Builder Components

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 3-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Reports Builder Components (continued)
Property Inspector

Oracle University Internal and TransAmerica Training Management Inc Partner use only
All objects in a module, including the module itself, have properties that you can see and
modify in the Property Inspector. Features include:
Expandable and collapsible nodes
In-place property editing
Search features
Multiple selection of objects
Complex property dialogs
Ability to invoke multiple instances of the Property Inspector
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.

Oracle Reports Developer 10g: Build Reports 3-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Main Menu Structure

Copyright 2004, Oracle. All rights reserved.

Navigating Around the Oracle Reports Main Menu


The main menu contains options to enable you to create, modify, and manage your
Reports Builder modules.
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

Oracle Reports Developer 10g: Build Reports 3-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Navigating Around the Oracle Reports Main Menu (continued)
The main menu options in Reports Builder are:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Menu Item Description
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.

Oracle Reports Developer 10g: Build Reports 3-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Wizards

Report Wizard
Data Wizard
Graph Wizard
Report Block Wizard

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 3-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Editor

Data Model
Web Source
Paper Layout
Paper Design
Paper Parameter Form

Copyright 2004, Oracle. All rights reserved.

The Report Editor


The Report Editor contains views to handle the data objects and layout objects separately:
View Description
Data Displays a structural representation of the data in a report. The
Model 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.
Web Displays the HTML / JSP source for a report. You can use this view to add
Source 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 Displays the layout objects in a paper report and allows you to make many
Layout 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.

Oracle Reports Developer 10g: Build Reports 3-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The Report Editor (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
View Description
Paper Displays output for paper reports and allows you to make many
Design 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 Displays the layout of the Paper Parameter Form that, at run time, allows
Parameter user input of parameter values.
Form

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
Oracle Reports is integrated with Oracle JDeveloper to enable Java developers to leverage
the powerful publishing capabilities of Oracle Reports within their Java applications. You
can create a new JSP-based Web report or a Pluggable Destination from within Oracle
JDeveloper. You can also debug a Reports JSP from within JDeveloper. For more
information, see the Oracle Technology Network (http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 3-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
PL/SQL Development Environment:
Syntax Palette

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 3-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Object Navigator

Copyright 2004, Oracle. All rights reserved.

Object Categories
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.

Oracle Reports Developer 10g: Build Reports 3-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report-Level Objects

Properties
Triggers
PL/SQL Program Units
Attached Libraries

Copyright 2004, Oracle. All rights reserved.

Object Categories (continued)


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

Oracle Reports Developer 10g: Build Reports 3-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Data Model Objects

Parameters
Queries
Groups
Columns
Data Links

Copyright 2004, Oracle. All rights reserved.

Object Categories (continued)


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
Parameters Provide for run-time defaults or user input; system parameters exist by
default; you can also create user parameters
Queries Select the data for your report
Groups 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 Links 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 parameters in the
Object Navigator and modify them in the Property Inspector.
Oracle Reports Developer 10g: Build Reports 3-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Paper Layout Objects

Frames
Repeating frames
Fields
Boilerplate

Copyright 2004, Oracle. All rights reserved.

Object Categories (continued)


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.

Oracle Reports Developer 10g: Build Reports 3-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Paper Parameter Form Objects

Fields
Boilerplate

Copyright 2004, Oracle. All rights reserved.

Object Categories (continued)


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.

Oracle Reports Developer 10g: Build Reports 3-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Object Interrelationship
1
Select
...

2
3

Copyright 2004, Oracle. 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.

Object Interrelationship
Now that you know the different categories of objects, it is also important to understand
the relationship between these objects. The diagram above 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.

Oracle Reports Developer 10g: Build Reports 3-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Your Oracle Reports
Developer Session

Copyright 2004, Oracle. All rights reserved.

Customizing Your Oracle Reports Session


Reports Builder 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.

Oracle Reports Developer 10g: Build Reports 3-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Saving Preferences

1 2

Copyright 2004, Oracle. All rights reserved.

Saving Preferences
There are four tab pages in the Reports Preferences dialog box. Press the Help key ([F1]
in Windows) 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 Set the unit of measurement that you want to use for
Measurement 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.
Oracle Reports Developer 10g: Build Reports 3-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Reports Environment Variables

REPORTS_PATH
REPORTS_TMP
REPORTS_RESOURCE
ORACLE_PATH
REPORTS_CLASSPATH
Windows: Modify in Registry

Copyright 2004, Oracle. All rights reserved.

Oracle Reports Environment Variables


Oracle 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
Oracle 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

Oracle Reports Developer 10g: Build Reports 3-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle Reports Environment Variables (continued)
Generic Oracle Path

Oracle University Internal and TransAmerica Training Management Inc Partner use only
ORACLE_PATH is an additional path that all Oracle Developer Suite 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.

Oracle Reports Developer 10g: Build Reports 3-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using the Online Help System

Copyright 2004, Oracle. All rights reserved.

Using the Online Help System


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.
Getting Started This option will navigate you to the Oracle Reports home page on
the Oracle Technology Network (http://
otn.oracle.com/products/reports/content.html).
From here you can access Getting Started with Oracle Reports, a
self-paced tutorial on this release.
About Reports Appears as two panels:
Builder 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.

Oracle Reports Developer 10g: Build Reports 3-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Technical Note
In Oracle Reports Builder Developer 10g, the Quick Tour option in the Help menu that

Oracle University Internal and TransAmerica Training Management Inc Partner use only
was available in earlier releases such as Oracle Reports Builder 9.0.2.0.1, has been
changed to Getting Started.
The Oracle Reports online Help system is also accessible through the Oracle Technology
Network (http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 3-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Describe the Oracle 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 2004, Oracle. All rights reserved.

Summary
Oracle 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.

Oracle Reports Developer 10g: Build Reports 3-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 3 Overview

Invoking Reports Builder


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

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 3-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 3
1. Start Reports Builder and open the existing report: p3q1.jsp. Run the paper layout.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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?

Oracle Reports Developer 10g: Build Reports 3-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Paper Report

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
Preview a paper report on the Web

Copyright 2004, Oracle. All rights reserved.

Overview
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.
Oracle Reports enables you to easily model, design, and publish high fidelity Web reports.
You will learn about this in a later lesson.

Oracle Reports Developer 10g: Build Reports 4-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Module Components

Data Model
Web Source
Paper Layout
Paper Parameter Form
Program Units

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 4-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building a Paper Report

You have two options:


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

Copyright 2004, Oracle. All rights reserved.

Building a Paper Report


In Oracle 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 or Web 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.

Oracle Reports Developer 10g: Build Reports 4-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Invoking the Report Wizard

Copyright 2004, Oracle. All rights reserved.

Invoking Reports Builder and the Report Wizard


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

Oracle Reports Developer 10g: Build Reports 4-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Choosing the Layout Type

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

Copyright 2004, Oracle. All rights reserved.

Creating a Tabular Report Using the Wizard


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

Oracle Reports Developer 10g: Build Reports 4-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Tabular Report

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

Copyright 2004, Oracle. All rights reserved.

Creating a Tabular Report Using the Wizard (continued)


Report Styles
The second page of the Report Wizard shows the various styles of reports. Select Tabular
and then click Next.

Oracle Reports Developer 10g: Build Reports 4-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Tabular Report Using the Wizard (continued)
Wizard Pages

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
Type report.
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.

Oracle Reports Developer 10g: Build Reports 4-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Selecting the Data Source Type

Copyright 2004, Oracle. All rights reserved.

Selecting the Data Source Type


Next, you define the data source type for your report. Through the implementation of the
Pluggable Data Source (PDS) feature in Oracle 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, OLAP, JDBC, Text and XML pluggable data sources are shipped
with Oracle Reports. You can also define your own data source.
This lesson will use the default data source, SQL query.

Oracle Reports Developer 10g: Build Reports 4-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Query Builder

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 4-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building a Query

Copyright 2004, Oracle. All rights reserved.

Building a Query
To build a query using 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.

Oracle Reports Developer 10g: Build Reports 4-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Query Builder Functions

User-friendly interface: Alternative to writing SQL


syntax

1 2 3 4

Copyright 2004, Oracle. All rights reserved.

1 Column sequence
2 Define column
3 Sort
4 Logical operators for conditions
5 Conditions box for WHERE and HAVING clauses
6 Object type (T=Table, V= View, S=Synonym, A=Alias)
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.
You can use Query Builder to build almost any query that you can write as a SQL
SELECT statement.

Oracle Reports Developer 10g: Build Reports 4-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Query Builder Functions (continued)
You can select from a table, view, or synonym. The letter T, V, or S appears in the object

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 4-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Selecting Displayed Fields

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 4-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Totals and Labels

Copyright 2004, Oracle. All rights reserved.

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 (master/detail)
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.

Oracle Reports Developer 10g: Build Reports 4-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Selecting a Report Template

Enforce corporate standards


Create professional-looking paper reports easily

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 4-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Viewing the Paper Report Output

Copyright 2004, Oracle. All rights reserved.

1 Magnify tool
2 Page buttons

Viewing the Paper 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.
Oracle Reports Developer 10g: Build Reports 4-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Saving the Report Definition

Save changes frequently.

File > Save

File > Save As...

xxx.rdf yyy.rdf

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 4-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Reentering the Wizard

Select Tools > Report Wizard.


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

Copyright 2004, Oracle. All rights reserved.

Creating Other Report Styles


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.

Oracle Reports Developer 10g: Build Reports 4-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Other Report Styles (continued)
When you reenter the Report Wizard, you see a tab for each page. You can navigate

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 right of the previous field, across the page.
Each record appears on a new page.

Oracle Reports Developer 10g: Build Reports 4-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a New Report

2 1

Copyright 2004, Oracle. All rights reserved.

1 Reports node
2 Create object button
Creating a New Report
To create a new report with the Wizard when you are already in Reports Builder:
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.

Oracle Reports Developer 10g: Build Reports 4-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Break Reports

Break report styles:


Group Left, Group Above
Additional
wizard page:
Groups

Copyright 2004, Oracle. All rights reserved.

Creating Break Reports


When you select one of the break (or master-detail) stylesGroup Left or Group
Abovethe 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 and details to the right.
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 and details below.
Note: Do not select columns for the lowest (detail) group.

Oracle Reports Developer 10g: Build Reports 4-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Break Report Labels


In a Group Left report, all the labels appear above the fields.
In a Group Above report, labels for the bottom detail groups appear above the fields, as in
a tabular report.

Oracle Reports Developer 10g: Build Reports 4-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Mailing Labels and Letters

Wizard pages:
Style
Data
Text
Template

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 4-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Mailing Labels and Letters (continued)
You can type directly into the text area instead of selecting from the Available Fields list.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Oracle Reports Developer 10g: Build Reports 4-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Matrix Report

Three additional wizard pages:


Matrix rows
Matrix columns
Matrix cells

Copyright 2004, Oracle. All rights reserved.

Creating a Matrix Report


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

Oracle Reports Developer 10g: Build Reports 4-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Matrix Report (continued)
Creating a Matrix for Each Group Record

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 4-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Previewing a Paper Report in a Browser

Use Insert > Bookmark to create a bookmark for


your break report

Use File > Generate to File

Copyright 2004, Oracle. All rights reserved.

Previewing a Paper Report in a Web Browser


As you will learn in a later lesson, Oracle Reports enables you to easily create Web
reports. However, you can deploy your paper reports on the Web with Oracle 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.

Oracle Reports Developer 10g: Build Reports 4-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Previewing a Paper Report in a Browser

Copyright 2004, Oracle. All rights reserved.

Previewing a Paper Report in a Web Browser (continued)


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.

Oracle Reports Developer 10g: Build Reports 4-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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 Oracle Reports does offer the solution for creating true Web reports, you are able to
publish a paper report on the Web.
Oracle Reports Developer 10g: Build Reports 4-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 4-31

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 4
1. Create a tabular report, paper layout only, containing the following data. Use Query

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 each of the following fields on a new line: NAME,
STREET_ADDRESS, CITY, and STATE_PROVINCE. Include
COUNTRY_ID, and POSTAL_CODE on the same line.
d. Select No template and click Finish.
e. Save the report to a file named p4q4.rdf.

Oracle Reports Developer 10g: Build Reports 4-32

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 4 (continued)
5. Using the reentrant Wizard, modify the report to create a Form Letter style.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the query to include order information for each customer:
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 sum of the total values 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.

Oracle Reports Developer 10g: Build Reports 4-33

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 4 (continued)
8. Web-enable a paper report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 4-34

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enhancing a Basic Paper Report

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 5-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

What Is the Paper Design View?


The report Paper Design view is a WYSIWYG editor. All edits that you perform in the
Paper Design view are on live data.
Oracle 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.

Oracle Reports Developer 10g: Build Reports 5-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Paper Design Window
1

Copyright 2004, Oracle. All rights reserved.

1 Toolbar
2 Stylebar
3 Tool palette
4 Status bar

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 View pull-down menu.
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.

Oracle Reports Developer 10g: Build Reports 5-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Modifying a Report in the Paper Design View


In this section, you learn about 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

Oracle Reports Developer 10g: Build Reports 5-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Aligning Columns

Point and Select


select Align Right

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 5-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Setting a Format Mask

Change format masks from the stylebar

1 2 3 4 5

Copyright 2004, Oracle. All rights reserved.

1 Currency symbol
2 Percentage symbol
3 Thousand separator
4 Add decimal places
5 Remove decimal places

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

Oracle Reports Developer 10g: Build Reports 5-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Setting a Format Mask (continued)
To alter a numeric format:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 5-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Manipulating Objects

Clear fields
Move fields
Resize fields

Flex Mode adjusts layout during changes.

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 5-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Modifying Visual Attributes


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

Oracle Reports Developer 10g: Build Reports 5-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Modifying Visual Attributes (continued)
To modify color fills and lines:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 5-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Applying Conditional Formatting

Copyright 2004, Oracle. All rights reserved.

Applying Conditional Formatting


You can highlight or suppress objects using conditional formats.
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.

Oracle Reports Developer 10g: Build Reports 5-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Applying Conditional Formatting (continued)
Formatting is applied in the order that the format exceptions are listed; a format exception

Oracle University Internal and TransAmerica Training Management Inc Partner use only
overrides a previous format exception if both evaluate to TRUE.
To change the order of format exceptions in the Format Exceptions list:
1. You can select a format exception and click the Up or Down buttons to move it up
or down.
2. You can drag and drop the format exception item to the required position in the
Format Exception list.

Oracle Reports Developer 10g: Build Reports 5-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Inserting Page Numbers, Dates,
and Times

Inserted easily
Customizable extensions

Copyright 2004, Oracle. All rights reserved.

Inserting Page Numbers, Dates, and Times


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
Time of a report. You can define your own date and time format
masks.

Oracle Reports Developer 10g: Build Reports 5-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Inserting Page Numbers, Dates, and Times (continued)
The Insert Date and Time dialog box displays the current date in many different formats.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 5-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Dates

Copyright 2004, Oracle. All rights reserved.

Customizing Dates
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 Date and Time Format Mask Syntax topic in the Help system fully describes
the format mask syntax.

Oracle Reports Developer 10g: Build Reports 5-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 5-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 5 Overview

Modifying reports by applying changes in the Paper


Design view

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 5


This practice session involves modifying reports by applying changes in the Paper Design
view. You reuse some of the reports that you created in the last session.

Oracle Reports Developer 10g: Build Reports 5-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 5
1. Open report p4q2.rdf. Make the following changes in the Paper Design view:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Make the SALARY column right-justified. Do not forget to justify the column
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 hairline 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 text 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.

Oracle Reports Developer 10g: Build Reports 5-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 5 (continued)
If You Have Time

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 5-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Managing Report Templates

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Overview
In this lesson, you learn how to open and modify predefined Oracle Reports paper
templates and how to register a customized template in the predefined template list.
Technical Note
This lesson focuses on creating and modifying paper layout templates. For information on
creating a Web layout template, refer to Appendix C.

Oracle Reports Developer 10g: Build Reports 6-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Report Templates

For paper reports, you have three template options:


Predefined
User-defined
No template

Installation templates in:


<oracle_home>\reports\templates

Copyright 2004, Oracle. All rights reserved.

Using the Report Templates


The template page of the Report Wizard has three options for choosing a template for a
paper report:
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.

Oracle Reports Developer 10g: Build Reports 6-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modifying a Template

Margin Body

Copyright 2004, Oracle. All rights reserved.

Modifying a Template
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 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

Oracle Reports Developer 10g: Build Reports 6-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Modifying a Template (continued)
Modify template objects in the Template Editor or in the Object Navigator.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 6-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing the Template Margin

Include
objects
such as:
Images
Text
Page
Numbers
Date

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 6-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Customizing the Template Body

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 6-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding Web Links to a Template for
Report HTML Output

Copyright 2004, Oracle. All rights reserved.

Adding Web Links to a Template for Report HTML Output


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

Oracle Reports Developer 10g: Build Reports 6-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Adding Web Links to a Template for Report HTML Output (continued)
In most cases, you can define the Web links in the Property Inspector of the object. You

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 6-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Predefining Your Own Templates


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.
In this section, you learn 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.
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.

Oracle Reports Developer 10g: Build Reports 6-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Predefining Your Own Templates (continued)
To register a customized template in the predefined list in the Wizard:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 file 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.

Oracle Reports Developer 10g: Build Reports 6-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding a Template Preview Image

Image area is 200 x 150 pixels


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

Copyright 2004, Oracle. All rights reserved.

Adding a Template Preview 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.
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.

Oracle Reports Developer 10g: Build Reports 6-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 6-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 6 Overview

Customizing an existing template


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

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 6


This practice session contains:
Customizing an existing paper template
Applying the modified template to an existing report
In this practice session, you open an existing template, which is one of the standard
templates shipped with the Oracle 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.

Oracle Reports Developer 10g: Build Reports 6-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 6
1. Customize an existing template, adding a company logo and report title to the report

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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. Insert 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.
a. Open p4q3.rdf.
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. To see the entire
template layout structure, and recognize the difference between the master
group fields and the detail group fields, select View > Zoom > Zoom Out from
the menu.
b. Save your template as laketech2.tdf and close it.

Oracle Reports Developer 10g: Build Reports 6-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 6 (continued)
c. Create a new report, using the Report Wizard.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 6-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Web Report

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
Identify supported image formats for Web reports

Copyright 2004, Oracle. All rights reserved.

Overview
Oracle 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), Oracle Reports takes advantage of JavaServer Page (JSP) technology to deliver high
quality HTML pages for Web publishing.
In this lesson, you are 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.

Oracle Reports Developer 10g: Build Reports 7-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

What is JavaServer Page (JSP) Technology?


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.

Oracle Reports Developer 10g: Build Reports 7-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

JSP Advantages
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 Oracle Reports custom JSP tags.

Oracle Reports Developer 10g: Build Reports 7-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
JSP Advantages (continued)
Since the JavaServer Pages cleanly separate dynamic application logic from static HTML

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
For more information about JSP technology, see the JavaSoft Web site at http://
www.javasoft.com/products/jsp/.

Oracle Reports Developer 10g: Build Reports 7-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Simple JSP Example


Before you learn about Reports JSPs, lets 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.

Oracle Reports Developer 10g: Build Reports 7-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building a Web Report

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

Copyright 2004, Oracle. All rights reserved.

Building a Web Report


You can easily create Web reports using the declarative features in the Report Wizard.
Oracle 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 Oracle
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.

Oracle Reports Developer 10g: Build Reports 7-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using the Report Wizard

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 7-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Editor: Web Source View
Reports JSP
Custom Tag
Library
Start of report

Data model
information
HTML template
information

End of report

Copyright 2004, Oracle. All rights reserved.

Web Source View


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

Oracle Reports Developer 10g: Build Reports 7-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Web Source View (continued)
A Reports JSP includes both standard JSP tags and Reports custom JSP tags.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle 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.

Oracle Reports Developer 10g: Build Reports 7-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
JSP Tags

Standard JSP Tags


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

Copyright 2004, Oracle. All rights reserved.

JSP Tags
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 Oracle 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" %>

Oracle Reports Developer 10g: Build Reports 7-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
JSP Tags (continued)
Reports Custom JSP Tag Library

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The table below lists some of the custom JSP tags used in Oracle 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 identifies
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 system
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.

Oracle Reports Developer 10g: Build Reports 7-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Web Source Example

Copyright 2004, Oracle. All rights reserved.

Example
The Web Source in this example 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.

Oracle Reports Developer 10g: Build Reports 7-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Example (continued)
Modifying a Web Report Using the Report Wizard

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Definition
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
Oracle 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.

Oracle Reports Developer 10g: Build Reports 7-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Generating Output

Copyright 2004, Oracle. All rights reserved.

Generating Output
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
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.

Oracle Reports Developer 10g: Build Reports 7-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Generating Output (continued)
Another way to publish a report on a Web site is to create an OracleAS Portal component.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The OracleAS Portal component enables you to add a link to a report in an OracleAS
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 Oracle9iAS Reports
Services: Deploy Internet Reports. Also see the manual Oracle Application Server:
Publish Reports to the Web with OracleAS Reports Services.
More information on using OracleAS Portal for administering and publishing reports is
covered in the eClass Oracle9i Reports: Create Reports for the Web and Portals.

Oracle Reports Developer 10g: Build Reports 7-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Image Format Support

Source Image Formats: Destination Image formats:


JPG, JPEG JPG, JPEG
GIF GIF
PNG PNG
BMP BMP
TIFF
CGM
Progressive JPEG
Exif JPEG

Copyright 2004, Oracle. All rights reserved.

Image Format Support


Web publishing often includes dynamic media content, from animated images to full-
blown animations and streaming content. The quality of images contributes considerably
to the overall appearance of a report, particularly for a Web report. You may prefer to use
different image formats in your report output depending upon your needs. For example, an
aeronautical firm might prefer the higher quality of Joint Photographic Experts Group
(JPEG) or Portable Network Graphics (PNG) images in their Web reports instead of
graphics interchange format (GIF) images. On the other hand, if you are building a Web
portal, you might prefer GIF images because of their smaller size and faster download
time. Similarly, you may wish to import images of these various formats into your report.
Depending on the format of your output, Oracle Reports enables you to choose from a
variety of formats for your images. The enhancements in imaging support provide you
with the capability to generate complex graphics-intensive reports with high fidelity
image output.

Oracle Reports Developer 10g: Build Reports 7-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Image Format Support (continued)
Oracle Reports supports the following formats:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Source Image Formats:
- JPEG / JPG: Joint Photographic Experts Group
- GIF: graphics interchange format
- PNG: Portable Network Graphics
- BMP: bitmap
- TIFF: tag image file format
- CGM: computer graphics metafile
- Progressive JPEG: a JPEG image that comes into focus while it is being displayed
- Exif JPEG: exchangeable image file (Exif) format is an international specification
that lets imaging companies encode metadata information into the headers or
application segments of a JPEG file. This metadata information includes shutter
speed, aperture, and the date and time the image was captured.
Destination Image formats:
- JPEG / JPG
- GIF
- PNG
- BMP
You learn how to specify the format for images in your report output later in the course.

Oracle Reports Developer 10g: Build Reports 7-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 7-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 7 Overview

Creating Web reports using the Report Wizard


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

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 7-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 7
1. Create a tabular report, Web and paper layout, entitled Compensation Report. The

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 7-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enhancing Reports Using the Data Model:
Queries and Groups

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 8-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Data Model Objects

Copyright 2004, Oracle. All rights reserved.

The Data Model Objects


The Data Model defines the report data and its hierarchythat 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 consists of these objects:
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, Oracle 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.

Oracle Reports Developer 10g: Build Reports 8-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The Data Model Objects (continued)
The objects that the Report Wizard creates by default depend on the style of report that

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 8-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modifying Properties of a Query

Copyright 2004, Oracle. All rights reserved.

Modifying Properties of a Query


You can modify a query, including the SQL statement, by changing properties in the
query Property Inspector.
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.
Modifying Columns
If you add to, rename, or delete a column or expression in the query statement, Oracle
Reports automatically creates, revises, or deletes the corresponding column in the Data
Model.

Oracle Reports Developer 10g: Build Reports 8-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Modifying Properties of a Query (continued)


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

Oracle Reports Developer 10g: Build Reports 8-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Modifying Properties of a Query (continued)
Oracle Reports checks the syntax when you try to leave the SQL Query Statement dialog

Oracle University Internal and TransAmerica Training Management Inc Partner use only
box and whenever you generate or execute the report.
If Oracle Reports detects an error, it displays the error in an alert.

Oracle Reports Developer 10g: Build Reports 8-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

More Properties
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.

Oracle Reports Developer 10g: Build Reports 8-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
More Properties (continued)
Restricting Rows

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 8-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Applying Changes
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.

Oracle Reports Developer 10g: Build Reports 8-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Applying Changes (continued)
For Web reports, reentering the Report Wizard will delete the layout that was previously

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 8-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Changing the Group Structure

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 2004, Oracle. All rights reserved.

Changing the Group Structure


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.

Oracle Reports Developer 10g: Build Reports 8-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Changing the Group Structure (continued)
Example: You create a Web layout using the Report Wizard and the default group name

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Oracle Reports Developer 10g: Build Reports 8-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Group Hierarchy

Copyright 2004, Oracle. All rights reserved.

1 Drag columns up or left to create a parent group.


2 Drag columns down or right to create a child group.

Group Hierarchy
The groups in Oracle 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

Oracle Reports Developer 10g: Build Reports 8-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Group Hierarchy (continued)
Creating a New Group

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
When you drag a column to create a new group, the new group is only one level above or
below the columns 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.

Oracle Reports Developer 10g: Build Reports 8-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Ordering Data in a Group

1
2

Copyright 2004, Oracle. 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

Ordering Data in a Group


Break groups that you create in a hierarchical report display data in a default order. You
can modify this default.
Break order controls the break structure and the order in which to display the columns
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 columns values. The order of precedence depends on the order of columns, from
the top down, in the group.
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.

Oracle Reports Developer 10g: Build Reports 8-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Ordering Data in a Group (continued)
Break Order in Break Groups

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 8-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Query Modifications
The following example shows how the ORDER BY clause is modified.
For each database column with the Break Order property set, Oracle 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

Oracle Reports Developer 10g: Build Reports 8-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Query Modifications (continued)
If you create a break group containing DEPARTMENT_ID and DEPARTMENT_NAME, but

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Oracle Reports Developer 10g: Build Reports 8-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Filtering Data in a Group

Copyright 2004, Oracle. All rights reserved.

Filtering Data in a Group


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.
There are 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.
In the Data Model editor, the circle above the group object changes to green when a filter
is active.

Oracle Reports Developer 10g: Build Reports 8-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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.
There are two packaged filters, First and Last.
The First filter retrieves the first <n> records for the group.
The Last filter retrieves the last <n> records for the group.
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: Oracle Reports retrieves a multiple of the array size, sufficient to satisfy
the filter, based on a parameter value at run time.
Last filter: Oracle Reports must retrieve all records to establish which are last.

Oracle Reports Developer 10g: Build Reports 8-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 8-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 8: Overview

Modifying report hierarchy


Restricting records in a query
Restricting records with a packaged filter

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 8-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 8
1. Open report p8q1_a.jsp, a tabular report showing customer information.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Run 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.

Oracle Reports Developer 10g: Build Reports 8-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enhancing Reports Using the Data Model:
Data Sources

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Overview
To keep pace with todays 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
Oracle Reports and how to combine data from multiple sources to publish meaningful
information.

Oracle Reports Developer 10g: Build Reports 9-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Data Source Types

Access data from a variety of sources:


SQL-based
XML
Oracle OLAP
JDBC
Express
Text

Copyright 2004, Oracle. All rights reserved.

Data Source Types


With Oracle 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 wholesalers 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 Oracle 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 Oracle Reports, you can access, combine, and publish any data.

Oracle Reports Developer 10g: Build Reports 9-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Data Source Types (continued)
The information you need to publish is often derived from various data sources. These

Oracle University Internal and TransAmerica Training Management Inc Partner use only
data sources may be:
SQL-based: relational databases like Oracle10g
Non SQL-based: data, such as XML, that has been generated from outside the
corporation
Oracle OLAP (Online Analytical Processing ): an integrated part of Oracle Database
that provides support for multidimensional calculations and predictive functions.
Oracle OLAP supports both the Oracle relational tables and multidimensional data
types.
Java Database Connectivity (JDBC): other relational data sources such as SQL Server,
Sybase, or another Oracle database
Express: multidimensional database that stores decision support data. The Express
data source is provided for backward compatibility
Data in flat files

Oracle Reports Developer 10g: Build Reports 9-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Pluggable Data Sources

Text
Express JDBC OLAP SQL XML
files

Oracle
Reports
Client Oracle10g

Copyright 2004, Oracle. All rights reserved.

Pluggable Data Sources


A pluggable data source, or PDS, is an Oracle Reports feature 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
Builders requests in terms of the specific data source.
The PDS feature also enables you to leverage various capabilities in Oracle Reports such
as aggregation, summarization, formatting, and scheduling not only on data that is
accessed through SQL, but on data from any data source.

Oracle Reports Developer 10g: Build Reports 9-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Out-of-the-Box Options

Copyright 2004, Oracle. All rights reserved.

Pluggable Data Sources (continued)


In addition to traditional data sources such as SQL, PL/SQL, and Express, Oracle Reports
provides you with pluggable data sources supporting:
XML data streams, both online and from a file
JDBC connections
OLAP databases
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.
More information on defining pluggable data sources is covered in the course Oracle9i
Reports: Integrate Pluggable Data Sources.

Oracle Reports Developer 10g: Build Reports 9-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using XML as a Data Source

Copyright 2004, Oracle. All rights reserved.

Using XML as a Data Source


XML enables business-to-business exchanges of data across applications and platforms.
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.

Oracle Reports Developer 10g: Build Reports 9-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using XML as a Data Source (continued)
To define an XML query:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Select XML Query on the Data Source page of the Report Wizard.
2. On the Data page, select Query Definition. 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.

Oracle Reports Developer 10g: Build Reports 9-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Example: XML Data Stream

Copyright 2004, Oracle. All rights reserved.

Example: XML Data Stream


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

Oracle Reports Developer 10g: Build Reports 9-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Example: XML Data Stream (continued)
The Document Type Definition

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 9-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
XML Report

Copyright 2004, Oracle. All rights reserved.

The XML Report


The output for the report is a simple tabular report.
Note: All the data is of type character. This is because we used a DTD to describe the
XML and DTDs do not contain data type information. A DTD treats all data as character
data. Therefore, trying to format the BONUS or PERINC columns numerically in the
Paper Design view will have no effect. To overcome this, we could use an XML schema
to define our data. An XML schema is more complex to build but it does contain
information about other data types.

Oracle Reports Developer 10g: Build Reports 9-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
OLAP Data Source

Multidimensional
objects

OLAP database

Copyright 2004, Oracle. All rights reserved.

Using OLAP as a Data Source


Online Analytical Processing (OLAP) queries involve inter-row calculations, time series
analysis, and access to aggregated historical and current data.
OLAP applications span a variety of organizational functions. Finance departments use
OLAP for applications such as budgeting, activity-based costing (allocations), financial
performance analysis, and financial modeling. Sales analysis and forecasting are two of
the OLAP applications found in sales departments. Among other applications, marketing
departments use OLAP for market research analysis, sales forecasting, promotions
analysis, customer analysis, and market/customer segmentation. Typical manufacturing
OLAP applications include production planning and defect analysis.

Oracle Reports Developer 10g: Build Reports 9-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Defining an OLAP Query

Copyright 2004, Oracle. All rights reserved.

Defining an OLAP Query


To define an OLAP query:
1. Select OLAP Query on the Data Source page of the Report Wizard.
2. On the Data page, select the Query Definition button. The Connect (OLAP Data
Source) dialog box displays. Specify information about your OLAP query:
- Connection Editor tab: Enter the connection details to your OLAP data source.
- OLAP Connection tab: Specify the user name and password for the OLAP data
source.
3. After you connect to your OLAP data source, the BI Bean Query Wizard displays,
enabling you to design the OLAP query.

Oracle Reports Developer 10g: Build Reports 9-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Example: OLAP Report

Copyright 2004, Oracle. All rights reserved.

Example: OLAP Report


The example illustrates the use of OLAP in a finance department. This report compares
budgeted versus actual costs incurred for the period 2000 and 2001.
Note: Due to the multi-dimensional nature of OLAP data, it is best displayed in a Matrix
report.
Technical Note
For more information on how to install and configure the OLAP PDS into an existing
Oracle Reports installation, refer to the Oracle9i OLAP Data Source technical note on
Oracle Technology Network (http://otn.oracle.com). This note is available in the Oracle
Reports Plugin Exchange section of OTN.

Oracle Reports Developer 10g: Build Reports 9-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Text as a Data Source

Copyright 2004, Oracle. All rights reserved.

Using Text as a Data Source


The information you want to publish may be in a character-delimited text file. You can
leverage the Oracle Reports PDS architecture to connect to your data source by using a
text file as your pluggable data source. The Text PDS is installed by default with Oracle
Reports.
Example
Suppose you want to generate a report based on the product information stored in a text
file that is in CSV (comma-separated values) format.
To publish meaningful information using this text file, you perform two main activities:
Configure Reports Builder to recognize your text file as a pluggable data source.
Use the Report Wizard to create a paper report based on the text data source.

Oracle Reports Developer 10g: Build Reports 9-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Setting Up the textpds.conf File

Copyright 2004, Oracle. All rights reserved.

Setting Up the Text PDS Configuration File


Before you can use a text file as your pluggable data source, you must set up the Text
PDS configuration file (textpds.conf) with the definition of the values in your text
file. The textpds.conf file is located in the ORACLE_HOME\reports\conf
directory. You edit this file and add entries that define the data elements in your data
source. You also define the properties of each column in the text file.
These entries enable Reports Builder to recognize your text file as a PDS. When you
choose Text Query as your data source in the Report Wizard, your text file displays as an
option.

Oracle Reports Developer 10g: Build Reports 9-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Setting Up the Text PDS Configuration File (continued)
For example, the textpds.conf entry for the text file Products_CSV.txt is:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
<fileFormat name=ProductsCSV" comment="#" delimiter=","
type="variable">
<columnInfo>
<column name=Product_ID type=string cellWrapper=&quot;/>
<column name=Product_Name type="string"
cellWrapper=&quot;/>
<column name=Category" type=number" cellWrapper=&quot; />
<column name=Status" type=string" cellWrapper=&quot; />
<column name=List_Price" type=number" cellWrapper=&quot;
/> </columnInfo>
</fileFormat>
The File Format information consists of the file format name, comment character, column
delimiter and file format type. Each File Format has columns. You specify the individual
column information within the <columnInfo> tags. The column information consists of
the following attributes:
Column Name: Heading for the column
Column Type: Data type of the column. String, Number, and Date are the only supported
data types.
Cell Wrapper: This attribute is optional. If specified, this character overrides the File
Format delimiter for the column for which it is specified.
Pattern: This attribute is optional. This is currently used only for date fields and specifies
the pattern of the date field value, for example, dd/MMM/yyyy
In this example, the text file contains five columns: Product_ID, Product_Name,
Category, Status, and List_Price. The cellWrapper attribute indicates that each
column value is present within quotation marks.

Oracle Reports Developer 10g: Build Reports 9-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Defining a Text Query

Copyright 2004, Oracle. All rights reserved.

Defining a Text Query


After you update the textpds.conf file, launch Reports Builder.
Note: If Reports Builder was already open when you modified the textpds.conf file, you
should shut down Reports Builder and relaunch it.
To define a Text query:
1. Select Text Query on the Data Source page of the Report Wizard.
2. On the Data page, select the Query Definition button. The Define Text Query dialog
box displays. Specify information about your Text query:
- Format of the Text File
- Location of the Text File
Note: The Data Definition section of the Define Text Query dialog displays the format
that you added to the textpds.conf file.

Oracle Reports Developer 10g: Build Reports 9-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Sample Text PDS Report

Copyright 2004, Oracle. All rights reserved.

Sample Text PDS Report


The Paper Design view for the Text PDS report is displayed. The report style is Group
Above.
Technical Note
For more information on building reports using the Text pluggable data source, refer to
the Building a Report with a Text Pluggable Data Source chapter in the Oracle Reports
Building Reports 10g (9.0.4) manual.

Oracle Reports Developer 10g: Build Reports 9-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using JDBC as a Data Source

JDBC data source

Copyright 2004, Oracle. All rights reserved.

Using JDBC as a Data Source


Java Database Connectivity (JDBC) is an application program interface (API) that
provides a common way to maintain a connection to a database and lets you access
virtually any tabular data source from the Java programming language. It provides cross-
DBMS connectivity to a wide range of relational databases and other tabular data
sources, such as spreadsheets or flat files. With a JDBC technology-enabled driver, you
can easily connect all corporate data, even in a heterogeneous environment. The JDBC
PDS is an implementation of the Oracle Reports PDS API that allows you to access JDBC
data sources.
The JDBC PDS is a plug-in data source that is installed by default with Oracle Reports to
allow access to all the JDBC supported data sources. The JDBC PDS supports all types of
JDBC drivers.
The JDBC PDS enables you to access any JDBC sources, such as:
An RDBMS like Oracle, DB2, Sybase, or SQL Server
A non-relational data source such as Microsoft Excel
Any ODBC data source through the JDBC-ODBC bridge

Oracle Reports Developer 10g: Build Reports 9-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Configuring the jdbcpds.conf File

Copyright 2004, Oracle. All rights reserved.

JDBC Configuration File


The jdbcpds.conf file is the configuration file for the JDBC Query of Oracle Reports
and is located under ORACLE_HOME\reports\conf. In this file, you specify
information about the different JDBC drivers that you want to use.
This file is pre-configured for the Merant DataDirect drivers provided by Oracle. If you
want to include any other JDBC drivers, you must add or modify relevant entries in the
jdbcpds.conf file.
The jdbcpds.conf file contains two sections:
The Internal DTD section describes the XML format and driver configuration
information. You should not modify this section.
The XML section provides details about the driver, such as driver name, connect
string format, and driver class. You can modify or add your driver information in this
section.

Oracle Reports Developer 10g: Build Reports 9-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Technical Note
Oracle provides a set of Merant DataDirect drivers that can be downloaded from the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Technology Network (http://otn.oracle.com). The driver configuration
file, jdbcpds.conf, contains relevant entries for the Merant DataDirect drivers.
However, you need to install the appropriate .jar files and specify them in Oracle
Reports specific classpath entries in order to make them available to Reports Builder and
OracleAS Reports Services.
For more information on configuring and using a JDBC pluggable data source with
OracleAS Reports Services, refer to the technical note Configuring and Using the JDBC
PDS on Oracle Technology Network (http://otn.oracle.com). See also the
Oracle Application Server Reports Services: Publishing Reports to the Web manual.

Oracle Reports Developer 10g: Build Reports 9-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Defining a JDBC Query

Copyright 2004, Oracle. All rights reserved.

Defining a JDBC Query


After configuring the relevant JDBC drivers, you can define and run a JDBC query using
either SQL or a stored procedure.
To define a JDBC query:
1. Select JDBC Query on the Data Source page of the Report Wizard.
2. On the Data page, select the Query Definition button. The JDBC Query dialog box
displays. Specify information about your JDBC query:
a. SQL statement: For example, SELECT * FROM DEPARTMENTS;
b. Stored procedure: For example, TestProc(40)
Note: The stored procedure call should contain the complete call syntax of
your databases stored procedure.
c. Sign-on Parameter: Specifies the connection information for a database. You
can select a value from the drop down list. The default sign-on parameter value
is p_jdbcpds. Enter a new sign-on name and click Connect to specify a new
database connection.

Oracle Reports Developer 10g: Build Reports 9-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Defining a JDBC Query

Copyright 2004, Oracle. All rights reserved.

Defining a JDBC Query (continued)


d. Connect button: Displays the Connect dialog.
e. Enter the connection information such as user name, password, and database
name
f. Select the driver type from the Driver Type drop-down list.
g. Click the Connect button to connect to the database using the new sign-on
details.
h. Click the OK button in the JDBC Query dialog to execute the JDBC query.
i. Complete the remaining steps in the wizard to define the layout and to run the
report based on your JDBC query.

Oracle Reports Developer 10g: Build Reports 9-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding New Data

1
5 2
6 3
7 4

Copyright 2004, Oracle. All rights reserved.

1 SQL Query 5 Express Server Query


2 XML Query 6 JDBC Query
3 Text Query 7 Ref Cursor Query
4 OLAP Query

Adding New Data


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.

Oracle Reports Developer 10g: Build Reports 9-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding New Data

Copyright 2004, Oracle. All rights reserved.

Adding New Data (continued)


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.

Oracle Reports Developer 10g: Build Reports 9-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Adding New Data (continued)
Creating a New Query Manually

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle Reports, a tool is
added to the toolbar for that data source. Use it as you would any of the standard tools.
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.

Oracle Reports Developer 10g: Build Reports 9-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using REF Cursor Queries

Copyright 2004, Oracle. All rights reserved.

Using REF Cursor Queries


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

Oracle Reports Developer 10g: Build Reports 9-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using REF Cursor Queries (continued)
2. In the Data Model view of the Report Editor, select the Ref Cursor Query tool and

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 more information on REF cursors, see Reports Builder Online Help.

Oracle Reports Developer 10g: Build Reports 9-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Viewing Output from Multiple Query
Reports

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 9-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Viewing Output from Multiple Query Reports (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 9-31

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Using Data Links


A data link defines a relationship between a group and a query, or between two data
sources in the data model. In Oracle 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 or a common data value . 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.

Oracle Reports Developer 10g: Build Reports 9-32

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Using Data Links (continued)


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.
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
You can define multiple equijoins between the same group and query to implement a
compound primary/foreign key relationshipthat is, a key that consists of more than one
column.
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
Oracle Reports Developer 10g: Build Reports 9-33

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Column-to-Column Link

Copyright 2004, Oracle. All rights reserved.

Creating a Column-to-Column Link


As you have learned, Oracle 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.
To create a column-to-column link:
1. In the Data Model editor, select the Link tool.
2. For SQL-based data sources, click the parent/primary key column of the parent
group and drag a link to the child/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.

Oracle Reports Developer 10g: Build Reports 9-34

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Column-to-Column Link (continued)
To modify the link definition, open the Property Inspector using the right mouse button or

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
Creating 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.

Oracle Reports Developer 10g: Build Reports 9-35

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 9-36

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Other Data Link Methods (continued)
Create a manual link for the following reasons:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
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.

Oracle Reports Developer 10g: Build Reports 9-37

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Efficiency Issues: Multiple- or Single-
Query Hierarchy

Outer joins
Data ratio
Multitier environment

Copyright 2004, Oracle. All rights reserved.

Efficiency Issues: Multiple- or Single-Query Hierarchy


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

Oracle Reports Developer 10g: Build Reports 9-38

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Efficiency Issues: Multiple- or Single-Query Hierarchy (continued)
Data Ratio

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 9-39

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Summary
Pluggable Data Sources
With Oracle Reports, it is possible to publish data from any data source. Oracle Reports
provides the support for SQL, PL/SQL, Oracle OLAP, 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 Oracle 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.
Oracle Reports Developer 10g: Build Reports 9-40

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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
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 create a new report using the XML pluggable
data source and a SQL query.

Oracle Reports Developer 10g: Build Reports 9-41

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 9
1. Open p8q1_a.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. In the Data Model, create the following query:
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 is displayed 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.

Oracle Reports Developer 10g: Build Reports 9-42

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 9 (continued)
3. Create a new report that lists the sales representatives and the products they have

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 15
product Product 15
product_id ID 4
quantity Quantity 4
prod_total Total 5

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 groupDisplay only the CUSTOMER,
CUSTOMER_ID, CUST_TOTAL fields.
l. Change the following field attributes:
Column Label Width
CUSTOMER Customer 15
CUSTOMER_ID ID 2
CUST_TOTAL Total 5

m. Save the report as p9q3.jsp.


n. Run the Web layout.

Oracle Reports Developer 10g: Build Reports 9-43

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 9 (continued)
4. An international business has warehouses around the world. The database at

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

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

Oracle Reports Developer 10g: Build Reports 9-44

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enhancing Reports Using the Data Model:
Creating Columns

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 10-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Data Model Columns

Copyright 2004, Oracle. All rights reserved.

1 Data source columns


2 Summary column
3 Formula column
4 Placeholder column
5 Summary column at report level

Data Model Columns


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

Oracle Reports Developer 10g: Build Reports 10-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Data Model Columns (continued)
Developer-Created Columns

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
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

Oracle Reports Developer 10g: Build Reports 10-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Maintaining Data Source Columns

Read-only
properties

Copyright 2004, Oracle. All rights reserved.

Maintaining Data Source Columns


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.
To display a columns 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.

Oracle Reports Developer 10g: Build Reports 10-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Maintaining Data Source Columns (continued)
For data source columns, some of the property settings are not editable in the Property

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Oracle 10g. Their properties should not be changed.
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.

Oracle Reports Developer 10g: Build Reports 10-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Producing File Content Output

Copyright 2004, Oracle. All rights reserved.

Producing File Content Output


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 imagefor example, the picture of each
employee or of each product, as shown above.
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.
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 Oracle Reports. Refer to the Oracle Reports Statement of
Direction on the Oracle Technology Network (http://otn.oracle.com) for more
information.

Oracle Reports Developer 10g: Build Reports 10-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Producing File Content Output (continued)
To create a file column:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
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.
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.

Oracle Reports Developer 10g: Build Reports 10-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Creating a Column
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.

Oracle Reports Developer 10g: Build Reports 10-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Column (continued)
To create a column:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 10-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Summary Columns

Specific properties:
Function
Source
Reset At
Compute At
Data type depends on Source data type
Page summaries: Not supported in the wizard

Copyright 2004, Oracle. All rights reserved.

Creating Summary Columns


A summary column performs a computation on another columns data.
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.

Oracle Reports Developer 10g: Build Reports 10-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Summary Columns (continued)
The datatype of a summary column depends on the data type of the source of the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
summary. If you change the data type of the source column, the datatype of the summary
also changes.
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. Clear 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.

Oracle Reports Developer 10g: Build Reports 10-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Displaying Subtotals
Reset At:
G_DEPARTMENT Report

Copyright 2004, Oracle. All rights reserved.

1 Department totals
2 Report total

Displaying Subtotals
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.
The Reset At property defines the group at which a summary resets to zero to enable you
to calculate a number of subtotals.
The wizard chooses a default reset value for these summaries.
The department total in G_DEPARTMENT is reset at G_DEPARTMENTthat 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.

Oracle Reports Developer 10g: Build Reports 10-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Displaying Subtotals (continued)
The Reset At property displays only options that are valid for each summary.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
The frequency at which the summary value is displayed depends on the group within
which you create the column.
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.

Oracle Reports Developer 10g: Build Reports 10-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Displaying Percentages
Reset At: G_EMPLOYEE G_EMPLOYEE
Compute At: G_DEPARTMENT Report

Copyright 2004, Oracle. All rights reserved.

1 Department percent of total


2 Employee percent of total
Displaying Percentages
The control break report shows the following two percent of totals created by the Report
Wizard:
Employees salary as an individual percentage of the department total
Notice that this is a column in the G_EMPLOYEE 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

Oracle Reports Developer 10g: Build Reports 10-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Displaying Percentages (continued)
The Reset At property works the same way that the Sum function does. The default, Reset

Oracle University Internal and TransAmerica Training Management Inc Partner use only
At G_EMPLOYEE, results in a discrete value for each employee.
For both summaries in the example on the previous page, the Reset At property is
G_EMPLOYEE. 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_DEPARTMENT.
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_DEPARTMENT. To display the salary as a
percentage of the whole report value, change Compute At to Report.

Oracle Reports Developer 10g: Build Reports 10-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Resetting Summary Values

Reset At
Data Model
Group REPORT G_DEPARTMENT G_EMPLOYEE

REPORT Grand Total XXXX XXXX

G_DEPARTMENT Running Total Sub Total XXXX

G_EMPLOYEE Running Total Running Total Record Total

Copyright 2004, Oracle. All rights reserved.

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.
The table above identifies which combinations of group and reset options are valid. The
XXXX denotes invalid combinations.

Oracle Reports Developer 10g: Build Reports 10-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a 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 2004, Oracle. All rights reserved.

Creating a Formula Column


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.
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;
Any columns referenced by the formula column are calculated first.

Oracle Reports Developer 10g: Build Reports 10-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Formula Column (continued)
Note: The code displayed is a simple example to illustrate the syntax. The

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 10-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a 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 2004, Oracle. All rights reserved.

Creating a Placeholder Column


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

Oracle Reports Developer 10g: Build Reports 10-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Placeholder Column (continued)
Using placeholder columns, you can:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
You cannot populate a placeholder by writing code in the placeholders 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.

Oracle Reports Developer 10g: Build Reports 10-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Populating a Placeholder Column

Copyright 2004, Oracle. All rights reserved.

Populating a Placeholder Column


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
For this report, you need to create the following columns:
A summary to show the maximum salary for the company
A placeholder to contain the highest earners 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

Oracle Reports Developer 10g: Build Reports 10-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Populating a Placeholder Column (continued)
To create the columns:
1. Create a summary column CS_MAX_SALARY at report level (outside all groups).

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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;

Oracle Reports Developer 10g: Build Reports 10-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 10-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 10-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 10
1. Create a new report using the Report Wizard. Create both a Web and paper layout

Oracle University Internal and TransAmerica Training Management Inc Partner use only
and select a Group Above report style.
a. Select the following columns in the Query Builder:
Table Columns
ORDERS order_id, order_date
ORDER_ITEMS line_item_id, product_id, unit_price, quantity

Hint: Manually edit the query created by Query Builder to modify the display
of order_date using the TO_CHAR function and specify an alias:
TO_CHAR(order_date, dd-Mon-yyyy)Order_Date
b. Modify the query to include line_total as a calculation of
unit_price*quantity.
c. Group the data on Order_ID and Order_Date and display all the fields.
d. Create the following summaries. Can you use the Report Wizard to create the
summaries?

Column Summary
line_total sum
line_total % Total

e. Specify the following labels and widths.


Column Label Width
order_id Ord. No. 4
order_date Order Date 10
line_item_id No. 2
product_id Product No. 5
unit_price Price 4
quantity Quantity 4
line_total Total 4

f. Use the Gray template file and finish the Wizard.


g. 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.
h. Run both the paper and Web layouts to test the report (do not reenter the
Wizard).
i. Save the report as p10q1.rdf and close it.

Oracle Reports Developer 10g: Build Reports 10-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 10 (continued)
2. Open the p9q3.jsp report .

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create columns to show the percentage of the total per sales representative for
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.
a. Import the query from p10q3.sql. Select the group field as
DEPARTMENT_NAME and 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.

Oracle Reports Developer 10g: Build Reports 10-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 10 (continued)
4. Open the p10q1.rdf report to display the highest and lowest orders at the end of

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 10-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enhancing Reports
Using the Paper Layout

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Identify the paper report sections
Design multipanel reports
Mail a report
Distribute a report to various destinations
Describe the layout objects and relationships
Modify an existing paper report layout
Create variable length lines

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 11-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Viewing the Paper Layout

Header Compensation
section Report

Page 1 of 1
Main
section

Trailer End of report


section

Copyright 2004, Oracle. All rights reserved.

Viewing the Paper Layout


The Report Editor Paper Layout view enables you to define and modify the layout objects
for a paper report. Layout objects define the reports 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.

Oracle Reports Developer 10g: Build Reports 11-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Viewing the Paper Layout (continued)
Header Section: The header section consists of one or more pages that appear once, on a

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 11-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Viewing the 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: The margin area 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.
To adjust the size of the margin, choose the margin view, select the black 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.

Oracle Reports Developer 10g: Build Reports 11-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Designing Multipanel Reports


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.
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, and
then placed alongside each other.
The unit of measurement is a property of the report object itself.

Oracle Reports Developer 10g: Build Reports 11-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Designing Multipanel Reports (continued)
To define dimensions for a section of the report:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Oracle Reports Developer 10g: Build Reports 11-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Printing Multipanel Reports

Page 1-1 Page 1-2

Page 2-1 Page 2-2

Logical horizontal panels = 2

Copyright 2004, Oracle. All rights reserved.

Printing Multipanel Reports


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.

Oracle Reports Developer 10g: Build Reports 11-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Different Objects in the Paper Layout

4
5
1
2
3

Copyright 2004, Oracle. All rights reserved.

1 Frame
2 Repeating frame
3 Field
4 Boilerplate
5 Imported boilerplate image
6 Graph
Different Objects in the Paper Layout
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

Oracle Reports Developer 10g: Build Reports 11-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Different Objects in the Paper Layout (continued)
Field: A field defines the appearance of a columns data. It may contain character,

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
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

Oracle Reports Developer 10g: Build Reports 11-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Paper Layout Layers

F_xxx F_xxx
R_G_xxx
M_G_xxx

Body

Layers of a tabular report

Copyright 2004, Oracle. All rights reserved.

The Paper Layout Layers


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.
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.
Oracle Reports Developer 10g: Build Reports 11-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The Paper Layout Layers (continued)
Group Reports

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 11-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Avoiding Layout Errors

Confine Mode

Flex Mode

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 11-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Avoiding Layout Errors (continued)
Flex Mode

Oracle University Internal and TransAmerica Training Management Inc Partner use only
- Work with Flex Mode enabled (on) to adjust all affected enclosing 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 or resize an
individual object without moving or resizing other objects.

Oracle Reports Developer 10g: Build Reports 11-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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 that 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;

Oracle Reports Developer 10g: Build Reports 11-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Report Processing (continued)
Layout objects often show symbols and icons that indicate their characteristics. The

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Oracle Reports Developer 10g: Build Reports 11-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. 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

Creating Layout Objects


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.

Oracle Reports Developer 10g: Build Reports 11-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Layout Objects (continued)
When you create a layout object, the default name is an alphabetic character that indicates

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the object type, followed by a number. Rename your layout objects meaningfully to help
you in developing and maintaining the report.

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 Oracle Reports 10g. 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.

Oracle Reports Developer 10g: Build Reports 11-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Paper Layout Tools

Pin a tool: Double-click

Shift key for constrained objects

Magnify

Frame Select

Report Block

Copyright 2004, Oracle. All rights reserved.

The Paper Layout Tools


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.
Oracle Reports Developer 10g: Build Reports 11-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Bursting

Trailer HTML

Copyright 2004, Oracle. All rights reserved.

Report Bursting
The capability of producing multiple copies of a given report or portions of it in different
output formats is referred to as report bursting.
Oracle 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.

Oracle Reports Developer 10g: Build Reports 11-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Bursting

Dept 10
West East

Dept 20
West East

;
Dept 30
West East

Dept 40


Dept 80

Copyright 2004, Oracle. All rights reserved.

Report Bursting (continued)


With Oracle 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 Oracle Reports.

Oracle Reports Developer 10g: Build Reports 11-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Bursting on a Repeating Group

Copyright 2004, Oracle. All rights reserved.

Bursting on a Repeating Group


To set up a report to burst on a repeating group:
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.

Oracle Reports Developer 10g: Build Reports 11-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Bursting on a Repeating Group

Setting the Repeat On property

Copyright 2004, Oracle. All rights reserved.

Bursting on a Repeating Group (continued)


Example
The group left report on the previous 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.

Oracle Reports Developer 10g: Build Reports 11-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating an Additional Layout

Copyright 2004, Oracle. All rights reserved.

Creating an Additional Layout


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.

Oracle Reports Developer 10g: Build Reports 11-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating an Additional Layout (continued)
Using the Report Block Tool

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
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.

Oracle Reports Developer 10g: Build Reports 11-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Distributing a Report

Copyright 2004, Oracle. All rights reserved.

Distributing a 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.

Oracle Reports Developer 10g: Build Reports 11-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Distributing a Report

Copyright 2004, Oracle. All rights reserved.

Distributing a Report (continued)


To distribute a report:
1. Define 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. Activate the distribution
From the menu, select File > Distribute, or on the command line, specify
Distribute=YES.
Technical Note
For more information on the Distribution XML file, refer to the chapter Creating
Advanced Distributions in the Oracle Application Server Reports Services Publishing
Reports to the Web manual.

Oracle Reports Developer 10g: Build Reports 11-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Tracing the Report Distribution

Copyright 2004, Oracle. All rights reserved.

Tracing the Report Distribution


You can check a reports distribution without actually distributing the report through the
Reports Builder Trace facility. The trace file will state which distribution lists were used
and which section was sent to which destination.

Oracle Reports Developer 10g: Build Reports 11-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Tracing the Report Distribution (continued)
To trace the report distribution:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 11-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Variable Length Lines

Flex lines adjust to fit variable frames


and repeating frames.

Copyright 2004, Oracle. All rights reserved.

Creating Variable Length Lines


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 above, 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.

Oracle Reports Developer 10g: Build Reports 11-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Variable Length Lines (continued)
To make the line stretch to fit the group frame, draw the line from the top of the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 11-31

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to modify


the Paper Layout using:
Report sections
Layout objects and tools
Report mailing, bursting, and distribution features
Variable length lines

Copyright 2004, Oracle. All rights reserved.

Summary
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 Oracle 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

Oracle Reports Developer 10g: Build Reports 11-32

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 11 Overview

Using report sections


Adding a repeating frame to the header page
Adding flexible lines
Distributing a report

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 11-33

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 11
1. Open report p10q1.rdf. Modify the report as follows:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a header section.
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 todays 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 todays 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 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.

Oracle Reports Developer 10g: Build Reports 11-34

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 11 (continued)
c. Define the distribution for the report. Generate a PDF file for each warehouse,

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 doesnt
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.

Oracle Reports Developer 10g: Build Reports 11-35

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Controlling the Paper Layout:
Common Properties

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 12-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modifying Paper Layout Object Properties

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 2004, Oracle. All rights reserved.

Modifying Paper Layout Object Properties


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.

Oracle Reports Developer 10g: Build Reports 12-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Modifying Paper Layout Object Properties (continued)
Using the Object Navigator:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
- 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.

Oracle Reports Developer 10g: Build Reports 12-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Comparing Properties
Intersection Pin

Copyright 2004, Oracle. All rights reserved.

Comparing Properties
To compare the 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.

Oracle Reports Developer 10g: Build Reports 12-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Common Layout Properties

Four objects with common properties:


Frames
Repeating Frames
Fields
Boilerplate Objects
Some common properties affect:
Sizing
Pagination
Frequency of display

Copyright 2004, Oracle. All rights reserved.

Common Layout Properties


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 are:
Frames
Repeating Frames
Fields
Boilerplate Objects
These common properties include:
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

Oracle Reports Developer 10g: Build Reports 12-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Sizing Objects
Layout icons
Elasticity Vertical Horizontal

fixed

expand

contract

variable

Copyright 2004, Oracle. All rights reserved.

Sizing Objects
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 and the output object size are:
Fixed: identical to the layout object size
Expand: can be larger than the layout object, but not smaller
Contract: can be smaller than the layout object, but not larger
Variable: can be larger or smaller than the layout object

Oracle Reports Developer 10g: Build Reports 12-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Sizing Objects (continued)
How Wizard Report Styles Affect Elasticity

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Oracle Reports Developer 10g: Build Reports 12-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Anchors
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.
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 or expandable vertical size
An object occurring to the right of an object that has a variable or expandable
horizontal size

Oracle Reports Developer 10g: Build Reports 12-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Anchors (continued)
The chart below compares implicit and explicit anchors.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Implicit Explicit
Not visible in the Paper Layout Visible in the Paper Layout
Created and maintained automatically by Created by the developer using the
Reports Builder anchor tool in the tool palette
Visible in the Object Navigator if Anchoring Information is enabled (Navigator
option)

Oracle Reports Developer 10g: Build Reports 12-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Layout Object Relationships

1
2

Copyright 2004, Oracle. 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

Layout Object Relationships


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.

Oracle Reports Developer 10g: Build Reports 12-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Layout Object Relationships

4
1
2

3
6

Copyright 2004, Oracle. All rights reserved.

Layout Object Relationships (continued)

Layout Object Relationship


1 Field Repeating frame, enclosing object
2 Repeating frame Group frame, enclosing object
3 Object 1 Repeating frame, implicit anchor
4 Object 2 Group frame, enclosing object
5 Object 3 Group frame, implicit anchor
6 Group frame

Oracle Reports Developer 10g: Build Reports 12-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Layout Object Relationships (continued)
More About the Push Path

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 12-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Pagination Icons in the Paper Layout

Copyright 2004, Oracle. All rights reserved.

Pagination Icons in the Paper Layout


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).
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 Object: Cause the current object and the object to which it is
anchored to be kept together on the same logical page.

Oracle Reports Developer 10g: Build Reports 12-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Pagination Icons in the Paper Layout (continued)
The Paper Layout displays icons representing each of the properties when they are set to

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 12-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Page Break Before

-1-
1

-2-
xxx
xxx

-1-
xxx -2-
2 xxx

Copyright 2004, Oracle. 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
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.

Oracle Reports Developer 10g: Build Reports 12-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Page Break Before (continued)
Examples

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 12-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Page Break After

-1-
xxx
1 xxx

-1-
xxx -2-
2 xxx

Copyright 2004, Oracle. 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
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.
To see a warning message when Page Break After has no effect, in the Preferences dialog,
go to Runtime Settings and make sure that Run Debug is enabled
Note: Remember to use the Object Navigator to view implicit and explicit anchor
information.

Oracle Reports Developer 10g: Build Reports 12-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Page Break After (continued)
Examples

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 12-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Page Protect

-1-
40
xxxxxxxx
f_dept_id
xxxxxxxx
Employee
-2-
f_ename
41
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx

Copyright 2004, Oracle. All rights reserved.

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 frames elasticity properties are set to Variable, Expand, or Contract,
depending on the sizing of the objects it encloses.

Oracle Reports Developer 10g: Build Reports 12-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Page Protect (continued)
Using Keep with Anchoring Object

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 12-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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 parents 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

Oracle Reports Developer 10g: Build Reports 12-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Controlling Print Frequency (continued)
Which Parent?

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Base Printing On determines whether the parent object is to be the Enclosing Object or the
Anchoring Object.
Example
The report on the previous page 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.

Oracle Reports Developer 10g: Build Reports 12-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Format Triggers

Copyright 2004, Oracle. All rights reserved.

Using Format Triggers


A format trigger is a user-written PL/SQL function that executes each time before the
object containing the trigger is formatted.
All the main layout objects, frames, repeating frames, fields and boilerplate objects, can
contain 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.

Oracle Reports Developer 10g: Build Reports 12-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Layout Object Properties for Web Support

Hyperlink
Hyperlink
Destination
Bookmark
Application
Command Line

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 12-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Layout Object Properties for Web Support (continued)
Examples
Dynamic Hyperlink

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Dept Details || to_char(:deptno)
Dynamic Bookmark
Company Car Policy, Category || :level
Application Command Line
C:\orawin10g\bin\rwrun.exe report=payload_det.rdf

Oracle Reports Developer 10g: Build Reports 12-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 12-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 12 Overview

Creating a break report with continuation pages


displaying limited information
Modifying properties for object Web support

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 12-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 12
1. Create a new break report showing each customer and the relevant orders.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a group above master detail report. Use the query p12_1.sql to create
the report.
b. Select Name as the group field and display 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

d. Run the paper layout. What do you see?


e. Ensure that no customer data displays on a page without details.
f. Save the report as p12q1.rdf.
g. 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 reports 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. Move the rectangle behind the image to
create the effect of a colored border around the image
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.

Oracle Reports Developer 10g: Build Reports 12-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Controlling the Paper Layout:
Specific Properties

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
Specify the format order for the report sections
Enable cataloguing and searching of PDF output

Copyright 2004, Oracle. All rights reserved.

Overview
In the previous lesson, you learned about common object properties. There are however a
number of properties that are unique to the reports and specific types of layout objects.
In this lesson, you learn about specific properties for reports, repeating frames, fields, and
boilerplate. You also learn how to reference the contents of a file at run time. In addition,
you learn to specify the format order for the report sections. Finally, you learn to specify
taxonomy properties for PDF documents.

Oracle Reports Developer 10g: Build Reports 13-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Properties of a Repeating Frame

Copyright 2004, Oracle. All rights reserved.

Modifying Properties of a Repeating Frame


A repeating frame is record-related, and its properties allow you to modify specific
attributes associated to the display of the records.
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, Vert. Space Between Frames: Spacing between
each record, horizontally and vertically
The most commonly used properties are discussed in more detail on the following pages.

Oracle Reports Developer 10g: Build Reports 13-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Specifying Print Direction

Copyright 2004, Oracle. All rights reserved.

Specifying Print Direction


Print direction specifies the direction in which to print the repeating frames records, and
may be any one of these values:
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.
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.

Oracle Reports Developer 10g: Build Reports 13-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Specifying Print Direction (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 13-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Controlling the Number of
Records per Page
1 2
-1- -1-

-2-

-3- -2-

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 13-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Controlling Spacing Between Records
Mailing Labels

1
2

Copyright 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 13-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Minimum Widow Records

Without widow control With widow control


(Min Widow Records = 3)

Page 1 Page 1

Page 2 Page 2

Copyright 2004, Oracle. All rights reserved.

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 above, there 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 one record.
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.

Oracle Reports Developer 10g: Build Reports 13-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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 above shows the use of Column Mode for the department master repeating
frame given three records, 10, 20, and 30. The department repeating frames print
direction is Across, and the employee repeating frames 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.

Oracle Reports Developer 10g: Build Reports 13-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

Properties of a Field
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.
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.

Oracle Reports Developer 10g: Build Reports 13-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Properties of a Field (continued)
The Source property provides a list of columns, of which there are three categories:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Columns in the Data Model
Parameters (always listed in uppercase)
System variables, such as todays date and current page number
The datatype of a field depends on its source.
Defining a Format Mask
When you insert a date object (Insert > Date and Time) 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.

Oracle Reports Developer 10g: Build Reports 13-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
System Variables

Copyright 2004, Oracle. All rights reserved.

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 on the mid-tier when the report
runs, after the Runtime Parameter Form has been displayed
Page Number The current page number based upon numbering the output
by logical pages
Panel Number The current panel number in the current logical page
Physical Page Number The current page number based upon numbering the output
by physical pages
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 upon numbering the output
by physical pages

Oracle Reports Developer 10g: Build Reports 13-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 13-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Page Numbering (continued)
Example 2

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 13-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Valid Source Columns

G_Region

R_Region

F_1 R_Dept
G_Dept R_Emp

G_Emp F_REPORT

Copyright 2004, Oracle. All rights reserved.

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 above, 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.

Oracle Reports Developer 10g: Build Reports 13-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Valid Source Columns (continued)
Report-Level Fields

Oracle University Internal and TransAmerica Training Management Inc Partner use only
If you create a field outside any repeating frame, that is, at report level, the source column
must be a report-level columnoutside 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.

Oracle Reports Developer 10g: Build Reports 13-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Displaying File Contents

Copyright 2004, Oracle. All rights reserved.

Displaying File Contents


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:
Page Numbering Property Value
Include Main Section
Start At 1
Increment By 1
Reset At R_Dept

In character-mode reports, Text is the only valid format.

Oracle Reports Developer 10g: Build Reports 13-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Displaying File Contents (continued)
To create a file link object:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports 13-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
When Are the Contents Updated?

Reports Builder reads the file contents when you:


Modify the Property Inspector
Open a report definition
Run a report

Copyright 2004, Oracle. All rights reserved.

When Are the Contents Updated?


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

Oracle Reports Developer 10g: Build Reports 13-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Linking and Importing Files

1 2
Import

Link

3 4

Copyright 2004, Oracle. All rights reserved.

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.

Oracle Reports Developer 10g: Build Reports 13-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Comparing a File Link and a File Column

Q_EMP

G_EMP

PICTURE F_PICTURE
1

Copyright 2004, Oracle. 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.
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 differences between a link file and a file column are:

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
occurrence of a repeating frame each record
Exists in the Paper Layout Exists in the Data Model and is the source
of a layout field

Oracle Reports Developer 10g: Build Reports 13-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Specifying the Format Order

Copyright 2004, Oracle. All rights reserved.

Specifying the Format Order


Earlier in the course, you learned that every report has three sections, Header, Main, and
Trailer. By default, Oracle Reports formats the three sections of a report sequentially:
Header section, followed by Main section, followed by Trailer section.
Using the Format Order of Sections, a report property, you can specify the order in which
the three sections of a report are formatted. The drop-down list contains all possible
combinations of format order.
Reports Builder can format any section first to create information that is only known at
the time of formatting, such as page numbers, then use that information in the formatting
of a previous section.
For example, when you have large paper report, it is sometimes easier for your users to
navigate through the report if you include a table of contents. Using Reports Builder, you
can generate a table of contents (TOC) that displays at the beginning of your paper report.
You can set the Format Order of Sections property to Main-Header-Trailer to
format the Main section of the report first, then the Header and Trailer sections. This
enables you to generate the page numbers for the report in the Main section, then display
the page numbers in the table of contents in the Header section.

Oracle Reports Developer 10g: Build Reports 13-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Specifying the Format Order (continued)
You then use report triggers to build a table containing the TOC entries. You learn about

Oracle University Internal and TransAmerica Training Management Inc Partner use only
triggers in the lesson titled Coding PL/SQL Triggers, and how to create a table of contents
in the lesson titled Extending Functionality Using the SRW Package.
Note: Regardless of the order in which the report sections are formatted, the output order
(i.e., visual order) is unchanged: Header section, followed by Main section, followed by
Trailer section.

Oracle Reports Developer 10g: Build Reports 13-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
PDF Document Taxonomy Properties

Copyright 2004, Oracle. All rights reserved.

PDF Document Taxonomy Properties


PDF documents store properties that track general information about the document, such
as the documents title, author, and creation and modification dates. This information, or
metadata, is intended to assist in cataloguing and searching a PDF document.
Recall that Oracle Reports supports PDF output. Oracle Reports provides report-level
properties that enable you to specify metadata about your PDF report. The values that you
specify for these properties are inserted into the PDF output file.
The properties are known as PDF Document Taxonomy properties. They define the
classification, or taxonomy, for the document. The properties are:
Title: specifies a title for the report, which you can use to identify the contents of a
document
Author: specifies an author for the report, which may be an individual, company, or
department name
Subject: specifies a subject for the report
Keywords: specifies one or more keywords for the report that can be used to
categorize the document
Note: These properties are only valid for PDF output.

Oracle Reports Developer 10g: Build Reports 13-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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
Modify the default format order for report sections
Specify taxonomy properties for PDF documents

Copyright 2004, Oracle. All rights reserved.

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
You also learned about some report-specific properties. In this lesson, you learned how to
specify the order in which the Header, Main, and Trailer sections of a report are
formatted. You also learned how to specify metadata for your PDF reports.

Oracle Reports Developer 10g: Build Reports 13-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 2004, Oracle. All rights reserved.

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

Oracle Reports Developer 10g: Build Reports 13-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 13
1. Open report p4q4.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the layout so that the mailing labels are 2 inches wide and 1 inch high.
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.

Oracle Reports Developer 10g: Build Reports 13-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Web Reporting

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Identify the attributes of a high quality Web report
Describe the JavaServer Page run-time environment
Describe static and dynamic Web reporting
Add dynamic content to a Web page
Identify Reports custom JSP tags
Customize Web reports

Copyright 2004, Oracle. All rights reserved.

Overview
Using Oracle Reports, you can easily publish data from any source, in any format, with
high fidelity to the Web. Earlier in this course, you learned how to build a simple Web
report using the Report Wizard and a standard HTML template supplied by Oracle
Reports.
You can also use your favorite HTML authoring tool to build the static portion of your
HTML page and then add dynamic content to the Web page using the Report Block
Wizard in Oracle Reports.
In this lesson, you learn more about building reports for the Web and how to customize
and enhance your reports using style sheets and the Web Source editor.

Oracle Reports Developer 10g: Build Reports 14-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
High Quality Web Publishing

Copyright 2004, Oracle. All rights reserved.

High Quality Web Publishing


HTML is the de facto standard for publishing information on the Web. The organization
of content for the Web must be more visually appealing than paper, and often includes
animated GIF images, JavaScript code, and Java applets. We are concerned with
publishing information from corporate data sources and the tool we use must be capable
of combining static as well as dynamic information in a single page.
A number of Web authoring tools exist today for designing and developing high quality
Web pages. These products address static publishing, and in order to include dynamic
content, you often must resort to programming. Web designers and developers are
challenged to define and generate complex, dynamic content for an enterprise information
portal or corporate Web page.
Oracle Reports is a powerful enterprise reporting tool for building and publishing high
quality, dynamically generated Web reports. Through data-driven tables of contents,
hyperlinks, and drill-down chart hyperlinks, Oracle Reports provides users with an easy
path to the information they require.

Oracle Reports Developer 10g: Build Reports 14-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
High Quality Web Publishing (continued)
JSP-Based Runtime Environment

Oracle University Internal and TransAmerica Training Management Inc Partner use only
JavaServer Pages (JSP) technology allows Web designers and developers to rapidly
develop and easily maintain information-rich, dynamic Web pages that leverage existing
business systems. Oracle Reports introduced JSPs as the underlying technology with
which you build and publish dynamic reports for the Internet. You can extend your Web
pages by embedding Oracle Reports custom JSP tags and your own data-driven Java
components into an HTML document. You can integrate Reports custom JSP tags with
Reports data model objects and other Reports tags to add dynamic report output to your
Web page. These tags use the data model, stored in XML, to produce dynamic output, or
invoke JavaBeans that use the data model to create their results. For example, the three-
dimensional (3-D) graphing component uses a custom tag that passes Reports data to the
BI Graph Bean, which creates an image of the graph. The 3-D graphics custom tag then
returns HTML that references the created image.
Reusable components and the open architecture of Oracle Reports makes previously
difficult tasks simple to implement. The ability to incorporate existing Java components
into a report using JSP and servlet technology provides openness. You can also share
business components between Oracle Reports and other applications within your
organization.

Oracle Reports Developer 10g: Build Reports 14-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Comparing Static and Dynamic Reporting

Copyright 2004, Oracle. All rights reserved.

Comparing Static and Dynamic Reporting


The two categories of Web reports are static reports and dynamic reports.
Static Reports
The word static describes something that is fixed and unchanging. A static report is one
that displays the same data each time the report is invoked. The data is fetched once and
displayed on a Web page. Consider a paper report that has been pushed to the Web. If you
do not execute the paper report (RDF) again, and generate the Web output (HTML or
PDF) using the Web Wizard or File > Generate to File, the output remains the same, that
is, it is static.
Static reporting is sufficient for certain types of applications. A report that displays data
that does not change, such as historical data, does not require frequent refreshing.

Oracle Reports Developer 10g: Build Reports 14-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Comparing Static and Dynamic Reporting (continued)
Dynamic Reports

Oracle University Internal and TransAmerica Training Management Inc Partner use only
If your requirement is to publish the most recent data available when the information is
requested, a static report will not meet your needs. Your report must be dynamic.
The word dynamic describes something marked with continuous and productive activity
or change. Pertaining to software applications, dynamic refers to operations performed on
the fly that are based on decisions made while a program is executing, instead of
beforehand.
To achieve this in Oracle Reports, you embed a report block within a Web page. Each
time the report is executed, the data is fetched from the data source and the Web page
displays the most current information.
In this lesson, you will add dynamic content to a Web page.

Oracle Reports Developer 10g: Build Reports 14-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding Dynamic Content

Report Block Wizard


Graph Wizard
<body>

</body>

Data Model JavaServer Page (JSP)


Web Source

Copyright 2004, Oracle. All rights reserved.

Adding Dynamic Content to a Web Page


In a previous lesson, you created Web reports using one of the HTML templates supplied
by Oracle Reports and the Report Wizard. As an alternative, you can open an existing
Web page (an HTML document) in Reports Builder and embed your report data into the
page. Your HTML document can be a corporate standard or you can design your own
Web page using your favorite HTML authoring tool.
In this section, you learn how to add dynamic content to an existing Web page.

Oracle Reports Developer 10g: Build Reports 14-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Adding Dynamic Content to a Web Page (continued)
Defining the Data Model

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Remember that every report has a data model and a layout. In Oracle Reports, each report
definition can have a paper layout and a Web layout. Although the layouts are distinct
objects, the data model is shared by both layouts.
Open the existing HTML file in Reports Builder. To define a data model for the Web
page:
1. In the Object Navigator, double-click the Data Model node to display the Data
Model view of the Report Editor.
2. Right-mouse-click in the Data Model painter area and select Data Wizard from the
menu.
3. Name the query as required.
4. Select the Query type.
5. Enter the query as you would using the Report Wizard.
6. Create additional groups as required.
7. Create summaries as required.
Saving Your Report as a JSP File
1. With your report selected in the Object Navigator, select File > Save As.
2. Make sure the file type is Reports JSP (*.jsp), modify the report name if desired,
and click Save.

Oracle Reports Developer 10g: Build Reports 14-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Report Block

Copyright 2004, Oracle. All rights reserved.

Creating a Report Block


Now that you have defined the data for your report, you are ready to create a report block
and add it to your Web page. The report block automatically inserts the data model,
business logic, and Web layout for the report. Each time the report is run, the report block
will dynamically pull the data defined by the data model into your Web page.
In order to insert a report block into your Web page, open the Web Source view for your
report. The report block must go between the <body> and </body> tags. These tags are
standard HTML code and delimit the start and end of the body of the Web page,
respectively.
Organizations often have a team of Web designers to create visually appealing and
effective Web pages for publishing. The designers can manually code the HTML or use
any HTML authoring tool. Web designers will typically include a placeholder in the
HTML code to indicate where you, as the reports developer, must add the report data.
This is the location in the code where you position your cursor to insert the report block.

Oracle Reports Developer 10g: Build Reports 14-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Report Block (continued)
Example:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
<p>&lt;Replace this text with a report block.&gt;</p>
Note: &lt; and &gt; represent the less than and greater than signs, respectively.
Reports Builder encodes them in the Web Source to ensure that a browser will not
misinterpret the symbols as HTML elements. The line of code would actually read:
<p><Replace this text with a report block.></p>

Oracle Reports Developer 10g: Build Reports 14-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Invoking the Report Block Wizard

Copyright 2004, Oracle. All rights reserved.

Invoking the Report Block Wizard


To invoke the Report Block Wizard:
1. Position your cursor in the desired location in the Web source code.
2. Select Insert > Report Block from the menu.
3. Specify a title for your report and select a report style.
4. Select the group or groups as desired.
5. Select the fields you want to display in your report.
6. Modify the labels as necessary.
7. Select a template and click Finish.
Note: The template affects the report block only and will not alter the existing Web
page.

Oracle Reports Developer 10g: Build Reports 14-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Examining the Web Source Code

Structure of a Reports JSP:

<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %>


<%@ page language="java" import="java.io.*" errorPage=/rwerror.jsp" %>

<rw:report id="report">
<rw:objects id="objects">
Data Model & Business Logic (XML)
<layout>
Paper Layout (XML)
</layout>
</rw:objects>
<HTML>
Web Layout (JSP)
Graph (XML)
</HTML>
</rw:report>

Copyright 2004, Oracle. All rights reserved.

Examining the Web Source Code


Now you will examine the code created for the report block, and learn more about the
Reports custom JSP tags as well as some HTML tags.
The Structure of a Reports JSP
Earlier in the course, you were introduced to the structure of a Reports JSP.
The first line of the JSP is a directive that identifies the Reports custom tag library. The
page directive on the second line of code identifies the scriptlet language, the Java classes
to import, and the JSP to display any unhandled errors.
The entire report resides within the body of the rw:report tag.
The Data Model and business logic reside within the rw:objects tag and are coded in
XML. If your report definition also contains a Paper Layout, it is located within the
rw:objects tag as well. Remember that the details of the Data Model and Paper
Layout are hidden when you are viewing the Web Source in Reports Builder. Use a text
editor to view the complete code.
The Web Layout for your report is located within the HTML tag, which is the focus of
this section.

Oracle Reports Developer 10g: Build Reports 14-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Examining the Web Source Code

Copyright 2004, Oracle. All rights reserved.

Examining the Web Source Code (continued)


The Header Tag
The header tag is an HTML tag that contains a comment to help you locate the heading
information for your report: <!-- Header -->. Just below the header tag, you will
find <th> and <tr> tags. The code within these tags defines the column headers for
your report. For example:
<tr>
<th <rw:id id="HBEMPLOYEEID" asArray="no"/>
class="OraColumnHeader"> Employee ID</th>
This code identifies the column heading Employee ID. Note the <rw:id> tag. The
rw:id tag generates a unique Document Object Model (DOM), or HTML ID value for
row and column headers to produce HTML that provides access using assistive
technology, such as screen readers.

Oracle Reports Developer 10g: Build Reports 14-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
rw:foreach Tag

...
<rw:foreach id="R_G_EMPLOYEE_ID_1" src="G_EMPLOYEE_ID">
<tr>
<td <rw:headers id="HFEMPLOYEEID"
src="HBEMPLOYEEID"/>. . .
<td <rw:headers id="HFEmployee"
src="HBEmployee"/> . . .
...

Copyright 2004, Oracle. All rights reserved.

The rw:foreach Tag


The rw:foreach tag loops through the specified data source group. The tag creates a
cursor for the data source group and moves the cursor to the next instance for each
iteration. Consider this example:
<rw:foreach id="R_G_EMPLOYEE_ID_1" src="G_EMPLOYEE_ID">
R_G_EMPLOYEE_ID_1 is a unique identifier for the loop. G_EMPLOYEE_ID identifies
the group in the data model for which the loop repeats.

Oracle Reports Developer 10g: Build Reports 14-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
rw:field Tag

...
<td <rw:headers id="HFEMPLOYEEID"
src="HBEMPLOYEEID"/> class="OraCellNumber">
<rw:field id="F_EMPLOYEE_ID" src="EMPLOYEE_ID"
nullValue="&nbsp;"> F_EMPLOYEE_ID </rw:field></td>
...

Copyright 2004, Oracle. All rights reserved.

The rw:field Tag


The rw:field tag returns a value from a column, system parameter, or user parameter,
and outputs the value in HTML. For example:
<rw:field id="F_EMPLOYEE_ID" src="EMPLOYEE_ID"
nullValue="&nbsp";> F_EMPLOYEE_ID </rw:field>
F_EMPLOYEE_ID is a unique identifier for this field. This tag returns a value from the
EMPLOYEE_ID column in the data model, as identified by the source (src) attribute. If
the tag returns null, a space will result in the output, as specified by the nullValue
attribute. The &nbsp value is the code for non-breaking space. It is called non-breaking
so that the browser does not ignore the space, which browsers usually do otherwise.

Oracle Reports Developer 10g: Build Reports 14-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Reports JSPs

Modify the classes in the style sheet


Use HTML tags and attributes
Use Reports custom tags

Copyright 2004, Oracle. All rights reserved.

Customizing Reports JSPs


You can customize your Reports JSPs by:
Modifying the classes in the style sheet file
Using standard HTML tags and attributes
Using Oracle Reports custom tags

Oracle Reports Developer 10g: Build Reports 14-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Reports JSPs
Using Style Sheets

<rw:style id="rwbeige">
<link rel="StyleSheet" type="text/css" href="rwbeige.css">
</rw:style>

<td <rw:headers id="HFEMPLOYEEID"


src="HBEMPLOYEEID"/>
class="OraCellNumber"><rw:field
id="F_EMPLOYEE_ID" src=EMPLOYEE_ID"
nullValue="&nbsp;"> F_EMPLOYEE_ID </rw:field></td>

.OraCellNumber { color: #000000; background-color: #f7f7e7;


font-family: Arial, Helvetica, sans-serif; font-size: 10px ; text-
align: right}

Copyright 2004, Oracle. All rights reserved.

Customizing Reports JSPs Using Style Sheets


When you select a template supplied by Oracle Reports, the headings and data in your
report block inherit the characteristics defined for the template through the templates
style sheet. A style sheet is a file that is used to store margins, tabs, fonts, headers, footers,
and other layout settings for a particular category of document. Style sheets (or cascading
style sheets) refer to HTML extensions to provide powerful formatting flexibility. When a
style sheet is selected, its format settings are applied to all the documents created with it.
This saves the page designer or programmer from redefining the same settings over again
for each page.

Oracle Reports Developer 10g: Build Reports 14-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Customizing Reports JSPs Using Style Sheets (continued)
Example: In the Reports JSP source code shown, the Oracle Reports template rwbeige

Oracle University Internal and TransAmerica Training Management Inc Partner use only
is referenced. Specifically, the style sheet referenced is rwbeige.css. The
EMPLOYEE_ID field in the report uses the OraCellNumber class format. To learn the
attributes of a particular class format, you can view the .css file in a text editor. In this
example, the OraCellNumber class format is:
.OraCellNumber {color: #000000; background-color: #f7f7e7;
font-family: Arial, Helvetica, sans-serif; font-size:
10px ; text-align: right}
The attributes defined are the color of the field text, background color of the field, font,
font size, and text alignment.
To customize the appearance of a class in all your reports, edit the class format settings in
the stylesheet.

Oracle Reports Developer 10g: Build Reports 14-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Reports JSPs
Using HTML Tags and Attributes

<thead>
<tr>
<th <rw:id id="HBEMPLOYEEID" asArray="no"/>
class="OraColumnHeader"> Employee Id </th>

<th <rw:id id="HBSALARY" asArray="no"/> align="right"
bgcolor="yellow"> Salary </th>
</tr>
</thead>

Copyright 2004, Oracle. All rights reserved.

Customizing Reports JSPs Using HTML Tags and Attributes


If you want to customize particular instances of a class in a report, you can edit the Web
source code directly and use standard HTML tags and attributes or Reports custom tags to
obtain the desired results.
If you are familiar with standard HTML tags and attributes, you can edit your Web source
and customize your report this way.
In the slide above, the column headings in the report block use the OraColumnHeader
class. Note the reference for the Employee Id header.
The header for the Salary column is customized. The OraColumnHeader class reference
was deleted from the Web source code, and replaced with standard HTML format
attributes for alignment and background color. In this example, the Salary column header
is aligned right and the header text is displayed with a background color of yellow.

Oracle Reports Developer 10g: Build Reports 14-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Reports JSPs
Using Reports Custom Tags

Tag attributes provide additional formatting functionality.


Example: rw:field tag optional attributes:
breakLevel
breakValue
nullValue
containsHtml
formatMask
formatTrigger

Copyright 2004, Oracle. All rights reserved.

Customizing Reports JSPs Using Reports Custom Tags


Each Reports custom tag is defined with a list of attributes. While some attributes are
mandatory, others are optional. You can edit the Web source and include optional
attributes to customize your Reports JSP. The optional attributes provide additional
formatting for the referenced object.
For example, the rw:field tag can be defined with the following optional attributes:
breakLevel: The frequency at which the field should be repeated. It is the name of an
enclosing rw:foreach tag.
breakValue: The string value to use when the field is not repeated at the specified
breakLevel. The default value is &nbsp.
nullValue: This sets the value to be used if the fields value is null. The default value
is &nbsp.
containsHtml: A value that indicates whether the fields value contains HTML.
Accepted values are Yes and No. If the attribute is set to No, HTML reserved
characters are converted to their HTML character entities, for example, < is
converted to &lt. The default value is No.

Oracle Reports Developer 10g: Build Reports 14-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Customizing Reports JSPs Using Reports Custom Tags (continued)
formatMask: Contains the Reports format mask to be applied to the fields value.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
This attribute is only valid for fields containing number or date data types.
formatTrigger: Contains the name of a format trigger program unit. The executing
program unit sets the fields attributes in the Reports backend structure and the tag
handler picks up those attributes and converts them to HTML.

Oracle Reports Developer 10g: Build Reports 14-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Reports JSPs
Using Reports Custom Tags
<tbody> <rw:foreach id="R_G_EMPLOYEE_ID_1"
src="G_EMPLOYEE_ID">
<tr>

<td
<rw:headers id="HFSALARY" src="HBSALARY"/>
align=right">
<rw:field id="F_SALARY" src="SALARY"
nullValue="&nbsp;" formatMask="$999,999.00" >
F_SALARY
</rw:field>
</td>

</tr>
</rw:foreach> </tbody>

Copyright 2004, Oracle. All rights reserved.

Customizing Reports JSPs Using Reports Custom Tags (continued)


The slide above shows an example of using Reports custom tag attributes to modify the
appearance of a field in a report. A format mask is included to display the values returned
from the salary column. Use standard Reports format tokens to create format masks for
fields containing numbers and dates.
Another implementation of customizing Reports JSPs using custom tag attributes is to set
your report parameters in the rw:report tag. For example:
<rw:report id="report" parameters="server=rep-server&
userid=oe/oe@orcl&destype=cache&desformat=htmlcss">
This rw:report tag references the parameters attribute. The parameter list specifies the
name of the server, user name, password, and database connect string, destination type,
and destination format. You can run this report using OracleAS Reports Services without
providing the parameters again. However, the values specified in the parameters attribute
can be overridden by providing new values in the URL when the report is run. The
settings in the parameters attribute have the lowest precedence.

Oracle Reports Developer 10g: Build Reports 14-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Reports JSPs
Using Reports Custom Tags

Copyright 2004, Oracle. All rights reserved.

Customizing Reports JSPs Using Reports Custom Tags (continued)


The slide above shows the result of using Reports custom tag attributes to modify the
appearance of a field in a report.

Oracle Reports Developer 10g: Build Reports 14-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Create a Web report using an existing HTML page
and the Report Block Wizard
Describe the structure of a Reports JSP and identify
key custom JSP tags
Use style sheets to customize Web reports
Use HTML attributes and Reports custom tag
attributes to customize Web reports

Copyright 2004, Oracle. All rights reserved.

Summary
Adding Dynamic Content to a Web Page
With Oracle Reports, you can open an existing Web page in Reports Builder and add
dynamic report data to the page.
Use the Data Wizard to define a data model.
Create a report block at the desired location in the Web page using the Web Source
editor and the Report Block Wizard.
Save your report as a Reports JSP.
Reports JSPs
The Web layout for your report definition is delimited by the HTML tags in the source
code. Reports JSP custom tags in this section include rw:foreach, rw:id, and
rw:field.
Customizing Web Reports
Modify the classes in a style sheet file to apply changes to layout settings for all reports
created with that style sheet.
Using the Web Source editor, customize the appearance of selected classes in a report by
using standard HTML tags and attributes as well as Reports custom tag attributes.

Oracle Reports Developer 10g: Build Reports 14-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 14 Overview

Adding dynamic content to an existing Web page


Customizing a Web report using JSP tag attributes

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 14


This practice session contains:
Adding dynamic content to an existing Web page to create a Reports JSP
Customizing a Web report using JSP tag attributes
In this practice, you will create a Web report by adding dynamic report data to an existing
HTML page. You will also customize the Web report by using JSP tag attributes.

Oracle Reports Developer 10g: Build Reports 14-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 14
1. Create a new Web report by adding dynamic content to an existing Web page.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Open the mywebpage.htm file in Reports Builder.
b. Define a data model using the Data Wizard. Import the p14q1.sql query.
Use DEPARTMENT_ID and DEPARTMENT_NAME as the group fields.
Include a sum of the salaries.
c. Save the report as p14q1.jsp.
d. Create a report block and add it to the Reports JSP. The Web source code has a
place holder for your report block. Choose the Group Left style and include the
Salaries by Department title. Include all groups and display in the down
direction. Display all fields. Use a label of Name for DEPARTMENT_NAME
and Title for JOB_ID. Select the predefined Beige template.
e. Run the Web layout to test. Save the report.
2. Customize the p14q1.jsp report using JSP tag attributes.
a. Display the salary and summary values with an appropriate currency format.
b. Run the Web layout to test. Did you remember to format the report summary?
Save the report as p14q2.jsp.

Oracle Reports Developer 10g: Build Reports 14-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Extending Functionality Using XML

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Describe the benefits of XML definitions
Create XML report definitions
Apply XML report definitions
Debug XML report definitions

Copyright 2004, Oracle. All rights reserved.

Overview
In an earlier lesson, you were introduced to Extensible Markup Language, or XML. Recall
that XML enables business-to-business exchanges of data across applications and
platforms. You learned how to use XML as a data source in a report.
It is also possible to build a report definition using XML tags. This XML report definition
can be run by itself or can be applied to another report at run time to customize the output
for a specific audience.
In this lesson, you will learn how to build a report using XML tags, apply customizations
to a report at runtime, and apply batch update to existing reports.

Oracle Reports Developer 10g: Build Reports 15- 2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Why Use XML Report Definitions?

Apply run-time customizations


Perform batch updates
Build fully functional reports
Product openness

Copyright 2004, Oracle. All rights reserved.

Why Use XML Report Definitions?


Using XML tags, you can build a full or partial report that can serve as either a
customization file for an existing report or a completely self-contained report. XML
customizations enable you to modify reports at runtime without changing the original
report. With the addition of the CUSTOMIZE command to your runtime command line,
you can call a customization file to add to or change a report's layout or data model. You
can even use Reports XML to build a report data model for inclusion in a custom JSP-
based report.
This functionality opens many possibilities for handling the output of data, making Oracle
Reports even more flexible and open.

Oracle Reports Developer 10g: Build Reports 15- 3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Why Use XML Report Definitions? (continued)
Run-Time Customizations

Oracle University Internal and TransAmerica Training Management Inc Partner use only
You can apply customizations to change the look and feel of a report at run time without
changing the original report. This allows for a report to be different for different
audiences. For example, labels can be designed according to geography, or colors and
format masks can be designed on a per user or user group basis.
Furthermore, Oracle Reports extends the possible types of Reports XML customizations
by enabling you to create an entire Data Model in XML. This includes the creation of
multiple data sources, linking between data sources, and group hierarchies within each
data source. Data Model support through Reports XML customization means that any
Data Model that can be created with Reports Builder can now be created by specifying
XML. You can also set properties for Data Model objects using XML.
Batch Updates
Using an XML report definition, you can apply batch updates to existing reports. You
have the option of saving the combined definition to a file. The advantage is that you can
quickly update a large number of reports without having to open each file in Reports
Builder to make the changes.
Building Fully Functional Reports
If you can generate XML tags, you can create a fully self-contained report definition that
can be run by Oracle Reports. Using an XML report definition, you can build reports on
the fly without using Reports Builder.
Product Openess
XML support in Oracle Reports provides a mechanism for exchanging data with third-
party applications. It also offers a way to furnish data to tools that accept XML output for
data analysis, and XML is easily displayed on the Web.
Technical Note
For more information see the section Customizing Reports with XML in the Oracle
Application Server Reports Services Publishing Reports manual.

Oracle Reports Developer 10g: Build Reports 15- 4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating XML Report Definitions

<report> XML tags


<data> Partial definition
. . . Full definition
</data>
<layout>
. . .
</layout>
</report>

Copyright 2004, Oracle. All rights reserved.

Creating and Using XML Report Definitions


The steps below briefly outline the process of building and using XML report definitions:
1. Create a full or partial report definition using XML tags. (You can do this manually
with an editor or programmatically.)
2. Store the XML report definition in a location accessible to OracleAS Reports
Services.
3. Apply the XML definition to another report or run the report by itself.

Oracle Reports Developer 10g: Build Reports 15- 5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating and Using XML Report Definitions (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The following is a sample of a partial report definition:
<report name="employee" DTDVersion="1.0">
<layout>
<section name="main">
<field name="f_sal" source="sal" textColor="red"/>
<field name="f_mgr" source="mgr" fontSize="14"
font="Roman"/>
<field name="f_deptno" source="deptno" fontStyle="bold"
fontEffect="undereline"/>
</section>
</layout>
</report>
Every XML report definition, whether full or partial, must contain the required tag pair,
<report> </report>. The <report> tag indicates the beginning of the report customization,
its name, and the version of the Document Type Definition (DTD) file that is being used
with this XML customization. The </report> tag indicates the end of the report
customization. A full report requires both a data model and layout and therefore requires
the <data></data> and <layout></layout> tags and their contents.
The report name attribute in the <report> tag can be any name you wish, and can be
different than the name of the .rdf file. The name attributes in the <field> and <section>
tags match the names of the fields and sections. As a result, the attributes will be applied
to the fields and sections listed.

Oracle Reports Developer 10g: Build Reports 15- 6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Partial Report Definitions:
Format Modification Example

<report> Empty <data> tag


<data> Use of <layout>
</data> Use of <field>
<layout>
<section>
<field .../>
...
</section>
</layout>
</report>

Copyright 2004, Oracle. All rights reserved.

Partial Report Definitions


One of the main uses of XML report definitions is to make modifications to an existing
report at run time. The XML report definition enables you to easily change the Data
Model or report formatting without permanently affecting the original report. To help you
understand the kind of modifications that are possible, you will look at two examples:
formatting modification and formatting exception.

Oracle Reports Developer 10g: Build Reports 15- 7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Partial Report Definitions (continued)
Formatting modification example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
<report name="sales" DTDVersion="1.0">
<data>
</data>
<layout>
<section name="main">
<field name="f_orderdate"
source="orderdate"
formatMask="MM/DD/RR"/>
<field name="f_prodid"
source="prodid"
lineColor="black"
fillColor="r100g50b50"/>
<field name="f_current_price"
source="price"
lineColor="black"
fillColor="r100g50b50"/>
</section>
</layout>
This XML definition does not add data because the <data> tag is empty. The purpose is to
apply the formatting attributes mentioned in the <field> tags for the fields in the reports
main section.

Oracle Reports Developer 10g: Build Reports 15- 8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Partial Report Definitions:
Format Exception Example

<report> Empty <data> tag


<layout> Use of <exception>
<section> Use of <condition>
<field ...>
<exception>
<condition .../>
</exception>
</field>
</section>
</layout>
</report>

Copyright 2004, Oracle. All rights reserved.

Oracle Reports Developer 10g: Build Reports 15- 9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Partial Report Definitions (continued)
Formatting exception example:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
<report name="emp" DTDVersion="1.0">
<data>
</data>
<layout>
<section name="main">
<field name="f_sal" source="sal">
<exception textColor="red">
<condition source="sal" operator="gt"
operand1="1000"/>
</exception>
</field>
<field name="f_bonus" source="bonus">
<exception textColor="blue">
<condition source="bonus" operator="gt"
operand1="10"/>
</exception>
</field>
</section>
</layout>
</report>
This XML definition adds formatting exceptions to the F_SAL and F_BONUS fields.
Notice the use of the <exception> tag. However, the formatting change will only be
applied when the criteria defined in the <condition> tag is met.

Oracle Reports Developer 10g: Build Reports 15- 10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Full Report Definition:
Data Model Modification Example

<report> Empty <layout> tag


<data> Use of <dataSource>
<dataSource> Column aliases
... Bind references
</dataSource>
</data>
<layout>
</layout>
</report>

Copyright 2004, Oracle. All rights reserved.

Oracle Reports Developer 10g: Build Reports 15- 11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Full Report Definition
Data model modification example:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
<report name=DataMod" DTDVersion="1.0">
<data>
<dataSource name="Q_sal_summary">
<select>
select l.city loc_name,sum(e.salary) totsal
from locations l,departments d,employees e
where l.location_id = d.location_id
and d.department_id = e.department_id
and l.location_id > :loc_nr
group by l.city,d.department_name
</select>
</dataSource>
</data>
<layout>
<section name="header">
<tabular name="Sal_summary" template="rwgray.tdf">
<labelAttribute font="Arial"
fontSize="10"
fontStyle="bold"
textColor="white"/>
<field name="f_loc_name"
source="loc_name"
label="Location Name"
font="Arial"
fontSize="10"/>
<field name="f_totsal"
source="totsal"
label="Total Sal"
font="Arial"
fontSize="10"/>
</tabular>
</section>
</layout>
</report>

Oracle Reports Developer 10g: Build Reports 15- 12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Full Report Definition:
Data Model Modification Example

<report> Empty <layout> tag


<data> Use of <dataSource>
<dataSource> Column aliases
... Bind references
</dataSource>
</data>
<layout>
</layout>
</report>

Copyright 2004, Oracle. All rights reserved.

Full Report Definition (continued)


Several things happen in this XML definition file:
First of all, this XML report definition can run by itself because it has both a data
model and a complete paper layout specification. The purpose of this example is to
illustrate how you can add a new query to the data model and also add a header
section.
Notice the use of the <dataSource> tag. This tag delimits the query in the data model
and must be nested within the <data> tag. In Oracle Reports, the dataSource tag
supports the creation of multiple data sources as well as the new pluggable data
sources.
The <select> tag delimits the SELECT statement and must be nested within the
<dataSource> tag.
Note the presence of a bind reference in the SELECT statement. This will create a
user parameter on your behalf.

Oracle Reports Developer 10g: Build Reports 15- 13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Full Report Definition (continued)
The query uses column aliases. If you do not use an alias, the name of the column is

Oracle University Internal and TransAmerica Training Management Inc Partner use only
assigned by default and could be something you do not expect. This is important for
the <field> tag, where you must specify the correct name and source of the column.
Notice the presence of the <labelAttribute> tag. This tag defines the formatting
attributes for field labels. Because it is used outside the <field> tag, it is global and
pertains to all labels in this tabular layout. Be aware that if there is both a global and
local <labelAttribute>, the local one overrides the global one.
Notice the use of the SUM function in the query. You could use the <summary> tag to
define a summary column in the data model of the report definition if you wanted.
This is a performance issue. If calculations are included in SQL, they are performed
before the data is retrieved rather than performed on the retrieved data by Oracle
Reports.

Oracle Reports Developer 10g: Build Reports 15- 14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running XML Report Definitions

Apply to an .rdf or .xml file

rwclient userid=... report=...


customize=....xml server=...
destype=... desformat=...

One or multiple definitions

Copyright 2004, Oracle. All rights reserved.

Running XML Report Definitions


Once you have created your Reports XML customization file, you can use it in the
following ways:
Apply an XML report definition to a .rdf or .xml file at run time by using the
CUSTOMIZE command line argument or the SRW.APPLY_DEFINITION built-in.
Run the XML report by itself by using the REPORT (or MODULE) command line
argument.
Perform a batch update by using the RWCONVERTER executable with the
CUSTOMIZE argument.

Oracle Reports Developer 10g: Build Reports 15- 15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Running XML Report Definitions (continued)
Applying One XML Report Definition

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The following command line sends a job request to OracleAS Reports Services and
applies the XML report definition emp.xml to the employee.rdf file.
rwclient userid=scott/tiger@db1 report=employee.rdf
customize=d:\rep10g\custom\emp.xml
destype=file desname=emp.pdf desformat=PDF
server=repsrv1
The equivalent Reports Runtime command line would be:
rwrun userid=scott/tiger@db1 report=employee.rdf
customize=d:\rep10g\custom\emp.xml
destype=file desname=emp.pdf desformat=PDF
Applying Multiple XML Report Definitions
You can apply multiple XML report definitions to a report at run time by providing an
argument list with the CUSTOMIZE keyword. The following command line sends a job
request to OracleAS Reports Services and applies two XML report definitions,
emp0.xml and emp1.xml, to the .rdf file employee.rdf:
rwclient userid=scott/tiger@db1 report=employee.rdf
customize="(d:\rep10g\custom\emp0.xml,
d:\rep10g\custom\emp1.xml)"
destype=file desname=emp.pdf desformat=PDF
server=repsrv1
Multiple files are applied in the order listed in the CUSTOMIZE argument. The last
definition applied overrides any similar modifications made by a prior definition.

Oracle Reports Developer 10g: Build Reports 15- 16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running XML Report Definitions

Before Form or After Form trigger


SRW.APPLY_DEFINITION(....xml);

Run by itself
Batch updates

rwconverter source="(...)"
dest=... customize=...
batch=yes

Copyright 2004, Oracle. All rights reserved.

Running XML Report Definitions (continued)


Applying an XML Definition in PL/SQL
To apply an XML report definition to an .rdf file in PL/SQL, you can use the
SRW.APPLY_DEFINITION and SRW.ADD_DEFINITION built-ins in the BeforeForm
or AfterForm trigger. When you run the report, the trigger executes and the specifed XML
file will be applied.
The following command line applies XML that is stored in the file system to a report:
SRW.APPLY_DEFINITION(D:\rep10g\custom\emp.xml);
To create an XML report definition in memory, you must first add the definition to the
document buffer and then apply it. The following command line illustrates this:
SRW.ADD_DEFINITION(:xmlcol);
SRW.APPLY_DEFINITION;
Running the XML Report Definition by Itself
To run an XML report definition by itself, simply submit a job request with an XML file
specified in the MODULE (or REPORT) argument. Ensure that the file extension is
.xml. Note that you could also apply an XML customization file to this report at the
same time by using the CUSTOMIZE argument.
Oracle Reports Developer 10g: Build Reports 15- 17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Running XML Reports Definitions (continued)
Performing Batch Updates
If you have a large number of files that must be updated, you can use the CUSTOMIZE

Oracle University Internal and TransAmerica Training Management Inc Partner use only
command line argument with the RWCONVERTER command. Batch modifications are
particularly useful when you must make a repetitive change to a large number of reports
(for example, changing a field's format mask). Rather than opening each report and
manually making the change in Reports Builder, you can run RWCONVERTER once and
make the same change to a large number of reports at the same time.
The following command line applies two XML report definitions to three different reports
and saves the new definitions in the file system:
rwconverter userid=scott/tiger@db1
stype=rdffile
source="(emp1.rdf,emp2.rdf,staff.rdf)"
dtype=rdffile
dest="(emp1_new.rdf,emp2_new.rdf,staff_new.rdf)"
customize="(d:\rep10g\custom\labels.xml,
d:\rep10g\custom\format_mask.xml)"
batch=yes

Oracle Reports Developer 10g: Build Reports 15- 18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Debugging XML Report Definitions

XML parser
Tracing option
Using Reports Builder

Copyright 2004, Oracle. All rights reserved.

Debugging XML Report Definitions


You have options when debugging XML report definitions.
The XML Parser
The XML parser is part of Oracle's XML Development Kit (XDK), which is delivered
with the core Oracle Database release. The XML parser is a Java package that checks the
validity of XML syntax. The JAR files that contain the XML parser are automatically
configured on installation and are available to Oracle Reports.
The XML parser catches most syntax errors and displays error messages. The error
message contains the line number in the XML file where a problem was found, as well as
a brief description of the problem.

Oracle Reports Developer 10g: Build Reports 15- 19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Debugging XML Report Definitions (continued)
The Trace Option
For testing purposes, you may want to activate the trace facility when you run your report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The example below shows a command line that has three trace options.
rwrun scott/tiger@db1 report=D:\rep10g\custom\emp.xml
tracefile=emp.log tracemode=trace_replace
traceopt=trace_app
Using Reports Builder
It is sometimes useful to open an XML report definition in Reports Builder while you are
still working on it. This will allow you to quickly determine if all objects are created as
expected. For example, if you are creating summaries in an XML report definition, then
opening the definition in Reports Builder enables you to quickly determine if the
summaries are being placed in the appropriate group in the Data Model.
Technical Note
For more information on the XML parser, refer to the Oracle Technology Network
(http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 15- 20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Use XML report definitions:
Run-time customizations
Batch updates
Apply XML definitions
Debug XML definitions

Copyright 2004, Oracle. All rights reserved.

Summary
Using XML report definitions:
- Run-time customizations
- Batch updates
- Stand-alone reports
Applying XML report definitions:
- From the command line
- From PL/SQL
Debugging XML report definitions:
- The XML parser
- The trace option
- Using Reports Builder

Oracle Reports Developer 10g: Build Reports 15- 21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 15 Overview

Creating an XML report definition


Applying a run-time customization
Debugging an XML definition

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 15


This practice session contains:
Running a report using an XML definition
Applying an XML report definition to an existing .rdf file
Using XML you can build fully functional reports or partial reports that can serve as a
customization file.
You will run an XML file and apply an XML definition to an existing report.

Oracle Reports Developer 10g: Build Reports 15- 22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 15
1. Run an XML report definition.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Open p15q1.xml using Wordpad. Examine the code. What type of report
definition is this? What goes on in this file?
b. Execute p15q1.xml using the Run Paper Layout option in Reports Builder.
2. Apply run-time customizations.
a. Open p15q2.rdf. Run the paper layout.
b. What type of report is this? Investigate the data model, the paper layout, and the
report sections.
c. Open p15q2.xml. Examine the code. What goes on in this XML definition
file?
d. Apply p15q2.xml to p15q2.rdf using the RWRUN command and send
the output to a PDF file.
e. Examine the newly created report output. What do you see?

Oracle Reports Developer 10g: Build Reports 15- 23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating and Using Report Parameters

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Create and reference a parameter
Create a list of values for parameter input
Use and modify a system parameter
Build a Paper Parameter Form layout
Customize a Paper Parameter Form layout
Use HTML parameter form extensions

Copyright 2004, Oracle. All rights reserved.

Overview
Parameters enable you to develop dynamic report documents that produce variable report
output depending on the parameter value that you enter at run time. This lesson shows you
how to create and reference user and system parameters and how to customize a Paper
Parameter Form to display parameters at run time.

Oracle Reports Developer 10g: Build Reports 16-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating User Parameters

Restrict values in a WHERE clause


SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
WHERE ID = <a value>

Substitute any part of a SELECT statement


SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
<a where clause>

Substitute a single column or expression


SELECT <a column/expression>
FROM CUSTOMERS

Copyright 2004, Oracle. All rights reserved.

Creating User Parameters


You can create your own parameters and use them to change the SELECT statement of
your query at run time. Parameters can also be used with pluggable data sources: XML,
JDBC, Text, and Express Server queries.
What Is a User Parameter?
A user parameter is a Data Model object that you create to hold a value that users can
change at run time.
You can reference a parameter anywhere in a query. For example:
Restrict values in the WHERE clause of the SELECT statement
Substitute any part of the SELECT statement, including the entire statement
Substitute a single column or expression in the SELECT list
You can display the contents of a parameter in your report by creating a paper layout field
and entering the parameter name in the Field Source property.
Technical Note
For more information on using parameters with pluggable data sources, see the eClass
Oracle9i Reports: Integrate Pluggable Data Sources.

Oracle Reports Developer 10g: Build Reports 16-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating User Parameters

Copyright 2004, Oracle. All rights reserved.

Creating User Parameters (continued)


To create a user parameter in the Object Navigator:
1. In the Object Navigator, click the User Parameter node, and then select the Create
tool.
Note: If this is the first parameter, you can create it by double-clicking the User
Parameter node.
2. Rename the parameter and open the Property Inspector.
3. Verify the data type and width. Enter an initial value if required.

Oracle Reports Developer 10g: Build Reports 16-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating User Parameters (continued)
Parameter Properties

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Property Description
Datatype Specify whether parameter value is Character, Number, or
Date; default is Number when created in the Object
Navigator.
Width Specify maximum allowable width of parameter value;
maximum is 64 KB.
Input Mask Allow users to enter a numeric or date value using a specific
format.
Initial Value Specify the value to use. You can override this value at run
time from the command line or parameter form.
Validation Trigger Validate the parameter value. Enter a PL/SQL function.
List of Values Create a list of values from which users select a valid value
at run time.
Type of Pluggable Used by the PDS for acquiring single sign-on information. It
Data Source identifies that parameter as containing sign-on information
for that PDS connection.

Oracle Reports Developer 10g: Build Reports 16-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Referencing Parameters in a
Report Query

Bind reference replaces a value:


:parameter_name
Lexical reference replaces a clause:
&parameter_name

Copyright 2004, Oracle. All rights reserved.

Referencing Parameters in a Report Query


There are two ways to reference parameters in a query:
Use a bind reference
Use a lexical reference
What Is a Bind Reference?
A bind reference is used to replace a single value or expression in SQL or PL/SQL.
To create a bind reference in a query, prefix the parameter name with a colon (:).
If the parameter object does not exist, Reports Builder automatically creates it for you and
displays a message. In this case, the parameter default datatype is CHARACTER, not
NUMBER.

Oracle Reports Developer 10g: Build Reports 16-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Referencing Parameters in a Report Query (continued)
What Is a Lexical Reference?

Oracle University Internal and TransAmerica Training Management Inc Partner use only
A lexical reference is a placeholder that is used to replace any part of a SELECT
statement, such as column names, the FROM clause, the WHERE clause, or the ORDER
BY clause.
To create a lexical reference in a query, prefix the parameter name with an ampersand
(&).
A lexical reference for a column or table must be created explicitly in the Object
Navigator before you can use it in a query. For other clauses in the SELECT statement, if
the parameter object does not exist, Reports Builder automatically creates it for you and
displays a message. In this case, the parameter default datatype is CHARACTER, not
NUMBER.
Comparing Bind and Lexical Reference Types
Type Prefix Use to Replace Parameter Created by Default?
Bind : Single value or expression Yes, if it does not already exist.
in Reports Builder displays a warning
the following clauses: message and adds the parameter to
WHERE, GROUP BY, User Parameters in the Object
ORDER BY, HAVING, Navigator.
CONNECT BY, START
WITH
Lexical & Any part of a SELECT Provided it is not used for a column
statement or table, yes: if it does not already
exist. Reports Builder displays a
warning message and adds the
parameter to User Parameters in the
Object Navigator. Datatype must
always be Character.

Oracle Reports Developer 10g: Build Reports 16-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Bind References

Restrict values in a WHERE clause


SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
WHERE CUSTOMER_ID > :P_CUST

Substitute a single value or expression in the select


statement
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
ORDER BY DECODE( :SORT,
, 1, CUST_LAST_NAME,
2, NLS_TERRITORY,
ACCOUNT_MGR_ID)

Copyright 2004, Oracle. All rights reserved.

Using Bind References


Use a bind reference anywhere in a query where you can use a single literal value, such as
a character string, number, or date.
Examples
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
WHERE CUSTOMER_ID = :P_CUST
This statement enables you to enter a specific customer number at run time. For example,
if you enter 102, the WHERE clause uses the value 102 to restrict data fetched and to
fetch the one customer that has ID 102.
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
ORDER BY DECODE(:SORT, 1, CUST_LAST_NAME,
2, NLS_TERRITORY,
ACCOUNT_MGR_ID)

Oracle Reports Developer 10g: Build Reports 16-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Bind References (continued)
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID

Oracle University Internal and TransAmerica Training Management Inc Partner use only
FROM CUSTOMERS
ORDER BY DECODE(:SORT, 1, CUST_LAST_NAME,
2, NLS_TERRITORY,
ACCOUNT_MGR_ID)
This statement enables you to output different versions of the report:
Enter 1 for the parameter SORT to display the output ordered by customer name.
Enter 2 to display the output ordered by NLS_territory.
Where Can You Not Use Bind References?
You cannot use a bind reference to:
Replace a column name in the SELECT clause, although you can reference a value,
such as the contents of a parameter:
SELECT LAST_NAME, SALARY * :P_RATE
FROM EMPLOYEES
Replace any part of a FROM clause
Replace reserved words or clauses

Oracle Reports Developer 10g: Build Reports 16-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Lexical References

Use to substitute any part of the query.


SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
&P_WHERE_CLAUSE
&P_ORD_CLAUSE

SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID


FROM CUSTOMERS
&P_WHERE_ORD_CLAUSE

SELECT &P_CUSTNAME CUST, &P_ACCTMGR MGR


FROM &P_TABLE

Make sure that the number and data types match at


run time.

Copyright 2004, Oracle. All rights reserved.

Using Lexical References


Use a lexical reference to replace any clause in a SELECT statement, or even to replace
the entire statement.
Examples
The following statements use lexical references to substitute parts of the query at run
time:
To specify a WHERE clause, ORDER BY clause, or both at run time (as two
separate parameters):
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
&P_WHERE_CLAUSE
&P_ORD_CLAUSE

Oracle Reports Developer 10g: Build Reports 16-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Lexical References (continued)
To specify a WHERE clause, ORDER BY clause, or both at run time (as one
parameter):

Oracle University Internal and TransAmerica Training Management Inc Partner use only
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
&P_WHERE_ORD_CLAUSE
To specify two column names and the table names at run time:
SELECT &P_CUSTNAME CUST, &P_ACCTMGR MGR
FROM &P_TABLE
In this example, you must create the parameters first and provide each with an initial
value to ensure that the SELECT statement is syntactically correct when parsed.
Note: When you use lexical references in the SELECT list, you must, at run time, specify
the same number of items of the correct data type, as defined in the Data Model.

Oracle Reports Developer 10g: Build Reports 16-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Hints and Tips When Referencing
Parameters

Always do the following:


Specify column aliases when substituting column
names
Create lexical parameters explicitly in the Object
Navigator
Enter an initial value for parameters that affect
query validation when NULL

Copyright 2004, Oracle. All rights reserved.

Hints and Tips for Referencing Parameters


If you substitute the name of a column or expression in the SELECT list with a lexical
reference in the SELECT list, always add a column alias after the reference.
The alias serves as a placeholder in the Data Model and can help to prevent confusion that
may arise when the column name in the SELECT list does not match the report column
object.
Remember that Reports Builder automatically creates a parameter when you make a
reference to a nonexistent parameter.
When you create a lexical parameter, you may need to include an initial value before
referencing the parameter in the query, because depending on your use of the parameter, a
NULL value can cause a syntax failure.

Oracle Reports Developer 10g: Build Reports 16-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Hints and Tips for Referencing Parameters (continued)
Example:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The following statement does not cause a syntax error when P_ORDER_CLAUSE is
NULL.
SELECT...FROM...
&P_ORDER_CLAUSE
The following statement does cause a syntax error when P_ORDER_CLAUSE is NULL.
SELECT...
FROM...
ORDER BY &P_ORDER_CLAUSE
Remember to define an initial value for lexical parameters that affect the validity of the
statement, and to validate those that you allow a user to enter at run time. Initial values are
required for lexical parameters used for column names, table names, and incomplete
clauses as shown in the example above.
Note: Always use column aliases when substituting column names with lexical
references.

Oracle Reports Developer 10g: Build Reports 16-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a List of Values

Static list of values

2 3

4
5

Copyright 2004, Oracle. All rights reserved.

1 Choose Static Values.


2 Enter a value and click Add.
3 Repeat for each value to build the list of values.
4 To remove a value; select a value and click Remove.
5 Select OK to accept the list and exit.

Creating a List of Values


You can create a list of values from which users select a valid value at run time. You can
restrict users to only those values in the list, or allow them to enter a different value.
For bind parameters, the list can be a static list of values or a dynamic list that selects
values from the database at run time.
For lexical parameters, you can enter a static list of values.

Oracle Reports Developer 10g: Build Reports 16-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a List of Values (continued)
To create a static list of values:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. In the Parameter Property Inspector, Select the List of Values property. The Static
Values option button is selected by default.
2. Enter a value in the Value field and click Add.
3. Repeat for each value you want in the list.
Note: To remove a value, select the value in the list and click Remove.
Set the Restrict List to Predetermined Values property to determine whether to prevent
users from entering any value not included in your list. By default, this property is Yes. If
you set the property to No, users can still select a value from the list, but they can also
enter other values or leave the value blank.

Oracle Reports Developer 10g: Build Reports 16-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a List of Values

Dynamic list of values

1
3

Copyright 2004, Oracle. All rights reserved.

1 Choose SELECT Statement.


2 Enter a valid query.
3 Select or clear the Restrict List to Predetermined Values check box.
4 Hide the first column from the list.
5 Click OK to accept the query and exit.
Creating a List of Values (continued)
To create a dynamic list of values:
1. In the Parameter Property Inspector, select the List of Values property.
2. Choose SELECT Statement.
3. The SQL Query Statement field is displayed.
Enter a query to populate the list of values. You can include more than one column.
The parameter takes its value from the first column in the list and the column values
appear concatenated in the list at run time.
4. Set the Restrict List to Predetermined Values property, as required.

Oracle Reports Developer 10g: Build Reports 16-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a List of Values (continued)
To see a more meaningful list of descriptive values, instead of the primary or foreign key

Oracle University Internal and TransAmerica Training Management Inc Partner use only
column that you reference in the query, select Hide First Column.
Make sure that the primary or foreign key column is first in the SQL query statement,
because this is still the value that the parameter object contains at run time.

Oracle Reports Developer 10g: Build Reports 16-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Referencing System Parameters

Copyright 2004, Oracle. All rights reserved.

Referencing System Parameters


Reports Builder provides system parameters to allow you to modify standard run-time
settings for each report definition. Each parameter has a default value that you can
modify.
There are currently seven system parameters. You cannot delete them.
Technical Note
The following system parameters have been deprecated in Oracle Reports:
BACKGROUND, CURRENCY, DECIMAL and THOUSANDS.

Oracle Reports Developer 10g: Build Reports 16-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Referencing System Parameters (continued)
The system parameters are:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Parameter Use to specify Values Default
COPIES Number of copies that Any integer 1
should be made if the report
is printed
DESFORMAT Either the output format for Examples: PDF, dflt
the report, or the printer HTML, HTMLCSS,
definition to use when RTF, XML
formatting the report when
DESTYPE=FILE and
DESNAME=filename
DESNAME Name of output device, such <reportname>.lis
as filename, printer name,
mail userid
DESTYPE Type of device that will Cache, localfile, file, Cache
receive the report output printer, sysout, mail,
oracleportal, ftp,
webdav, screen,
preview
MODE Whether report executes in Default, bitmap, Default
bitmapped or character mode Character
ORIENTATION The print direction of printer Default, portrait, Default
output Landscape
PRINTJOB Whether print job dialog box Yes, No Yes
is displayed at run time, if
destype=file or printer

Oracle Reports Developer 10g: Build Reports 16-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building a Paper Parameter Form

+ Report properties:
Width
Height
Number of Pages

Copyright 2004, Oracle. All rights reserved.

Building a Paper Parameter Form


The paper reports that you created in previous lessons ran successfully without a
parameter form. However, when you created parameters, a default run-time parameter
form appeared to enable you to change the values at run time.
You can build your own parameter form, select the parameters that you want to display,
and then customize the appearance of the parameter form in the Report editor.
How to Build a Parameter Form
1. Select menu item Tools > Parameter Form Builder.
2. The Parameter Form Builder dialog box appears.
If desired, modify the title, hint, and status line text. These lines are displayed at the
top of the parameter form at run time.
3. Select or deselect parameters in the parameter section as necessary.
Note: Selected parameters are displayed in the dialog box as highlighted on a black
background. Deselected parameters do not appear in the parameter form.
4. Modify label text of the selected parameters, if you wish.
5. Click OK to create the parameter form.

Oracle Reports Developer 10g: Build Reports 16-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Building a Paper Parameter Form (continued)
If you create many parameters in your report, the run-time parameter form can spread

Oracle University Internal and TransAmerica Training Management Inc Partner use only
over more than one page. You can view subsequent pages at run time by clicking Next.
Setting Report Properties for the Parameter Form
There are three properties in the Report Property Inspector, under the Parameter Form
Window node, that specifically apply to the parameter form.
Report Property Use to
Width Define the width of the parameter form that
the user sees at run time
Height Define the height of the parameter form that
the user sees at run time
Number of Pages Define the number of physical pages that
make up the parameter form

Oracle Reports Developer 10g: Build Reports 16-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing a Paper Parameter Form

Copyright 2004, Oracle. All rights reserved.

Customizing a Paper Parameter Form


You can customize the parameter form layout in a similar way to customizing the paper
report layout. You can modify colors and fill patterns (except in fields), move or delete
existing objects, create additional objects, import file contents such as a company logo,
and so on.
Creating Parameter Fields
A parameter field is a placeholder for a parameter value on the run-time parameter form,
in the same way that a field is a placeholder for a column value in the layout.
You cannot modify the color or fill patterns of a parameter field. However, the Property
Inspector enables you to modify all parameter properties.
Reports Builder creates one field for each parameter that you select in the Parameter Form
Builder. If a parameter in your Data Model does not have an associated field, it does not
appear in the run-time parameter form because it does not have any display attributes.
You can create additional fields by using the field tool in the parameter form toolbar and
sourcing the field to an existing parameter.

Oracle Reports Developer 10g: Build Reports 16-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Customizing a Paper Parameter Form (continued)
Creating Parameter Boilerplate Objects

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Parameter boilerplate is text or graphics that either you create or the Parameter Form
Builder creates by default.
The Parameter Form Builder creates parameter boilerplate objects for the labels of each
parameter field as well as for the title, hint, and status lines.
You can create additional boilerplate objects to customize your parameter form, for
example, create report heading pages, modify default labeling, insert images, and so on.
Note: You cannot create a file link in the parameter form; however, you can insert file
contents, as you can in the layout.

Oracle Reports Developer 10g: Build Reports 16-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Parameter Form HTML Extensions

Boilerplate text with HTML tags


Parameter fields with JavaScript
Parameter Form header
Parameter Form footer

Copyright 2004, Oracle. All rights reserved.

Using Parameter Form HTML Extensions


HTML Parameter Form extensions enable you to enhance your run-time paper parameter
form with HTML tags and JavaScript. Using HTML, you can create boilerplate text.
Incorporating JavaScript extends your parameter form to support client-side validation
eliminating network roundtrips. You can do the following:
Extension Purpose
Create boilerplate text with HTML tags Add hyperlinks or HTML tagged text
Insert parameter fields with Javascript Define input or select events such as
validation or raising errors
Create a Paper Parameter Form header Place a logo or standard links in the header
of the HTML Parameter Form
Create a Paper Parameter Form footer Place a logo or standard links in the footer
of the HTML Parameter Form

Oracle Reports Developer 10g: Build Reports 16-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Parameter Form HTML Extensions (continued)
To create a boilerplate text object for HTML tags:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Create a boilerplate text object using the Text tool.
2. Enter or import the desired HTML code.
3. Open the Property Inspector of the text object and set the Contains HTML Tags
property to Yes.
Note: The text only shows for HTML output formats.
To create HTML parameter form fields with input or select events:
1. Create or edit a Parameter Form field.
2. Open the Property Inspector of the Parameter Form field and set the Additional
Attributes(HTML) property to a valid JavaScript event handler.
Note: In some cases, such as raising messages, the JavaScript code may have to be
entered in the Before Form report properties. To insert the JavaScript code in the
Before Form report properties:
- Open the report Property Inspector.
- Set the Before Form Type property to Text if you enter the JavaScript code, or to
File if you will import the code from a file.
- Set the Before Form Value property by clicking the ... button to either enter the
JavaScript, or select the HTML file with the JavaScript.

Oracle Reports Developer 10g: Build Reports 16-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Parameter Form Header and Footer

Header

Footer

Copyright 2004, Oracle. All rights reserved.

Parameter Form Header and Footer


To create an HTML parameter form header:
1. Open the Property Inspector of the report.
2. Set the Before Form Type property to Text if you will enter the header, or to File if
you will import the header from a file.
3. Set the Before Form Value property by clicking the ... button to either enter the
HTML code or select an HTML file to import.
To create an HTML parameter form footer:
1. Open the Property Inspector of the report.
2. Set the After Form Type property to Text if you will enter the footer, or to File if
you will import the footer from a file.
3. Set the After Form Value property by clicking the ... button to either enter the
HTML code, or select an HTML file to import.

Oracle Reports Developer 10g: Build Reports 16-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Define and use bind and lexical parameters
Create a list of values
Reference system parameters
Modify parameter values at run time, using:
Command line arguments
Run-time parameter form
Create a run-time paper parameter form:
Build it using the Parameter Form Builder
Customize it using the Report Editor, HTML

Copyright 2004, Oracle. All rights reserved.

Summary
Parameter types:
- User parameters:
References: bind or lexical
List of values: dynamic (bind only) or static
- System parameters
Modifying parameter values at run time:
- Pass the parameter on the RWRUN command line
- Allow users to change values in the run-time parameter form
Creating a run-time parameter form:
- Build a parameter form with the Parameter Form Builder
- Customize the paper parameter form layout in the Report editor
- Evaluate using HTML Parameter Form extensions

Oracle Reports Developer 10g: Build Reports 16-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 16 Overview

Modifying an existing report to use a bind parameter


Adding a dynamic list of values
Adding a lexical parameter
Adding a static list of values
Creating a customized parameter form

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 16


This practice session contains:
Modifying an existing report to use a bind parameter
Adding a dynamic list of values
Adding a lexical parameter
Adding a static list of values
Creating a customized parameter form
In this practice session, you create bind and lexical parameters to restrict records in the
report. You add lists of values to select valid values at run time.
You then create your own default parameter form and customize it to include extra text
and graphics.

Oracle Reports Developer 10g: Build Reports 16-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 16
1. Open report p13q3.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the data model and add the following columns from the CUSTOMERS
table. Create a new group for the customer information above the
G_ORDER_ID group.

Column Label Width


cust_first_name || || cust_last_name Name 30
cust_email Email 20

Create a reference to a bind parameter P_CUSTOMER in the query to restrict orders


to the parameter value you input at run time.
Note how Reports creates the parameter automatically.
b. Run and test the report with valid customer IDs.
c. Save the report as p16q1.rdf. Do not close it
2. Continue with report p16q1.rdf.
a. Add a list of values to select any valid CUSTOMER_ID in the CUSTOMERS
table that has an order in the ORDERS table. Do not allow users to enter any
other value. The list should display customer names, not CUSTOMER_ID
numbers.Ensure that each customer name appear only once in the list, even if the
customer has several orders.
b. Save the report as p16q2.rdf. Do not close it for the moment.
c. Run the paper layout to test the report. Run the Web layout as well.
3. Open report p5q3.rdf.
a. Create a lexical parameter to enable users to order the data by different columns
(or not at all) at run time. Include an ORDER BY clause in the query with a
lexical reference to the parameter. Enter an initial value for the parameter to
order by the employees last name.
b. Add a static list of values for the parameter P_ORDER. Code two or three
alternative ORDER BY clauses. Allow any clause to be entered at run time.
c. Run the paper layout to test.
Select an ORDER BY clause from the list.
Enter your own ORDER BY clause.
Delete the initial parameter value.
d. Save the report as p16q3.rdf and close it.

Oracle Reports Developer 10g: Build Reports 16-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 16 (continued)
4. Continue with report p16q2.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a default parameter form.
Include a Title message but not a Hint message.
Display the P_CUSTOMER parameter.
b. Use your imagination to customize the form in the Parameter Form editor.
Make sure that the parameter P_CUSTOMER is placed in a prominent position
for user entry.
Add some graphics; modify colors and fill patterns.
c. Add a format mask to the field displaying line_total.
d. Run the paper layout to test. Select a customer from the list.
e. Save the report as p16q4.rdf and close it.

Oracle Reports Developer 10g: Build Reports 16-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Embedding a Graph in a Report

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Create and display a simple graph
Customize a graph in a Web report
Modify graph data dynamically
Specify additional graph attributes using
Graph.XML
Use graph hyperlinks

Copyright 2004, Oracle. All rights reserved.

Overview
In this lesson, you learn to display a graph in a report at run time.

Oracle Reports Developer 10g: Build Reports 17-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding a Graph to a Paper Report

Copyright 2004, Oracle. All rights reserved.

Creating and Embedding a Graph in a Report


As in many Oracle products, Oracle Reports uses the BI Graph Bean for graph
development. The BI Graph Bean offers 52 different types of graphs, including three
dimensional (3D) graphs. There is no separate graphics tool. Reports Builder provides an
easy-to-use Graph Wizard to enable you to easily produce a graph for your paper and Web
reports.
In Reports Builder, you can invoke the Graph Wizard from the Paper Layout view and the
Paper Design view.
From the Paper Layout view:
1. Click the Graph tool in the vertical toolbar.
2. Drag a square in the painter area where you want your graph to appear. The Graph
Wizard displays.
3. Step through the Wizard to create the desired graph and position it in your report.
Note: In the Paper Layout, the graph is represented as a bar graph even if the graph is of
another type.

Oracle Reports Developer 10g: Build Reports 17-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating and Embedding a Graph in a Report (continued)
From the Paper Design view:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Select Insert > Graph from the menu. The Graph Wizard displays.
2. Step through the Wizard pages to create the desired graph and position it in your
report.
To reenter the Graph Wizard, do either of the following:
Right-mouse-click and select Graph Wizard
Click the graph and select Edit > Settings from the menu.

Oracle Reports Developer 10g: Build Reports 17-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding a Graph to a Web Report

Copyright 2004, Oracle. All rights reserved.

Adding a Graph to a Web Report


To add a graph to a Web report:
1. Open the Web Source view.
2. Position your cursor in the section of the source code where you want to add a
graph.
3. Select Insert > Graph from the menu.
4. Step through the Wizard pages to create the desired graph.
To reenter the Graph Wizard, position your cursor anywhere within the rw:graph tag and
select Edit > Settings.
You will learn more about the rw:graph tag later in this lesson.

Oracle Reports Developer 10g: Build Reports 17-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Selecting the Graph Type

Copyright 2004, Oracle. All rights reserved.

Selecting the Graph Type


Select the type of graph that you require. The Wizard provides a preview of what the
graph will look like as well as recommendations for when different types of graphs are
useful and appropriate.
Select the graph subtype that you require, using the subtype pictures as a guide. If desired,
select the 3D effect check box. Click Next to continue.
The next page of the Graph Wizard enables you to position the graph at the beginning or
end of the report output, or to display the graph once for each occurrence of a group.

Oracle Reports Developer 10g: Build Reports 17-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Selecting the Graph Data

Copyright 2004, Oracle. All rights reserved.

Selecting the Graph Data


On the next two wizard pages, you define the data in the graph:
1. Select the field that you want to appear as the categories of your graph. Category
columns are used for the x-axis.
2. Select the field that you want to appear as the data values of your graph. Data values
columns are used for the y-axis and must be numeric.

Oracle Reports Developer 10g: Build Reports 17-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding Options to the Graph

Copyright 2004, Oracle. All rights reserved.

Adding Options to the Graph


The remaining pages in the Graph Wizard allow you to add optional characteristics to
your graph.
Use the Layout page to rearrange the data in a graph. The arrangement of data
determines the way a graph is displayed. On the Layout page, you can rearrange place
holders that represent dimensions, such as Product, Time, Geography, and so on.
When these changes are applied, then actual dimension members are displayed in the
positions that you specified.
Use the Title page to specify text and font attributes for the title, subtitle, and footnote
of a graph.
Use the Legend page to select options for the legend of a graph. The legend area is a
place on a graph that provides a key to the information that is shown in the graph. It
contains legend markers, each corresponding to a series of data, and legend text,
which describes the data in that series. For example, you might have different cities
represented by data markers of different colors. Markers represent data on a graph. If
red markers in your graph represent New York, then there is a corresponding red
legend marker in the legend area, with legend text reading New York.

Oracle Reports Developer 10g: Build Reports 17-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Adding Options to the Graph (continued)
Use the X-Axis page to specify options for the x-axis of your graph. Options include

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the text and font of the axis title, and axis line style and color. You can insert
parameters into the axis labels by clicking the Insert button and selecting the desired
parameter.
Similarly, use the Y-Axis page to specify options for the y-axis of your graph.
Use the Plot Area page of the Graph Wizard to specify how the plot area of the graph
should be displayed. Options include gridlines, the line color and style for gridlines,
data lables, and data tips (tooltips displayed when the mouse is moved over a bar, pie
slice, etc.).

Oracle Reports Developer 10g: Build Reports 17-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Web Graphs

<rw:graph id="graph" src="G_DEPARTMENT_ID"


groups="DEPARTMENT_ID"
dataValues="SALARY"
series="EMPLOYEE_ID,MANAGER_ID"
width="1200" height="600"
graphHyperlink="http://myhost.mycompany.com
/myexamples/emp.jsp?server=rep-server&
userid=hr/hr@orcl&destype=cache&
desformat=htmlcss&emp_id=&EMPLOYEE_ID;">

Graph XML

</rw:graph>

Copyright 2004, Oracle. All rights reserved.

Customizing Web Graphs


Earlier in the course, you learned how to customize your Web reports by editing the Web
source code and modifying the attributes for the Reports custom JSP tags. You can
customize your Web graphs by modifying the attributes of the rw:graph tag.

Oracle Reports Developer 10g: Build Reports 17-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The rw:graph Tag

Defines a graph <rw:graph


Attributes: id="graph-id"
id src="group-name"
src groups="column-list"
groups dataValues="list"
dataValues
[series="column-list"]
series
[width="size"]
width
[height="size"]
height
graphHyperlink [graphHyperlink="link"]
tag body
</rw:graph>

Copyright 2004, Oracle. All rights reserved.

The rw:graph Tag


The rw:graph tag defines a graph in a Web report. The rw:graph tag requires a data source
and must be enclosed in the rw:report tag.The tag body is required and contains the
definition of the graph in XML.
The attributes that define the rw:graph tag are:
id: Unique identifier in the page scope
src: Name of the data source group
groups: List of data source columns that are used to generate a row-key in the XML
graph definition
dataValues: List of numeric datasource columns that provide data for the graph
series: List of datasource columns that are used to generate a column-key in the XML
graph definition; optional
width: Width of the graph in pixels; optional
height: Height of the graph in pixels; optional
graphHyperlink: Defines a link to another source such as a URL or drill down report;
optional

Oracle Reports Developer 10g: Build Reports 17-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The rw:graph Tag (continued)
Use the Web Source editor to modify or add attributes. In the previous slide, the width and

Oracle University Internal and TransAmerica Training Management Inc Partner use only
height attributes were included to customize the size of the graph in the Web report. The
graph hyperlink will invoke a drill down report on a specific employee.
You can also customize a graph by modifying the graph XML.

Oracle Reports Developer 10g: Build Reports 17-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing Graphs Using
the Graph.XML File

Copyright 2004, Oracle. All rights reserved.

Customizing Graphs Using the Graph.XML File


When you use the Graph Wizard to create a graph in the report layout, it generates
an XML file to store the attributes for the graph. This XML file is called Graph.XML. If
you want to define additional graph attributes beyond the ones exposed by the Graph
Wizard, you can edit the Graph.XML file manually, and Oracle Reports will then use
this edited Graph.XML to generate the graph in your report output.
To access Graph.XML in a paper report:
1. Invoke the Paper Layout.
2. Double click the graph object to open the Property Inspector.
3. Click the button in the Graph Settings property to view and edit the Graph.XML
file.
Note: For Web reports, Graph.XML is available directly between the
<rw:graph> and </rw:graph> tags in the Web source of the JSP.

Oracle Reports Developer 10g: Build Reports 17-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Customizing Graphs Using the Graph.XML File (continued)
The Graph.DTD File

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The list of all possible graph attributes is contained in a file called Graph.dtd. You can
locate this file in ORACLE_HOME\jlib\bigraphbean.jar. Use the WinZip utility
to unzip the contents of this JAR file. You can then use a text editor to view the
Graph.DTD file.
Technical Note
For more information on graphs and the graph attributes that can be specified in the
Graph.XML file, see the Oracle Reports 10g Frequently Asked Questions on the Oracle
Technology Network:
http://otn.oracle.com/products/reports/index.html

Oracle Reports Developer 10g: Build Reports 17-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Graph Hyperlinks

Document
on same
machine
Any
destination
Any URL

Copyright 2004, Oracle. All rights reserved.

Using Graph Hyperlinks


Oracle Reports supports the ability to add a hyperlink to a graph embedded in a report.
More specifically, the hyperlink can be different for each section of the graph. For
example, a user may click on a particular slice of a pie graph, and drill down to another
report to see detailed information.
Usage Notes
You can set another report as the graph hyperlink. This second report will run from
your first report output.
The Additional Attributes (HTML) property for Parameter Form fields cannot be used
to add additional HTML attributes to a link defined by a graph hyperlink.
You cannot set a graph hyperlink by using PL/SQL.
You must set the Hyperlink Destination property for a graph hyperlink that specifies
another layout object as its destination.

Oracle Reports Developer 10g: Build Reports 17-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Graph Hyperlinks (continued)
Examples:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
A document on the same machine:
file:///C:corp_policy/car/lease.pdf
A destination within the current report:
#sales_rep&<Total_Profit>
Any URL:
http://wlord-pc.us.oracle.com:7777/myexamples/
emp.jsp?server=rep1-wlord&userid=hr/hr@wl81&
destype=cache&desformat=htmlcss&emp_id=&EMPLOYEE_ID

Oracle Reports Developer 10g: Build Reports 17-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Technical Note
When delimiting parameters in a URL, you can use the ampersand (&) or the plus sign

Oracle University Internal and TransAmerica Training Management Inc Partner use only
(+). The ampersand is more commonly used and recommended. The ampersand
immediately preceding EMPLOYEE_ID indicates substitution.

Oracle Reports Developer 10g: Build Reports 17-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Build a new graph by invoking the Graph Wizard to
build and embed a graph in a paper report
Customize a graph in a Web report using the
rw:graph tag
Customize graphs using the Graph.XML file
Use a graph hyperlink for drilling down

Copyright 2004, Oracle. All rights reserved.

Summary
Use the Graph Wizard to create and embed a simple graph in your report.
Reenter the Graph Wizard to make changes to the graph object, such as its position in
the report.
Customize a graph in a Web report by editing the attributes of the Reports JSP custom
tag, rw:graph.
Customize graphs by specifying additional graph attributes in the Graph.XML file.
Use the graph hyperlink property to implement drill-down functionality.

Oracle Reports Developer 10g: Build Reports 17-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 17 Overview

Using the Graph Wizard to create a graph


Altering the graph in the Graph Wizard
Creating graphs that print once for each record of a
group
Adding a graph to a Web layout
Customizing a graph in a Web report

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 17


This practice session contains:
Using the Graph Wizard to create a graph in an existing report
Altering the graph with the Graph Wizard
Creating graphs in an existing report that will be printed once for each record of a
group
Creating a graph for a Web report
Customizing a graph for a Web report
In this practice session you open existing reports to add graphs using the Graph Wizard.
You reenter the Graph Wizard to change the characteristics of a graph. You will add and
customize a graph in a Web report.

Oracle Reports Developer 10g: Build Reports 17-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 17
1. Open report p17q1a.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Run the paper layout to become familiar with the report.
b. Rename SumCust_totalPersales_rep_id to Total_Sales (a shorter, more
meaningful name looks better in a chart).
c. Use the Graph Wizard to create a line chart.
Graph Type Bar
Graph Subtype Bar
Position at the end of the report
Category sales_rep_id
Data total_sales
d. Run the paper layout to test. Resize the graph in the Paper Layout, if necessary.
e. Save report as p17q1.jsp.
2. Reenter the Graph Wizard to change the characteristics of the graph created in the
previous exercise.
a. Give the graph the following characteristics:
Title Order Total per Sales Rep
Graph Type Horizontal Bar
Graph Subtype Bar
b. Run the paper layout to test.
c. Save report to p17q2.jsp.
3. Continue with report p17q2.jsp.
a. Run the Web layout. What do you see?
b. Update the Web source with the correct column name.
c. Run the Web layout again to test.
d. Add a graph to the Web source. Position the graph at the beginning of the report.
Graph Type Bar
Graph Subtype Bar
Position at the end of the report
Category sales_rep_id
Value total_sales

e. Run the Web layout to test. Save the report as p17q3.jsp.

Oracle Reports Developer 10g: Build Reports 17-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 17 (continued)
4. Open report p9q3.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Use the Graph Wizard to create a pie chart for the data group G_PRODUCT.
Invoke the Graph Wizard with the focus on the Paper Layout.
Graph Type Pie
Graph Subtype Pie
Graph Frequency Once per Name
Data Group G_PRODUCT
Category product_id
Data prod_total
b. In the Paper Layout, ensure that the graph is postitioned beneath the product
group.
c. Run the paper layout and test the report.
d. Save the report as p17q4.jsp.
5. Continue with report p17q4.jsp.
a. Add a bar graph to the Web source for the data group G_PRODUCT. Use the
same data group, category, and value settings as in the previous exercise.
Hint: You want to insert the graph just before the termination of the rw:foreach
tag for the group G_NAME.
b. Run the Web layout to test. Ensure that a graph displays for each sales
respresentative.
c. Resize the graph to a width of 800 and a height of 450.
d. Save the report as p17q5.jsp. Run the Web layout to test.

Oracle Reports Developer 10g: Build Reports 17-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enhancing Matrix Reports

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Design a matrix Data Model
Design a matrix Paper Layout
Modify a matrix structure
Create and modify matrix summaries
Create a matrix with group report
Create a nested matrix report

Copyright 2004, Oracle. All rights reserved.

Overview
Matrix or cross product reports show cells of information that relate to values appearing
across the top and down the left side of the report.
In an earlier lesson, you created a matrix report using the Report Wizard. In this lesson,
you modify the Data Model and layout objects to enhance your matrix reports.

Oracle Reports Developer 10g: Build Reports 18-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Matrix Data Model

4
2

Copyright 2004, Oracle. All rights reserved.

1 Cross product group


2 Row and column groups
3 Cell group
4 Cell column is the source of a cross product summary that
becomes the cell content

The Matrix Data Model


To maintain and enhance the structure of a matrix report, you must understand the Data
Model objects and their interdependency.
The Data Model above is the matrix report created in an earlier lesson. It demonstrates the
structure of a simple Matrix report. For the simple matrix style, the Report Wizard creates
three basic data groups:
One row of record values (Department_Name)
One column of record values (Job_ID)
One group of cells, where each cell contains data related to each row and column
combination.

Oracle Reports Developer 10g: Build Reports 18-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The Matrix Data Model (continued)
There is an extra group that surrounds the row and column groups. It is called the cross

Oracle University Internal and TransAmerica Training Management Inc Partner use only
product group and contains the summary column that forms each cell value, SumSalary,
as well as the summaries to total the row and column values.

Oracle Reports Developer 10g: Build Reports 18-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Matrix Paper Layout

Job Title F_job_id

Dept Name Sumsalary

F_department_na F_Sumsalary

1 2 3

Copyright 2004, Oracle. All rights reserved.

1 Repeating frame for rows (Down direction)


2 Repeating frame for columns (Across)
3 Matrix object, the intersection of the two repeating frames

The Matrix Paper Layout


Although the supplied templates create good-looking, professional report output, they do
not help to explain the paper layout objects in a classroom environment. The number of
objects and their interdependency are more complex in matrix reports than in the other
styles covered so far.
This section explains the objects by showing an expanded paper layout where each outer
object is slightly larger than its contents.
The paper layout for a matrix report is more complex than other styles because of the
special relationship between the row and column groups and the cell values.

Oracle Reports Developer 10g: Build Reports 18-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The Matrix Paper Layout (continued)
For the simple matrix style, the Report Wizard creates:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
One repeating frame with print direction of Down to hold the row values
One repeating frame with print direction of Across to hold the column values
A field for the summary of the cell values; the source is SumSalary, which resides in
the cross product group
Fields for the row and column values, as well as for the row, column, and report
summaries if applicable
A matrix object that corresponds to the cross product group; this object intersects the
row and column repeating frames, and contains the cell field.

Oracle Reports Developer 10g: Build Reports 18-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Matrix Summaries

F_CITY 1

Job Title F_job_id

Dept Name Sumsalary

F_name F_Sumsalary F_SumsalaryPerDEPT

2 F_SumsalaryPerJOB_I F_SumsalaryPerCITY

F_SumsalaryPer
3

Copyright 2004, Oracle. All rights reserved.

1 Product Order = G_DEPARTMENT_NAME


2 Product Order = G_JOB_ID
3 Product Order = G_DEPARTMENT_NAME G_JOB_ID

Creating Matrix Summaries


The Report Wizard allows you to create the summary for the cell values and the row or
column summaries. These summaries are inside the cross product group (but outside the
row and column groups).
This section discusses an extra property that applies only to cross product summaries, the
Product Order property.

Oracle Reports Developer 10g: Build Reports 18-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Matrix Summaries (continued)
Setting the Product Order

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Wizard sets a sensible default for this property. You do not need to alter the setting,
but you need to understand this property if you create complex matrix reports, or add
columns to an existing matrix report.
The product order defines the order in which Reports Builder evaluates the groups in the
cross product for a summary.
Product Order also defines the frequency of a summary, formula, or placeholder column
in a cross product group. That is, the column has one value for each combination of values
in its Product Order groups.
The Product Order list of values provides all possible group combinations.
In the matrix report:
F_SumSalPerDEPARTMENT_NAME has one value for each department
(G_DEPARTMENT_NAME).
F_SumSalPerJOB_ID has one value for each job ID (G_JOB_ID).
F_SumSALARY, the matrix cell, has one value for each combination of
G_DEPARTMENT_NAME and G_JOB_ID, so the Product Order is
G_DEPARTMENT_NAME G_JOB_ID.
Source Column Reset At Product Order
F_SumSALPerDEPARTMEN_ G_DEPARTMENT_ G_DEPARTMENT_NAM
NAME NAME E
F_Sum_SALPerJOB_ID G_JOB_ID G_JOB_ID
F_SumSALARY G_JOB_ID G_DEPARTMENT_NAM
E
G_JOB_ID
The Reset At option has the same effect as in other report styles. When you create
summaries with the Wizard, each summary resets for each occurrence of the group. For
example, the department summary resets for each department. If you want the summary
values to accumulate throughout the report, change Reset At to a higher level, such as
Report.

Oracle Reports Developer 10g: Build Reports 18-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating the Matrix Manually

Using the Data Wizard:


Select the Matrix query check box
Step through the wizard
Entirely manual:
Select the appropriate query tool
Create extra groups
Create the cross product group

Copyright 2004, Oracle. All rights reserved.

Creating the Matrix Manually


You may want to create the matrix report manually. You can use the Data Wizard or you
could do everything entirely manually.
Using the Data Wizard:
1. In the Object Navigator, create a new report and select Build a new report manually
from the dialog box.
2. In the Data Model view, right mouse click and select Data Wizard from the pop-up
menu.
3. On the Query Name page, select the Matrix query check box.
4. Enter the query.
5. Step through the Wizard to determine the columns for the row, column, cell, and
totals.
6. Invoke the Report Wizard to create the paper layout.

Oracle Reports Developer 10g: Build Reports 18-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating the Matrix Manually (continued)
Building the entire matrix report manually:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. In the Object Navigator, create a new report and select Build a new report manually
from the dialog box.
2. In the Data Model, click the appropriate tool and move the cursor in the Data Model
editor.
3. Enter the query.
4. Drag the title bar of the single group object down to create some space.
5. Drag the row column up left into the space you just created.
6. Drag the column column up right into the space you just created.
7. Click the vertical toolbar, click the Cross Product tool, and drag a box around the
two groups you want to include in the cross product group.
8. Invoke the Report Wizard to create the paper layout.

Oracle Reports Developer 10g: Build Reports 18-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Matrix with Group Data Model

Copyright 2004, Oracle. All rights reserved.

Building a Matrix with Group Report


A matrix with group report consists of a break group that contains a simple matrix
structure. For each break value, different row and column values might apply. In a single
query Data Model, each matrix contains only the applicable rows and columns for the
break value.
The Data Model for a matrix with group report is identical to the simple matrix, except for
the addition of a break group, similar to a master-detail hierarchy.
The break group exists one level above, and outside, the matrix group. The entire cross
product group repeats for each record in the break group.

Oracle Reports Developer 10g: Build Reports 18-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Matrix with Group Layout

Region: F_CITY

Job Title F_job_id

Dept Name Sumsalary


Total:

F_department F_Sumsalary F_SumsalaryPerDEPA

F_SumsalaryPerTITLE F_SumsalaryPerCITY

Total: F_SumsalaryPer

Copyright 2004, Oracle. All rights reserved.

Building a Matrix with Group Report (continued)


The Paper Layout for the Matrix with Group style is identical to the matrix style except
for the addition of a repeating frame that surrounds the entire matrix layout and
corresponds to the break group in the Data Model.

Oracle Reports Developer 10g: Build Reports 18-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building a Nested Matrix

Copyright 2004, Oracle. All rights reserved.

Building a Nested Matrix


You create the nested matrix style with the Wizard by adding an extra level in the Rows
tab. This style has some specific features. This section briefly describes the Data Model
and Paper Layout, pointing out the differences from the Matrix with Group style. It also
explains how summaries evaluate the extra group level of a nested matrix.
The Nested Matrix Data Model
The Wizard creates the same objects for then nested matrix data model as for a simple
matrix structure. In addition, it creates an additional break group for each level of nesting.
The cross product group encloses the additional break groups as well as the two original
dimension groups of the rows and columns.
If you enhance the existing Data Model to include an additional level of nesting, the
existing cross product group does not recognize any newly created group. You must create
the cross product group after you create all the groups that you want in the nested matrix.

Oracle Reports Developer 10g: Build Reports 18-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Building a Nested Matrix (continued)
To recreate the cross product group:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Delete the existing cross product group.
Note: The cross product summaries are automatically deleted.
2. Create the new groups that you need.
3. Recreate the cross product group. Use the cross product tool (AxB) to click and drag
a region surrounding the break groups and the two dimension groups (rows and
columns).
4. Use the reenterable Wizard to re-create the summaries.
Note the differences between the data models for a Nested Matrix and a Matrix with
Group:
Matrix with Group Data Model: The cross product group is the child of a parent
break group at a level above and outside the cross product.
Nested Matrix Data Model: The cross product contains three or more groups, one or
more levels of break group and two dimensional groups to form rows and columns.
Note: You can mix these styles. That is, you can create a Matrix with Group report where
the matrix has several nested levels within it.

Oracle Reports Developer 10g: Build Reports 18-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Nested Matrix Paper Layout

Copyright 2004, Oracle. All rights reserved.

Nested Matrix Paper Layout


The Report Wizard creates the same paper layout objects for a Nested Matrix as for a
simple matrix structure. It also creates the following objects:
One repeating frame for each additional break group, nested within the same overall
matrix structure
One matrix object for each additional break group
The exact appearance depends on whether the extra level is in the Row or in the Column
tab. The diagram above shows nested rows.
In the Object Navigator, you can see the matrix structure in the Dimension and Frequency
nodes. These nodes exist only if there is a matrix. You do not see a node for the matrix
object name, but it does have properties. You can open the Property Inspector in the Paper
Layout only.

Oracle Reports Developer 10g: Build Reports 18-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Nested Matrix Paper Layout (continued)
Creating a Matrix Object

Oracle University Internal and TransAmerica Training Management Inc Partner use only
When possible, use the Wizard to create your matrix reports, because the layout consists
of many layers and interdependent objects.
If you resize the repeating frames, take care to maintain the intersection between them,
otherwise you might destroy the matrix object. Reports Builder gives you a warning
message if this is likely to happen.
If you destroy the matrix object, or want to create the matrix structure yourself, you must
re-create the matrix object. Each matrix object intersects and determines the relationship
between two and only two repeating frames.
To create the matrix object:
1. Make sure that the two related repeating frames intersect each other correctly.
2. Select both repeating frames [Shift]-Click.
Note: If you do not select both frames, you receive an error message:
REP-3100: Matrix must include at least 1 Down and 1
Across repeating frame.
3. Select Insert > Layout Matrix.
4. Move the matrix object back through the layout layers until it is behind the cell field
(Layout > Move Backward). This step is not necessary to make the report run, but it
is useful to see the cell field if the matrix has a solid fill.

Oracle Reports Developer 10g: Build Reports 18-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Nested Matrix Summaries

F_SumSALARY F_SumSALPerDEPA

F_Sum_CITY

F_SumSALPerJOB_

Copyright 2004, Oracle. All rights reserved.

Creating Nested Matrix Summaries


The Wizard creates nested summaries in the cross product group.
If you create or alter a nested summary, you must set the Product Order correctly. Always
test the report output very carefully to ensure that the summaries are displaying exactly
the value you expect.

Oracle Reports Developer 10g: Build Reports 18-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Nested Matrix Summaries (continued)
The Product Order indicates the way in which Reports Builder evaluates a summary.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Product Order also determines the position (frequency) of the summary if you use the
reenterable Wizard.
The diagram on the previous slide shows three summary fields created by the Wizard:
F_SumSALPerJOB_ID: Total salary for each column of job ID. Displayed once for
each job ID.
F_SumSALPerDEPARTMENT_NAME: Total salary for each department row
nested within a specific city row. Displayed once for each combination of
city/department.
F_SumSALARY: The cell value. Displayed once for each combination of city/
department name/job ID.
Field Name Reset At Product Order
F_SumSALPerJOB_ID G_JOB_ID G_JOB_ID
F_SumSALPerDEPART- G_DEPARTMENT_N G_CITY
MENT_NAME AME G_DEPARTMENT_NAME
F_SumSALARY G_DEPARTMENT_N G_CITY G_JOB_ID
AME G_DEPARTMENT_NAME

The diagram also shows a fourth summary, F_Sum_CITY, which you might want to
create yourself to produce a subtotal for each region.
1. Create another summary in the cross product group.
2. Create a layout field and place it as shown in the diagram, in the R_G_CITY
repeating frame (use the Object Navigator to identify it). The following table shows
the property settings.

Oracle Reports Developer 10g: Build Reports 18-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Displaying Zeros

Copyright 2004, Oracle. All rights reserved.

Displaying Zeros in Cells with No Value


The field that displays each cell of the matrix is sourced to a summary column, such as
SumSalary.
If there is no value for a particular row/column combination, the summary column is null
and therefore the cell is displayed as a blank field.
You can very simply change the blank to zero or any default value you choose.

Oracle Reports Developer 10g: Build Reports 18-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Displaying Zeros in Cells with No Value (continued)
To display zeros in cells with null values, open the Property Inspector for either the cell

Oracle University Internal and TransAmerica Training Management Inc Partner use only
field or the SumSalary summary column and set the Value if Null property to zero.

Oracle Reports Developer 10g: Build Reports 18-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Create matrix reports with the Report Wizard
Describe the relationship between the data and
layout in a cross product structure
Identify and describe matrix-specific elements:
Cross product group
Product Order property
Matrix layout object

Copyright 2004, Oracle. All rights reserved.

Summary
Letting the Wizard and Template Work for You
Use the Report Wizard to create your matrix, even if you need to modify it later. Allowing
the Wizard to create the initial Paper Layout saves you a lot of time.
If you make many modifications to your Wizard reports, consider creating or modifying a
template to include object spacing horizontally and vertically, between frames, fields, and
so on. This helps you to select and manipulate the objects in the Paper Layout.
Note: You can override the default template properties for the Matrix and Matrix with
Group sections of an existing template.
Matrix Structure
The Data Model and Paper Layout of a matrix report contain special features, and
relationships between objects, to reflect the cross product structure of the report.
Matrix-Specific Objects and Properties
Matrix reports include special objects and properties:
Data Model: Cross product group; Product Order property
Paper Layout: Matrix object

Oracle Reports Developer 10g: Build Reports 18-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 18 Overview

Opening and changing an existing matrix report


Building a nested matrix report
Adding summaries to a nested matrix report
Displaying zeros for summary values and restricting
columns per page
Displaying more meaningful column information
and rotating the text

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 18


This practice session contains:
Opening and changing an existing matrix report
Building a nested matrix report
Adding summaries to the nested matrix report
Displaying zeros for summary values and restricting the number of columns per page
Displaying more meaningful column information and rotating the text
In this practice session, you use an existing matrix report to investigate the different
methods of displaying the cell values and the implications. You use an existing SQL
query to create a nested matrix report. You then add row- and column-level summaries to
the report and display zeros for null values.
If you have time, include the product names instead of the product IDs and rotate the
names.

Oracle Reports Developer 10g: Build Reports 18-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 18
1. Open report p4q6.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. How many repeating frames do you have?
b. Change the properties of the cell object to display zero for a null value.
c. Run the paper layout to test the report.
d. Close the report without saving it.
2. Create a new report, importing the query p4q6.sql from your working directory.
a. Select the following settings:

Report Style Matrix


Query Import Query p4q6.sql
Matrix Row Fields Level 1 - month
Level 2 - name
Matrix Column Fields product_id
Matrix Cell Fields Sum of total_value
Matrix Totals Sum of the cell field

b. Change the labels and widths for the following fields:

Field Label Width


name Customer 10
product_id Product 5
month Month 4
SumTotal_value Total 5
All Summaries Total: 5

Select a template and finish the Wizard.


c. Increase the width of the Main Section of the report to 17 inches.
d. Save the report as p18q2.jsp. Run the paper layout.
e. Which summaries were created?

Oracle Reports Developer 10g: Build Reports 18-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 18 (continued)
f. Use the Data Model view to create summaries for each month and for the level

Oracle University Internal and TransAmerica Training Management Inc Partner use only
month and product.
Property Value
Name SumMonth
Product Order G_MONTH
Function Sum
Source SumTOTAL_VALUE
Reset At G_MONTH

Property Value
Name SumMonthProduct
Product Order G_MONTH G_PRODUCT_ID
Function Sum
Source SumTOTAL_VALUE
Reset At G_PRODUCT_ID

g. Use the Paper Layout view to create the fields. You must expand the appropriate
repeating frame.
h. Run the paper layout to test the report.
i. Save the report as p18q2.jsp. Do not close it.
3. Continue with the report from the previous exercise.
a. Add zeros for null values in the cells.
b. Ensure that the report shows only three product columns on each page.
c. Format all numeric data to be right aligned.
d. Add commas and two decimal places where appropriate.
e. Run the paper layout to test the report.
f. Save the report as p18q3.jsp and close it.
If You Have Time
4. Open the report as p18q3.jsp.
a. Make the necessary changes in the Data Model view to include the product
name.
b. In the Paper Layout view, delete the product_id field and insert a boilerplate
object to display the product name. Rotate this object by 90 degrees.
Note: You may have to expand the R_G_PRODUCT_ID frame and the
outermost frame. Watch out for frequency errors.
c. Run the paper layout. Save the report as p18q4.jsp.

Oracle Reports Developer 10g: Build Reports 18-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Coding PL/SQL Triggers

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Describe the different types of triggers
Describe sample uses of triggers
Write and reference common code
Create a PL/SQL library
Publish a report as a result of a database event

Copyright 2004, Oracle. All rights reserved.

Overview
This lesson identifies different trigger types and creates conditional trigger code to control
report output. It also explains how to improve productivity and maintenance by sharing
and reusing commonly referenced code. Finally, you will learn about publishing reports
based on database events.

Oracle Reports Developer 10g: Build Reports 19-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Types of Triggers in Reports

Report:
Five triggers
Report Triggers node in Object Navigator
Data Model:
Formula (column)
Filter (group)
Parameter validation
Layout: Format trigger on most objects

Copyright 2004, Oracle. All rights reserved.

Types of Triggers in Reports


You can code PL/SQL in a variety of triggers in a report to provide conditional or
additional processing at run time. This lesson discusses examples of each type of PL/ SQL
trigger.
There are three trigger types in Oracle Reports: Report, Data Model, and Layout.
Report:
- A set of five report-level triggers. Each trigger fires at a different stage of the
report execution.
- Access report triggers from the Report Triggers node in the Object Navigator.

Oracle Reports Developer 10g: Build Reports 19-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Types of Triggers in Reports (continued)
Data Model:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
- Column formula fires each time the column is processed.
- Group filter fires for each record in the group.
- Parameter validation fires when the run-time parameter form is displayed and
when the user leaves the parameter field.
- Access Data Model triggers in the Property Inspector of a Data Model object
column, group, or parameteror the corresponding layout objectfield, repeating
frame, or parameter field.
Layout:
- Format triggers on most paper layout objects (excluding anchors). Each trigger
fires as the layout object is processed.
- Access format triggers in the Property Inspector of a paper layout object.
- For Web layouts, use the formatTrigger attribute in the rw:field tag.
Note: Reports Builder does not allow data manipulation language (DML)
commandsINSERT, DELETE, UPDATEin layout format triggers.

Oracle Reports Developer 10g: Build Reports 19-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Trigger Code

Boolean:
true
false

Character
Number
Date

Copyright 2004, Oracle. All rights reserved.

Trigger Code
When you create a trigger such as a report trigger or a PL/SQL formula, the Program Unit
editor supplies a template for the function block, giving the basic syntax that you require.
You can change the name of the function.
The value that you return must match the return data type in the function declaration.

Oracle Reports Developer 10g: Build Reports 19-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Report Triggers

Before
Parameter F
Form

1 2 If readonly=yes 3

F
If > 1 page
After Between After
Before page1 page2
Parameter Pages Report
Report
Form
F F

Copyright 2004, Oracle. All rights reserved.

1 If After Parameter Form returns FALSE, the cursor returns to the run-time
parameter form. If the run-time parameter form is not displayed, control returns
to the calling program.
2 If READONLY=Yes, Reports Builder implicitly sets the readonly transaction
(SET TRANSACTION READONLY) after the Before Report Trigger fires.
3 If READONLY=Yes, Reports Builder implicitly ends the
read-only transaction (COMMIT) after the final page and before the After
Report Trigger fires.

Using Report Triggers


Report triggers enable you to execute PL/SQL functions at specific times during the
execution and formatting of your report. Using these triggers, you can:
Customize the formatting of your report
Perform initialization tasks
Access the database
Report triggers must return a Boolean valuetrue or false.

Oracle Reports Developer 10g: Build Reports 19-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Report Triggers (continued)
You can access the report triggers from the Object Navigator. Open the Report Triggers

Oracle University Internal and TransAmerica Training Management Inc Partner use only
node and double-click the object icon of the required trigger to open the program unit.
Trigger Fires Use to
Before Parameter Before run-time parameter form Access and change parameter
Form is displayed; fires even if values (initial or command
parameter form is suppressed line), global variables; create
temporary tables; insert into
tables to be queried
After Parameter After run-time parameter form Access and change parameter
Form is displayed; fires even if values (initial, command line,
parameter form is suppressed or user-entered); create
temporary tables; insert into
tables to be queried
Before Report Before a report executes; after Carry out initialization
queries are parsed, but before procedures
records are fetched
Between Pages Before each page is formatted, Carry out customized page
except the first page; in formatting; insert or update
Previewer, fires only once for values in tables
each page, even if you revisit
the page
After Report After report output is sent to its Clean up initial processing,
destination; fires on success such as deleting temporary
only tables

Oracle Reports Developer 10g: Build Reports 19-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Report Triggers

After Parameter Form


Example: Build dynamic WHERE clause
FUNCTION AfterPForm RETURN BOOLEAN IS
BEGIN
IF :p_customer IS NULL THEN
:p_where_clause := ' ';
ELSE
:p_where_clause := 'where id >= :p_customer';
END IF;
RETURN(TRUE);
END;

Query syntax
SELECT CUSTOMER_ID, CUSTOMER_NAME
FROM CUSTOMERS
&p_where_clause
ORDER BY CUSTOMER_NAME

Copyright 2004, Oracle. All rights reserved.

Using Report Triggers: Creating a Dynamic WHERE Clause


Use the After Parameter Form report trigger to build a dynamic WHERE clause
depending on the value of a bind parameter that the user enters at run time.

Oracle Reports Developer 10g: Build Reports 19-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Report Triggers: Creating a Dynamic WHERE Clause (continued)
There are two possibilities at run time:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The bind parameter is NOT NULL.
The WHERE clause restricts the query; therefore the Oracle server makes use of an
existing index when retrieving data.
The bind parameter is NULL.
The WHERE clause is also NULL; therefore the Oracle server uses a full table scan to
retrieve all records.

Oracle Reports Developer 10g: Build Reports 19-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Data Model Triggers:
PL/SQL Group Filter

Restrict records in a group


Perform PL/SQL for each record
FUNCTION G_empGroupFilter RETURN BOOLEAN IS
BEGIN
IF :department_name = 'Operations' AND
:salary > 5000 THEN
RETURN(my_function);
ELSE
RETURN(TRUE);
END IF;
END;

PL/SQL filters result in all records being fetched

Copyright 2004, Oracle. All rights reserved.

Using Data Model Triggers: PL/SQL Group Filter


Use a group filter when you want to:
Restrict records in a specific group, depending on other processing in the report; that
is, when a WHERE clause in a query is not applicable
Perform some PL/SQL processing for each record in a group
A group filter is useful when you want to restrict group values of a lower group in the
group hierarchy.
The function must return a boolean value:
True: The record is included.
False: The record is excluded.
Reports Builder fetches all records and applies the group filter to each record. Therefore,
avoid group filters as a method of restricting many records in a group.
Note: You cannot add a filter to a matrix cross product group.

Oracle Reports Developer 10g: Build Reports 19-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Data Model Triggers: PL/SQL Group Filter (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Use a group filter that calls a function for some records in the G_emp group, depending
on the department in the master group.
1. Open the Property Inspector for the G_emp group.
2. Change Group Filter to PL/SQL.
The PL/SQL Filter property appears.
3. Select the PL/SQL Filter property to open the PL/SQL editor.
4. Enter the code. This filter code must return a boolean value of true or false.
Note: It is more efficient to use a WHERE clause in a query when possible. You cannot
use a WHERE clause in this case, because you want to process all records and call the
function for some.

Oracle Reports Developer 10g: Build Reports 19-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Data Model Triggers:
Parameter Validation

Example: Do not allow report output to be sent


directly to a printer.
FUNCTION DESTYPEValidTrigger RETURN BOOLEAN IS
BEGIN
IF :DESTYPE = 'Printer' THEN
RETURN(FALSE);
ELSE
RETURN(TRUE);
END IF;
END;

You cannot reassign values to parameters or


columns in this trigger.

Copyright 2004, Oracle. All rights reserved.

Using Data Model Triggers: Parameter Validation


Both system parameters and user parameters have a Validation Trigger property in which
you can write a PL/SQL function to validate the value of the parameter.
The trigger code must return a boolean valuetrue or falsedepending on whether the
validation is successful or not.
If the returned value is false, the cursor remains in the parameter and the user has the
following two options:
Enter a different value
Cancel the report
You can test the value of a parameter, but you cannot change the value. If you want to
assign a new value to the parameter, use the After Parameter Form report trigger.

Oracle Reports Developer 10g: Build Reports 19-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Data Model Triggers: Parameter Validation (continued)
Example: To prevent report output from being sent directly to a printer, test the value of

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the DESTYPE system parameter.
1. Open the Property Inspector for the DESTYPE parameter.
2. Select Validation Trigger to open the PL/SQL editor.
3. Enter the code and make sure that the value Printer has an initial capital.

Oracle Reports Developer 10g: Build Reports 19-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Layout Triggers

Format triggers:
Exist on most layout objects
Can suppress an entire layout section (master
group frame): No records fetched
Can suppress the display of individual records
(repeating frame): All records fetched

Copyright 2004, Oracle. All rights reserved.

Using Layout Triggers


Most paper layout objects can contain a format trigger; it is one of the common properties
of a paper layout object.
Format triggers enable you to modify the display of objects dynamically at run time or to
suppress display altogether.
The trigger must return a boolean valuetrue or false.
The following pages discuss some examples of format triggers.
Suppressing the Entire Paper Layout for a Query
Because Reports is driven by the layout, you can use a format trigger on a group frame to
conditionally suppress the entire layout associated with a query. In this case, the query
does not retrieve any data.

Oracle Reports Developer 10g: Build Reports 19-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Layout Triggers (continued)
Suppressing Individual Records

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Do not use format triggers to suppress individual records that you can restrict on the Data
Model. For example, a format trigger on a repeating frame does not prevent data from
being retrieved, it simply determines whether or not you see it in the output.
Therefore, it is more efficient to restrict individual records using the Maximum Records
property in a query or a First type of group filter when possible.
Note: Summaries compute against all data fetched by the Data Model. If you suppress
records in the layout only, summaries give misleading results.

Oracle Reports Developer 10g: Build Reports 19-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using a Format Trigger on a Frame

Displaying a Text String in Place of Column Headings


Dept: 10
Dept: f_deptno
Name Salary
Name Salary
No employees in
1 this department
Dept: 40
No employees in
this department

Copyright 2004, Oracle. All rights reserved.

1 Boilerplate text: Position behind column heading frame, or


position below and create collapsible anchor to column
heading
2 Column heading frame does not display; suppressed by
format trigger

Using a Format Trigger on a Frame


Requirement: Display a Text String in Place of Column Headings
Display a master-detail report for departments and employees. If a department has no
employees, suppress the detail column heading frame and display a piece of text instead.

Oracle Reports Developer 10g: Build Reports 19-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Coding a Format Trigger on a Frame (continued)
Example:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Create a summary column, :count_emp, in the master group that counts the number
of employee records (reset = master group).
2. Create a piece of boilerplate text, No employees in this department.
3. Position the text behind the column heading frame.
4. Code a format trigger on the column heading:
function hide_headings return boolean is
begin
if :count_emp = 0 then
return(false);
else
return(true);
end if;
end;
5. Either code the reverse logic in the format trigger of the boilerplate text item created
in step 2 or ensure that the column heading frame has a solid fill.
Note: You should code format triggers at the highest possible level of the paper layout
hierarchy. The format trigger on the column headings frame suppresses all objects
enclosed by the frame. Do not duplicate code unnecessarily by coding the same trigger on
all individual objects in the frame; this can cause increased processing and maintenance
overheads.

Oracle Reports Developer 10g: Build Reports 19-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using a Format Trigger on a

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Repeating Frame
Dynamically Altering the Display of Records
Employee Details
Employee Details
King 17-JUN-87 24000
f_name f_date f_salary Kochhar 21-SEP-89 17000
De Haan 13-JAN-93
Employee17000
Details
f_name f_date
King 17-JUN-87
Kochhar 21-SEP-89
2 De Haan 13-JAN-93

1 3

Copyright 2004, Oracle. All rights reserved.

1 One repeating frame is positioned behind the other or


positioned below with collapsing anchor
2 Report output run by payment clerks
3 Report output run by other employees

Using a Format Trigger on a Repeating Frame


Requirement: Alter the Display of Records Dynamically: In a report of employee
details, display salaries if the user is a payment clerk, but hide salaries and alter the
appearance of remaining fields when any other employee runs the report.

Oracle Reports Developer 10g: Build Reports 19-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using a Format Trigger on a Repeating Frame (continued)
Example:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. In the layout, create two repeating frames sourced by the same group. One repeating
frame must contain a salary field, the other must not.
Note: You can create two separate default layouts and modify the layout as
required.
2. Place one repeating frame behind the other.
3. Add a format trigger to suppress the top repeating frame (the one that contains the
salary field), or alternatively use conditional formatting:
function pay_clerks_see_this return boolean is
begin
if :user_type = 'PAY_CLERK' then
return(true);
else
return(false);
end if;
end;
Note: User_type can be a column or parameter that is initialized at run time.
4. Either code the reverse logic on the other repeating frame or ensure that the top
repeating frame (containing salary) has a solid fill.

Oracle Reports Developer 10g: Build Reports 19-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using a Format Trigger on a Field

Dynamically Hiding Fields


Employee Details
Employee Details
King 17-JUN-87 24000 1
f_name f_date f_salary
Kochhar 21-SEP-89 17000
De Haan 13-JAN-93
Employee17000
Details

King 17-JUN-87
Kochhar 21-SEP-89
De Haan 13-JAN-93

Copyright 2004, Oracle. All rights reserved.

1 Report for payment clerks shows all fields


2 Report for other employees shows gap where salary is hidden

Using a Format Trigger on a Field


Requirement: Dynamically Hide Fields: Given the same employee details report as
before, hide the salary field without rearranging the other fields in the repeating frame.
The report contains a gap in the layout when the salary field is not displayed.
Example: Place the format trigger on the salary field to display it only when payment
clerks run the report. The code is the same as before:
function pay_clerks_see_this return boolean is
begin
if :user_type = 'PAY_CLERK' then
return(true);
else
return(false);
end if;
end;
In this example, you do not need to create any additional layout object or code.
Oracle Reports Developer 10g: Build Reports 19-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using a Format Trigger in a Web Layout

<tbody> <rw:foreach id="R_G_DEPARTMENT_ID_1"


src="G_DEPARTMENT_ID">
<tr>

<td
<rw:headers id="HFSALARY" src="HBSALARY"/>
class="OraCellNumber">
<rw:field id="F_SALARY" src="SALARY"
nullValue="&nbsp;"
formatMask="$999,999.00" formatTrigger="mystyles">
F_SALARY
</rw:field>
</td>

</tr>
</rw:foreach> </tbody>

Copyright 2004, Oracle. All rights reserved.

Using a Format Trigger on a Field in a Web Layout


In an earlier lesson, you learned that you can customize your Reports JSPs by editing the
Web source and including attributes for the Reports custom JSP tags.
Recall that the rw:field tag has an attribute called formatTrigger. You set the
formatTrigger attribute to the name of a format trigger function. If the format trigger
returns a Boolean value of true, the field is displayed according to the attributes specified
in the trigger. The formatTrigger attribute is used to modify the display characteristics of
the field and can only use specific SRW packaged functions to set the fields attributes.
You will learn about the SRW package in the next lesson.

Oracle Reports Developer 10g: Build Reports 19-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using a Format Trigger on a
Boilerplate Object
Insert Spacing Between Groups of Records

f_1 f_2 f_3

4 2
3
FUNCTION spacing RETURN BOOLEAN IS
BEGIN
IF MOD(:count_column, 3) = 0 THEN
RETURN(TRUE);
ELSE
RETURN(FALSE);
END IF;
END;

Copyright 2004, Oracle. All rights reserved.

1 Transparent rectangle
2 Repeating frame, Vertical Elasticity = Variable
3 Summary column name (created in Data Model)
4 Format trigger on transparent rectangle

Using a Format Trigger on a Boilerplate Object


Requirement: Insert Spacing Between Groups of Records: Display additional spacing
between a defined number of records; for example, group every three records together.

Oracle Reports Developer 10g: Build Reports 19-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using a Format Trigger on a Boilerplate Object (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Create a transparent rectangle inside the repeating frame to increase spacing
conditionally at run time.
2. In the repeating frame Property Inspector, set Vertical Elasticity to Variable.
3. In the Data Model, create a summary column named COUNT_COLUMN that
counts the number of records retrieved (Reset=Report).
4. On the rectangle, create a format trigger that references the summary column, as
shown on the previous page.
Note: You can vary the number of records in each group dynamically at run time by
creating a parameter.

Oracle Reports Developer 10g: Build Reports 19-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Writing Common Code

At the Report level:


Object Navigator, Program Units
Menu: Program > PL/SQL Editor
In a library:
Object Navigator, PL/SQL Library
File > New: Create new library
File > Open: Add to existing library
Attach library to report

Copyright 2004, Oracle. All rights reserved.

Writing Common Code


If you use the same program unit in several places in a report, or in multiple reports,
consider writing the code once as a report-level program unit, or in a PL/SQL library, and
then call the program unit when you require it in your PL/SQL trigger code; this enables
you to maintain the code in one place.
If you have to write code that is not simple, then define the code at the report level. When
you have pieces of logic that are complex and/or potentially reusable, create a procedure,
or split the logic into several procedures, and then call the procedure(s) from your main
code. This is a common development practice. It makes the main logic more readable and
easier to understand and enables you to break up a complex problem into smaller, more
manageable pieces.
Remember that you can also code stored procedures and functions in the database; you
must decide whether database-side or middle-tier processing is more efficient in each
case.
Two Ways to Create Report-Level Program Units
In the Object Navigator, select the Program Units node and create a new program unit.
From the menu, select Program > PL/SQL Editor. Click New to create a new program
unit.

Oracle Reports Developer 10g: Build Reports 19-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Writing Common Code (continued)
Writing Code as Report-Level Program Units

Oracle University Internal and TransAmerica Training Management Inc Partner use only
You can create a report-level program unit that contains a function, procedure, or
package, and that you call from any object in the same report. You cannot reference a
report-level program unit from a different report.
Three Ways to Create Library Program Units
In the Object Navigator, select the PL/SQL Libraries node and create a new library.
From the menu, select File > New > PL/SQL Library.
From the menu, select File > Open to open an existing library and create additional
program units.
Referencing Code from a PL/SQL Library
You can reference library code in a report trigger by attaching one or more libraries to one
or more report definitions, which enables you to reference the same code in multiple
reports.
To attach a library to a report, open the report definition, select the Attached Libraries
node in the Object Navigator, and add each library that you need in the report.

Oracle Reports Developer 10g: Build Reports 19-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Event-Based Reporting

Implemented through PL/SQL stored procedures


Uses include:
Running a report
Displaying report status
Canceling a report
Managing parameter lists

Copyright 2004, Oracle. All rights reserved.

Event-Based Reporting
Today, it is often desirable to blend automation into business processes through the
invocation of behind-the-scenes procedures and functions. These behind-the-scenes tasks
can include the spontaneous production of output such as an invoice that prints
automatically when an order is processed, a Web site that is automatically updated with
fresh data, or an automatic e-mail alerting an employees manager that the employee has
submitted an expense report for approval. Consider this last scenario. When an employee
submits an expense report, new data is inserted into the database. When this database
event occurs, you want to alert the employees manager through an e-mail or a
notification in his portal page that a submittal is awaiting his approval. With the Oracle
Reports event-driven publishing API, this is possible.

Oracle Reports Developer 10g: Build Reports 19-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Event-Driven Publishing API

Oracle Advanced
PL/SQL Workflow Queuing

Output Data Data


model interface

Client Reports Services

Reports E-mail
Cache Printer
File

Copyright 2004, Oracle. All rights reserved.

Event-Driven Publishing API


The event-driven publishing API is a PL/SQL package that provides the basic functions
required for the development of procedures that respond to events in the database. The
procedures are called from a database trigger to run a report when an event occurs. The
trigger invokes the Reports server and the job is submitted to the server.
In addition to database events, the API can be integrated with Advanced Queuing (AQ)
and Oracle Workflow.

Oracle Reports Developer 10g: Build Reports 19-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Event-Driven Publishing API (continued)
The API consists of several key elements:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The SRW Package contains all relevant procedures and functions for submitting,
checking the status, and canceling jobs, as well as manipulating parameter lists.
The ParamList Type defines a parameter list. A parameter list is the main vehicle for
passing values when submitting a job and is required for each job submittal.
The ParamList Object is required for such features as Advanced Queuing, where a
parameter list must be stored in the database so that it can be passed along with a
message.
Technical Note
Advanced Queuing is the message queuing functionality of the Oracle database. Oracle
Workflow is a tool that manages complex user-based business processes. For more
information refer to the Oracle Technology Network, http://otn.oracle.com.
See OracleAS Reports Services Publishing Reports to the Web manual for more
information on the Event-Driven Publishing.

Oracle Reports Developer 10g: Build Reports 19-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Invoking a Report from a Database Event

Create a database trigger


Include a parameter list with the required entries:
GATEWAY
SERVER
REPORT
USERID

Copyright 2004, Oracle. All rights reserved.

Invoking a Report from a Database Event


Database triggers are the primary mechanism for invoking reports using the event-driven
publishing API.The Oracle database allows you to define various scopes of triggers that
fire in response to various events. One way to use event-based reporting is to create
automated processes that respond to certain types of changes to data in a table.

Oracle Reports Developer 10g: Build Reports 19-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Invoking a Report from a Database Event (continued)
Example: Send a report when an employee has submitted an expense report. The code for

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the trigger is below.
CREATE TRIGGER EXP_REP_TRG AFTER INSERT OR UPDATE on
EXP_REP FOR EACH ROW
myPlist SRW_PARAMLIST;
myIdent SRW.Job_Ident;
BEGIN
IF (:new.ExpStat = 'DONE') THEN
myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));
srw.add_parameter(myPlist,'GATEWAY','http://');
srw.add_parameter(myPlist,'SERVER','repSVR');
srw.add_parameter(myPlist,'REPORT','alert.RDF');
srw.add_parameter(myPlist,'USERID','scott/tiger');
srw.add_parameter(myPlist,'ExpenseID',:new.ExpID);
myIdent := srw.run_report(myPlist);
END IF;
END;
This trigger will fire after each insert or update on the EXP_REP table. When the status of
an expense report changes to DONE, the parameter list is constructed and a report is
invoked. The parameter list, myPlist, contains the necessary parameters for submitting the
job:
GATEWAY provides the URL to the Reports Servlet that will be used to process the
request.
SERVER identifies the name of the Reports Server to be used in conjunction with the
servlet.
REPORT identifies the report file to be run.
USERID identifies the user ID and password of the person running the report.
The API method RUN_REPORT takes the parameter list containing all vital information
as input, creates and submits the request, and returns the job identification record. The
information in the record can be used to check the status of the job.

Oracle Reports Developer 10g: Build Reports 19-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Select the appropriate trigger type for your
requirement: Report, Data Model, or Layout
Identify the trigger and code needed for:
Building a dynamic WHERE clause
Validating a parameter value
Dynamically altering record display
Suppressing null fields
Use Report-level program units and create PL/SQL
libraries for common code
Invoke a report from a database event

Copyright 2004, Oracle. All rights reserved.

Summary
Using PL/SQL Triggers
Select the most applicable type of trigger for your requirement.
Report-level triggers fire once for each of the five events during the report execution.
Data Model triggers can affect which records are processed and how they are processed.
Layout triggers affect the way in which objects are formatted.

Oracle Reports Developer 10g: Build Reports 19-31

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Summary (continued)
Objects That Must Return a Value

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The following table is a reminder of the Reports Builder triggers that must always return a
value, and the values that are acceptable.
Trigger Type Valid Values Result if False
Report trigger True, False Abort execution
Group filter True, False Do not process record
Validation trigger True, False Return to parameter
form
Format trigger True, False Do not format object
PL/SQL Formula (col- Computation: Character, N/A
umn) Number, Date
Writing Common Code
Use report-level program units or PL/SQL libraries for common code requirements to
improve productivity and maintenance.
Event-Driven Publishing
Use the PL/SQL procedures and functions in the event-driven publishing API to
automatically submit jobs to OracleAS Reports Services when an event occurs in the
database.

Oracle Reports Developer 10g: Build Reports 19-32

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 19 Overview

Creating a format trigger to display different paper


layouts conditionally
Creating and using a report-level PL/SQL function
Creating an using an external PL/SQL library
Creating a PL/SQL group filter

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 19


This practice session contains:
Creating a format trigger to conditionally display different layouts
Creating and use a report-level PL/SQL function
Creating and use an external PL/SQL library
Creating a PL/SQL group filter
In this practice session, you create a format trigger to conditionally flag one of two paper
layouts for the same data. You also conditionally flag some records in a report by creating
and referencing a report-level (local) PL/SQL function. You then move the code into a
new PL/SQL library and alter the reference to use the library function instead.
If you have time, restrict the number of records processed in a report by creating your own
group filter.

Oracle Reports Developer 10g: Build Reports 19-33

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 19
1. Create a new report, using p19q1.sql.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Display the records in two different layouts, showing different columns in each.
b. Create a Group Above layout using the following columns from the query:
Group Column
G_CUSTOMER_ID customer_id
G_ORDER_ID order_id
order_date
order_mode
order_total
c. Create a Tabular layout using the following columns from the query
Column
order_id
order_date
order_total

d. Create a user parameter, user_type, that has two possible values: Sales
Representative and Sales Clerk.
e. Ensure that only the Group Above layout is displayed when the user type is Sales
Representative, and that only the Tabular layout is displayed when the user type
is Sales Clerk.
Hint: As an alternative to coding format triggers, you can also use conditional
formatting.
To test the result, display the USER_TYPE parameter in the margin of the report.
Make sure that you can enter a parameter value at run time.
f. Save the report as p19q1.rdf.

Oracle Reports Developer 10g: Build Reports 19-34

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 19 (continued)
2. Continue with the previous report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the report so that the Tabular (Sales Clerk) layout displays an extra
column that indicates, with an asterisk, those orders that have an order status of 5.
b. Remember to change user type to Sales Clerk during testing.
c. Move the function code into a new PL/SQL library named p19lib.pll
d. Run the report.
e. Save the report to p19q2.rdf.
3. Continue with the previous report.
a. Modify the same layout to display additional spacing between every two records.
b. Save the report as p19q3.rdf and close it.
4. Open report p19q1.rdf.
a. Write your own group filter to restrict the number of customers displayed,
depending on the value of a parameter that you enter at runtime.
Hint: You need to create two parameters, to keep track of how many records
have been processed, compared to the cutoff number of records required. Make
sure that you can enter the cutoff parameter at run time.
b. Test the report several times by changing the cutoff parameter at run time.
c. Save the report as p19q4.rdf.

Oracle Reports Developer 10g: Build Reports 19-35

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Extending Functionality Using
the SRW Package

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Describe the package contents
Output messages at run time
Execute a drill-down report
Create a simple table of contents
Create and populate temporary tables
Modify visual attributes dynamically

Copyright 2004, Oracle. All rights reserved.

Overview
This lesson provides examples of the contents and use of the Reports Builder built-in
package. The package contains program units that you can reference in your PL/SQL
code.

Oracle Reports Developer 10g: Build Reports 20-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Contents of the SRW Package

SRW.SET_BOOKMARK SRW.DO_SQL
SRW.SET_FONT_STYLE SRW.RUN_REPORT

SRW.SET_MAXROW SRW.TRACE_START
SRW.MESSAGE SRW.PROGRAM_ABORT

Copyright 2004, Oracle. All rights reserved.

Contents of the Reports Builder Built-in Package


The Reports Builder built-in package, known as the SRW package, contains procedures,
functions, and exceptions that can help you to do the following:
Control report execution
Output messages at run time
Initialize layout fields
Create a table of contents
Perform DDL statements (create or drop temporary tables)
Dynamically set format attributes, such as font style and fill patterns
Referencing the Contents of the Package
You can reference any part of the SRW package in a PL/SQL statement in any program
unit of a report, such as a paper layout format trigger or a report-level trigger.

Oracle Reports Developer 10g: Build Reports 20-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Contents of the Reports Builder Built-in Package (continued)
Rules

Oracle University Internal and TransAmerica Training Management Inc Partner use only
You can only call the contents of the SRW package from within Reports Builder.
Other tools, such as Forms Builder, do not recognize this package.
You must always reference an SRW procedure, function, or exception by preceding it
with the package name, SRW; for example, SRW.MESSAGE or SRW.DO_SQL.

Oracle Reports Developer 10g: Build Reports 20-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Outputting Messages

Warning:
WHEN <exception> THEN
SRW.MESSAGE (999, Warning: report continues);

Error:
WHEN <exception> THEN
SRW.MESSAGE (999, Warning: report terminated);
RAISE SRW.PROGRAM_ABORT;

Exceptions:
SRW.INTEGER_ERROR
SRW.NULL_ARGUMENTS

Copyright 2004, Oracle. All rights reserved.

Outputting Messages
The SRW.MESSAGE packaged procedure displays a message with a code and text string,
which you specify. The message is displayed in the following format:
MSG-code: text
The message is displayed in a small dialog box. The user must acknowledge the message
before continuing.
Message Code and Text
You can enter a code number from zero up to ten digits. If you enter a number of fewer
than five digits, the code is displayed with leading zeros.
You can enter a text string to a maximum of 190 characters, excluding the code number.
You can embed extra spaces to display your message neatly in the message dialog box.
Reports does not suppress extra spaces in the message text.

Oracle Reports Developer 10g: Build Reports 20-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Outputting Messages (continued)
Is It a Warning or an Error?

Oracle University Internal and TransAmerica Training Management Inc Partner use only
SRW.MESSAGE does not implicitly terminate the report execution. You can choose to
issue a warning message that enables the report to continue execution after the user
accepts the message.
To force the report to terminate after outputting the message, raise the exception
SRW.PROGRAM_ABORT.
Note: You cannot suppress or replace the default message that Reports Builder gives if
you abort a report. Your own error message augments the existing messages.
Causes of Exceptions

Exception Name Cause


SRW.INTEGER_ERROR You entered a code that is not a numeric integer.
SRW.NULL_ARGUMENTS You omitted the code number or text message or
both.

Oracle Reports Developer 10g: Build Reports 20-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Executing a Nested Report
1 KING.LIS 2
xxx xxxxxxx
KING xxx xxxxxxx

KOCHHAR
KOCHHAR.LIS
DE HAAN
yyy yyyyyyy
yyy yyyyyyy

DE HAAN.LIS

zzz zzzzzzz
zzz zzzzzzz
SRW.RUN_REPORT

Copyright 2004, Oracle. All rights reserved.

1 Output from master output


2 Output from detailed report
Executing a Nested Report
SRW.RUN_REPORT invokes RWRUN with the string that you specify. Use
SRW.RUN_REPORT to execute a second report from within a report process. For
example:
Output parts of a report to different destinations
Divide a large report into several smaller reports that can be run conditionally
Both reports use the same process. SRW.RUN_REPORT starts only one run-time process;
it does not start a new process for each report execution.

Oracle Reports Developer 10g: Build Reports 20-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Executing a Nested Report (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Run a report called MANAGERS that retrieves the employee record for each manager.
Call the EMPS report (for example, from a group filter). EMPS retrieves the employee
records of all employees managed by the current manager only.
Sample code to implement this example appears on the following page.

Oracle Reports Developer 10g: Build Reports 20-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Executing a Nested Report

Example:
SRW.RUN_REPORT
('Report=EMPS
DESTYPE=FILE
DESNAME='||:LAST_NAME||'.LIS
BATCH=YES
MGRNO='||TO_CHAR(:MANAGER_ID));

Exceptions:
SRW.RUN_REPORT_FAILURE
SRW.RUN_REPORT_BATCHNO
Function: SRW.GETERR_RUN

Copyright 2004, Oracle. All rights reserved.

Executing a Nested Report (continued)


Example Function Code
FUNCTION MGR_REP RETURN BOOLEAN IS
BEGIN
SRW.RUN_REPORT
('REPORT=EMPS
DESTYPE=FILE
DESNAME='||:LAST_NAME||'.LIS
BATCH=YES
MGRNO='||TO_CHAR(:MANAGER_ID));
RETURN(TRUE);
EXCEPTION
WHEN SRW.RUN_REPORT_FAILURE THEN
SRW.MESSAGE(100, 'Error executing EMPS report');
RAISE SRW.PROGRAM_ABORT;
END;
Note: Use LAST_NAME to create the output filename for each manager; use
MANAGER_ID to restrict the EMPS query.

Oracle Reports Developer 10g: Build Reports 20-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Executing a Nested Report (continued)
Reports Builder raises a specific exception that applies to the SRW.RUN_REPORT

Oracle University Internal and TransAmerica Training Management Inc Partner use only
procedure in two cases:
Exception Name Causes
SRW.RUN_REPORT_FAILURE Detail report does not exist.
Detail report failed during execution.
SRW.RUN_REPORT_BATCHNO BATCH parameter is used inconsistently:
master report running with
BATCH=YES,
called a detail report with BATCH=NO

Displaying Report Failure Message


If the detail report fails during execution, you can display information about the cause by
using the SRW.GETERR_RUN function.
Assign the function to a local PL/SQL character variable, which you display using the
SRW.MESSAGE procedure.
...
msg char(150);
...
EXCEPTION
WHEN SRW.RUN_REPORT_FAILURE THEN
msg := SRW.GETERR_RUN;
SRW.MESSAGE (100, msg);
...

Oracle Reports Developer 10g: Build Reports 20-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Restricting Data

Before Report trigger


SRW.SET_MAXROW('Q_EMP',3);

Q_EMP
EMPLOYEE_ID LAST_NAME

100 KING
G_EMP 101 KOCHHAR
102 DE HAAN
EMPLOYEE_ID
LAST_NAME

Copyright 2004, Oracle. All rights reserved.

Restricting Data
Use SRW.SET_MAXROW to restrict the maximum number of records you want to
retrieve for a specified query. Reports Builder uses only the retrieved rows of the query in
subsequent processing, such as computations and summaries.
Suppressing a Query
At run time, you can choose not to display any data from a query by setting the maximum
number of records to zero. This prevents Reports Builder from retrieving any records from
the database.

Oracle Reports Developer 10g: Build Reports 20-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Restricting Data (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Below is a function to display data for the Q_emp query only if a value of one or more is
entered in a run-time parameter called HOW_MANY:
FUNCTION FETCHIT RETURN BOOLEAN IS
BEGIN
IF :HOW_MANY >= 1 THEN
SRW.SET_MAXROW ('Q_emp', :how_many);
ELSE
SRW.SET_MAXROW('Q_emp', 0);
END IF;
RETURN(TRUE);
EXCEPTION
WHEN SRW.MAXROW_UNSET THEN
SRW.MESSAGE (100,
'Data was fetched before SRW.MAXROW was
called');
RAISE SRW.PROGRAM_ABORT;
WHEN SRW.MAXROW_INERR THEN
SRW.MESSAGE(200, 'Contact someone clever!');
RAISE SRW.PROGRAM_ABORT;
END;
You must set SRW.SET_MAXROW in the Before Report trigger; that is, after the query
has been parsed but before it has been executed. If you call it after the Before Report
trigger, Reports Builder raises the SRW.MAXROW_UNSET exception.
If you handle SRW.MAXROW_INERR, always raise SRW.PROGRAM_ABORT,
because your report has an internal problem and you cannot guarantee the outcome.

Oracle Reports Developer 10g: Build Reports 20-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Initializing Fields

Output: logical page


no. = 2
Paper Layout

Page: F_NEWPAGE Page: 5

FUNCTION F_LOGICAL_PAGEFormatTrigger
RETURN BOOLEAN IS
my_page number;
BEGIN
SRW.GET_PAGE_NUM(my_page); 2
SRW.SET_FIELD_NUM(0,my_page+3);
RETURN(TRUE);
END;

Copyright 2004, Oracle. All rights reserved.

1 Create format trigger on F_NEWPAGE field


2 Set field value to my_page+3

Initializing Fields
You can dynamically initialize the value in a layout field by using the relevant
SET_FIELD packaged procedure; for example:
SRW.SET_FIELD_CHAR (0, 'a text string')
SRW.SET_FIELD_NUM (0, 1234)
SRW.SET_FIELD_DATE (0, '01-JAN-2002')

The first argument is always 0 (zero); you can set the value of the current object.
These procedures are relevant only in the format trigger of a field of the correct type. If
you use a procedure that conflicts with the field type, it has no effect in the report; Reports
Builder ignores the code and does not raise an error.

Oracle Reports Developer 10g: Build Reports 20-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Initializing Fields (continued)
You can use SRW.SET_FIELD to retrieve the current logical page number and

Oracle University Internal and TransAmerica Training Management Inc Partner use only
recalculate the value before displaying it.
Example: Create a function to display the logical page number plus three in a field called
F_NEWPAGE.
Because the logical page number variable is available only in the report layout, not in the
Data Model, you cannot calculate the value in a data column. Therefore, you use a paper
layout field to get the current page number and output a new number by initializing the
same field.
Make use of a packaged procedure called SRW.GET_PAGE_NUM to retrieve the current
logical page number into a local PL/SQL variable, as in the format trigger code on the
previous page.

Oracle Reports Developer 10g: Build Reports 20-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a Table of Contents

Use SRW.SET_FORMAT_ORDER in an After Parameter


Form trigger to format the Main section of the report
first
Use SRW.GET_PAGE_NUM in a format trigger to fetch
the page number for each topic in the TOC

Copyright 2004, Oracle. All rights reserved.

Creating a Table of Contents


Earlier in the course, you learned that you could use the Format Order of Sections
property to modify the order in which Reports Builder formats the sections of the report to
enable you to create a table of contents (TOC).
You can also use the SRW.SET_FORMAT_ORDER built-in procedure to format the
Main section of the report first and use report triggers to build a table containing the TOC
entries. When the first element for the TOC is formatted, a trigger fires and creates a row
in the TOC table containing the TOC entry and the page number. After the Main section
has completed formatting, the format order setting can define that the Header section is
formatted next. The Header section can contain a report block based on the TOC table.
After formatting, you can output your report with a TOC (the Header section), followed
by the report body (the Main section), followed by the Trailer section.

Oracle Reports Developer 10g: Build Reports 20-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Table of Contents (continued)
Example: You want to generate a report of all e-mail addresses of your customers. Your

Oracle University Internal and TransAmerica Training Management Inc Partner use only
customer database contains thousands of records. You want to group the customers by
country and then generate a table of contents so you can easily find the e-mail address for
the desired customer.
To create a simple table of contents:
1. Create a table in the database to hold the TOC information. You need two columns,
one for the topic and the other for the page number.
2. Use the Report Wizard to create a Group Above report. This report will display the
country name, then the customers and customer e-mail addresses under each country
name. The table of contents you create will then be based on the country name in
this report.
3. Create an After Parameter Form trigger to modify the default order of the report
execution, so that the Main section is formatted first.
FUNCTION AfterPForm RETURN BOOLEAN IS
BEGIN
SRW.SET_FORMAT_ORDER(SRW.MAIN_SECTION,
SRW.HEADER_ SECTION, SRW.TRAILER_ SECTION);
RETURN (TRUE);
END;
4. Create a format trigger on the field that displays the country name. The format
trigger will fetch the page number for each country name, so that the TOC will
enable the user to navigate to various parts of the report based on the name of the
country.
FUNCTION F_COUNTRY_NAMEFormatTrigger RETURN BOOLEAN IS
pageNum NUMBER;
BEGIN
-- get current page number
SRW.GET_PAGE_NUM(pageNum);
-- insert row into database table
INSERT INTO TOC_TABLE (TOPIC, PAGE_NUMBER)
VALUES (:country_name, pageNum);
RETURN (TRUE);
END;
5. Use the Data Model to create a second query with a formula column that calculates
the page range for the data under each country name. This query will fetch the
information from the database table you created in step 1.
6. Create a tabular report block in the Header section of your report to display the
headings in the table of contents (i.e., the country name), and the page range where
the information can be found in the report.

Oracle Reports Developer 10g: Build Reports 20-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Performing DDL Statements

Example:
SRW.DO_SQL('CREATE TABLE SRW_LOG
(RPT_NAME VARCHAR2(40),
REC_NUM NUMBER,
MSG_TEXT VARCHAR2(80))' );

SRW.DO_SQL('INSERT INTO SRW_LOG


(RPT_NAME, REC_NUM, MSG_TEXT)
VALUES
(''PAY_REPORT'', TO_CHAR(:EMPLOYEE_ID),
:LAST_NAME||''PAY REPORT RUN'') ');

Exception: SRW.DO_SQL_FAILURE

Copyright 2004, Oracle. All rights reserved.

Performing DDL Statements


The SRW.DO_SQL packaged procedure executes any specified SQL statement from
within Reports Builder.
Use SRW.DO_SQL to perform DDL statements dynamically during run time. For
example, create a temporary table and insert rows into it during execution.
You can also perform DML statements using this procedure, but DML statements run
faster if you code them directly within a PL/SQL block. Code DML statements in the
SRW.DO_SQL procedure only if necessary. For example:
To insert records into a permanent table in the database, code DML in a PL/SQL
block.
To insert records into a temporary table that does not exist until run time, code DML
in SRW.DO_SQL.

Oracle Reports Developer 10g: Build Reports 20-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Performing DDL Statements (continued)
Querying from Temporary Tables

Oracle University Internal and TransAmerica Training Management Inc Partner use only
If you want to create a temporary table and reference it in a query in the same report, the
table must exist before the Before Report trigger fires. That is when Reports Builder
parses its queries. Therefore, you must create this table in the Before Parameter Form or
After Parameter Form report trigger.

Oracle Reports Developer 10g: Build Reports 20-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Setting Format Attributes

Borderwidth
Tuesday, January 2004 Fill pattern
Format mask

Printer tray control

Define a bookmark
Car Policy

Copyright 2004, Oracle. All rights reserved.

Setting Format Attributes


The SRW.SET_<attributes> packaged procedures apply specified format attributes to the
current layout object: frame, repeating frame, field, or boilerplate object.
Some of the reasons that you would want to use format attributes are:
To change the visual appearance of layout objects conditionally, depending on values
in a repeating frame, or on run-time parameter values
To switch to different printer trays as your report formats
To place a logo or standard links in an HTML document
To define a bookmark in an HTML or PDF document
You can code the packaged procedure in a function as a local or report-level program unit,
or in a PL/SQL library. This is useful if you want a common format attribute in more than
one object or more than one report. You can then call the function whenever required
from the format trigger of a specific object.
As an alternative to a PL/SQL library, in the Object Navigator, you can drag and drop
report-level program units between different reports. However, note that this creates a
copy of the program unit in each report, rather than a reference to one piece of code.

Oracle Reports Developer 10g: Build Reports 20-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Setting Format Attributes

Visual attributes:
SRW.SET_FILL_PATTERN('solid');
SRW.SET_BORDER_WIDTH(250);
SRW.SET_FORMAT_MASK('Day, Month yyyy');

Printer tray control:


SRW.SET_PRINTER_TRAY('letterhead');

Defining a bookmark:
SRW.SET_BOOKMARK('Car Policy');

Copyright 2004, Oracle. All rights reserved.

Setting Format Attributes (continued)


Example
Conditionally set the following attributes if salary is greater than $12000:

Attribute Value
Background fill color Blue
Fill pattern Sandpaper
Font style Italic
Font face Helvetica
Font weight Extra bold
Text color White

Oracle Reports Developer 10g: Build Reports 20-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Setting Format Attributes (continued)
Example (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
FUNCTION SAL_MASK RETURN BOOLEAN IS
BEGIN
IF :SALARY > 12000 THEN
SRW.SET_BACKGROUND_FILL_COLOR(blue);
SRW.SET_FILL_PATTERN(sandpaper);
SRW.SET_FONT_STYLE(SRW.ITALIC_STYLE);
SRW.SET_FONT_FACE(helvetica);
SRW.SET_FONT_WEIGHT(SRW.EXTRABOLD_WEIGHT);
SRW.SET_TEXT_COLOR(white);
END IF;
RETURN(TRUE);
END;
Remember that you can use the Conditional Formatting dialog box to specify output
formatting attributes (font and/or color) for a selected layout object based on conditions
that exist. However, if you need to apply other attributes such as fill color, for example,
then you need to use the SRW.SET_<attribute> procedures.

Oracle Reports Developer 10g: Build Reports 20-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Format Attributes in a Web Layout


<rw:field id="F_SALARY" src="SALARY. . .
formatTrigger="mystyles">
F_SALARY
</rw:field>

FUNCTION mystyles RETURN BOOLEAN IS


BEGIN
SRW.SET_JUSTIFICATION(SRW.RIGHT_HJUST);
SRW.SET_TEXT_COLOR('Red');
SRW.SET_FONT_WEIGHT(SRW.BOLD_WEIGHT);
SRW.SET_FONT_STYLE(SRW.ITALIC_STYLE);
return (TRUE);
END;

Copyright 2004, Oracle. All rights reserved.

Using Format Attributes in a Web Layout


Recall that the formatTrigger attribute of the rw:field tag is used to modify the display
characteristics of the field. You can only use specific SRW packaged procedures to set the
fields attributes. These are:
SET_FORMAT_MASK SET_FONT_SIZE
SET_HYPERLINK SET_FONT_WEIGHT
SET_LINKAGE SET_DISPLAY_NAME
SET_TEXT_COLOR SET_FIELD_CHAR
SET_JUSTIFICATION SET_FIELD_DATE
SET_FONT_FACE SET_FIELD_NUM
SET_FONT_STYLE

Oracle Reports Developer 10g: Build Reports 20-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Using Format Attributes in a Web Layout (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
In the example on the previous page, the formatTrigger attribute contains the name of the
function mystyles. When executed, mystyles will set the following attributes on the
salary field:
Attribute Value
Justification Right
Text color Red
Font weight Bold
Font style Italic
Using Format Attributes in Character Mode Reports
Some attributes are applicable to character environments only; some are for bitmapped
environments only.
If you include a bitmapped attribute and then run the report in character mode, or the
reverse, Reports Builder ignores the code and does not cause an error. This enables you to
develop a report for use in a different environment.

Oracle Reports Developer 10g: Build Reports 20-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Describe the SRW package contents:
Procedures
Functions
Exceptions
Use SRW.PROGRAM_ABORT to stop report processing
Use the SRW package to:
Execute a detail report
Create a table of contents
Dynamically execute DDL statements
Provide conditional layout formatting and display

Copyright 2004, Oracle. All rights reserved.

Summary
The SRW package contains procedures, functions, and exceptions.
Remember that you can raise the exception SRW.PROGRAM_ABORT in your PL/SQL
code to stop report processing at any time.
The SRW package provides a number of features, including:
- Executing a second report from within a report process, using
SRW.RUN_REPORT
- Modifying the format order for a report and then getting the resulting page
numbers for the Main section so that you can create a table of contents in the
Header section
- Support for DDL statements, using SRW.DO_SQL, to enable you to create or drop
temporary tables from PL/SQL code in a report
- Conditional formatting and display using SRW.SET_<attributes>

Oracle Reports Developer 10g: Build Reports 20-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 20 Overview

Building a report containing conditional highlighting


Modifying a Web report with conditional
highlighting
Executing a detail report from a master report
Writing to a temporary table from a report

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 20


This practice session contains:
Building a report containing conditional highlighting
Modifying a Web report with conditional highlighting
Executing a detail report from a master report
Writing to a temporary table from a report
In this practice session, you highlight values based on conditional PL/SQL code.
You build a master report that enables you to call a detail report and generate a separate
PDF file for each detail report.
If you have time, you add report-level triggers to an existing report to write messages to a
temporary table at various stages of report execution.
Write PL/SQL functions as local PL/SQL (report-level), and reference the code in a
condition within the relevant object trigger in the report.

Oracle Reports Developer 10g: Build Reports 20-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 20
1. Open report p9q3.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Display the column CUST_TOTAL in the customer group as red, bold italics if
its value is 10,000 or more.
Hint: Check the Help system for the SRW.SET <attributes> or use conditional
formatting.
Mask Attribute Suggested Value
SRW.SET_TEXT_COLOR Red
SRW.SET_FONT_WEIGHT SRW.BOLD_WEIGHT
SRW.SET_FONT_STYLE SRW.ITALIC_STYLE

You can copy the code from the file p20q1a.txt.


b. Alter the pattern and color of those records where the customer total is 5,000 or
less.
Hint: Check the Help system for the SRW.SET <attributes> or use conditional
formatting.
Attribute Suggested Values
Fill pattern Crisscross, sandpaper
Foreground fill color Yellow
Background fill color Green
You can import the file p20q1b.txt.
c. Write the necessary format triggers.
d. Save the report as p20q1.jsp.
e. Run the paper layout.
2. Continue with the same report.
a. Run the Web layout for the report. Is there formatting on the CUST_TOTAL
column?
b. Modify the Web source so that the column CUST_TOTAL in the customer
group as displays as red, bold italics if its value is 10,000 or more.
c. Save the report as p20q2.jsp.
d. Run the Web layout to test.

Oracle Reports Developer 10g: Build Reports 20-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 20 (continued)
3. Execute a detail report from a master report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a simple tabular report called MGR_MASTER. The report should query
last names and employee IDs for those employees who are managers. Display all
fields. You can use the query:
SELECT distinct manager.last_name Manager,
manager.employee_id
FROM employees worker, employees manager
WHERE worker.manager_id = manager.employee_id
b. Save the report as mgr_master.rdf.
c. Create another tabular report, the detail report, and name it EMP_RPT. The
report should return department number, employee name, and salary for a
specific manager. The manager_id will be passed to EMP_RPT by
MGR_MASTER.
d. Save the report as emp_rpt.rdf and close it.
e. Write the code to execute the detail report. For each manager returned,
MGR_MASTER should invoke the detail report, EMP_RPT, pass it the
managers employee_id, and produce a report in PDF format containing
information about the employees working for that manager. Use the managers
employee_id to create an output filename for each manager:
MGR_<employee_id>.PDF.
Hint: You can write the code in the group filter.
f. Compile the PL/SQL code and close the window.
g. Run the paper layout for MGR_MASTER to test. Access the file system and
locate the output for the detail reports. View two or three of the output files.
h. Save mgr_master.rdf and close it.
If You Have Time
4. Open report p10q1.rdf
In this report, you use report triggers to create a temporary table at the start of report
execution, and you insert rows into the table at various stages of the execution.
a. Write a trigger that creates a temporary table to hold the date and userid each
time the report is run. The table should contain three columns: one date column,
one character column of width 10, and one character column of width 80.
CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10), COMMENTS
VARCHAR2(80))

Oracle Reports Developer 10g: Build Reports 20-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 20 (continued)
b. The same trigger should also insert the current date, userid, and Starting

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report into this table.
INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, 'Starting Report')
Hint: Think about how you code the single quotes.
c. Compile the PL/SQL code and close the window.
d. Save the report as p20q4.jsp.
e. Run the paper layout.
f. Using SQL*Plus, verify that your table exists and was populated successfully.
g. Log on to SQL*Plus (in Microsoft Windows, select the SQL*Plus icon in the
Oracle group) using the same userid as you used for Reports.
h. Display all records in the RUNREPORT table.
SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;
i. Try running the report more than once. When you run the report a second time,
the table already exists and Reports Builder raises an exception. Make the
necessary change to your code so that the report runs even when the table exists.
j. Write a trigger that inserts a record with the comment Printing another page
whenever it begins a new page.
k. Write a trigger that inserts a record with the comment Report completed when
the report finishes.
l. Save the report as s20q4l.jsp. Generate the output to a PDF file. Verify the
results in SQL*Plus.

Oracle Reports Developer 10g: Build Reports 20-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Maximizing Performance Using
OracleAS Reports Services

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to


do the following:
Describe the OracleAS Reports Services
architecture
Distinguish between the JSP and Servlet run-time
architectures
Describe the various ways to run a report
List the options for managing and monitoring
OracleAS Reports Services

Copyright 2004, Oracle. All rights reserved.

Overview
When you are ready to publish your reports, all the Web server and application server
tools you need are available in the Oracle Application Server.
In this lesson, you will learn about the architecture of relevant Oracle Application Server
components in combination with its reports publishing component, OracleAS Reports
Services. You learn how to make report requests, and about the options available for
managing and monitoring Reports Services.

Oracle Reports Developer 10g: Build Reports 21-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running Reports Using
OracleAS Reports Services

Provides the deployment platform


Formats, prints reports on a powerful server
Eliminates rerunning reports
Enhances scalability and performance

Copyright 2004, Oracle. All rights reserved.

Running Reports Using OracleAS Reports Services


OracleAS Reports Services is the reports publishing component of Oracle Application
Server. It is an enterprise reporting service for producing high quality production reports
that dynamically retrieve, format, and distribute any data, in any format, anywhere. You
can use OracleAS Reports Services to publish in both Web-based and non-Web-based
environments.

Oracle Reports Developer 10g: Build Reports 21-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Running Reports Using OracleAS Reports Services (continued)
Benefits of OracleAS Reports Services

Oracle University Internal and TransAmerica Training Management Inc Partner use only
OracleAS Reports Services provides a flexible architecture for the distribution and
automated management of report generation engines on the same server and across
multiple servers.
When used in conjunction with JSP, servlet, or CGI, OracleAS Reports Services
enables you to run reports on any platform from a Web browser using a standard URL
syntax. The JSP engine runs the Web layout. The Reports servlet runs the paper
layout. Reports CGI is maintained only for backward compatibility.
Reports are formatted on a high-performance NT or UNIX server.
Reports Services caches the output in a central repository on the server machine. With
OracleAS Reports Services, the Reports cache is persistent. This means that if the
server is shut down and then restarted, all jobs are recovered, not just scheduled jobs.
Reports Services detects duplicate reports. Users can share output without rerunning
the report.
You can implement multiple run-time engines for one Reports Services machine.
You can implement multiple Reports Services server instances on one machine.
OracleAS Reports Services provides peer-level clustering to allow sharing of the
Reports Server load among multiple machines for unlimited scalability.

Oracle Reports Developer 10g: Build Reports 21-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report Request Methods

RWCLIENT command line


URL syntax
OracleAS Portal
SRW.RUN_REPORT
Event-Driven Publishing API

Copyright 2004, Oracle. All rights reserved.

Report Request Methods


You can run a report using various request methods. Below is a brief overview of each
method.
The RWCLIENT command: This enables you to run a report from the command
line prompt in a non-Web environment. RWCLIENT is an executable that parses and
transfers the command line to the specified OracleAS Reports server. It can use
command line arguments similar to those used with the OracleAS Reports Runtime
executable file, RWRUN.
URL syntax: To run a report from a Web browser, use the URL syntax. The
OracleAS Reports Servlet (and CGI, for backward compatibility) converts the URL
syntax into an rwclient command line request that is then processed by OracleAS
Reports Services. 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.
OracleAS Portal: OracleAS Portal enables you to add a link to a report on a portal
page or portlet. Authorized users accessing the Oracle Portal site simply click the link
to run the report. You can also publish your report output directly in a portlet. Using
OracleAS Portal makes it more convenient and secure to publish a report on the Web.

Oracle Reports Developer 10g: Build Reports 21-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Report Request Methods (continued)
SRW.RUN_REPORT: This is a packaged PL/SQL procedure that submits a report to

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Reports Services. In the argument list, you specify the JSP or servlet information in
addition to the Reports parameters, and RUN_REPORT sends the request to Reports
Services. Set the SERVER argument to the OracleAS Reports Services server name to
cause the SRW.RUN_REPORT command to behave as though you executed the
RWCLIENT command.
Event-Driven Publishing API: The Event-Driven Publishing API is a PL/SQL
package that allows for the automatic submission of jobs to OracleAS Reports
Services from within the database. The API provides the basic functions required for
the development of procedures that respond to events in the database. With the event-
driven publishing, you can automatically run a report in response to a database event,
such as the insertion of a record or the change of a value. Event-driven jobs are
submitted using the HTTP protocol. The server assigns a unique job identifier to every
call, useful for tracking the status of the job. The Event-Driven Publishing API is a
PL/SQL API.

Oracle Reports Developer 10g: Build Reports 21-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Oracle Application Server Components

Web
Enterprise Application Development Framework Services

Security and Identity


Portal System Management

Management
Portal Business Integration
Intelligence Broker
Any Data
Source
Application server
Mobile and
Wireless
Grid Computing Infrastructure Packaged
Application

Oracle Application Server 10g


Business
Intelligence B2B

Copyright 2004, Oracle. All rights reserved.

OracleAS Reports Services Architecture


OracleAS Reports Services is architected to publish reports in both Web-based and non
Web-based environments. Reports Services can be configured in a number of ways
depending on your requirements. In this section, you will learn about the OracleAS
Reports Services runtime architecture and the various commands used to invoke a report
that is deployed on the Oracle Application Server.

Oracle Reports Developer 10g: Build Reports 21-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
OracleAS Reports Services Architecture (continued)
First, you should be familiar with the key components of Oracle Application Server:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The OracleAS HTTP Server is a Web server. It incorporates an OpenSSL module to
provide support for Secure Sockets Layer (SSL) and HTTP Secure Sockets Layer
(HTTPS). It also provides a servlet engine to support the running of Java Servlet
applications. It is the HTTP Listener.
The module mod_OC4J is used by the HTTP Listener to redirect requests for servlets
and JSPs to OracleAS Containers for Java 2 Enterprise Edition (OC4J). OC4J provides
a fast, lightweight, highly scalable, easy-to-use complete J2EE environment that
includes a JSP translator, a JSP servlet engine, and an Enterprise JavaBeans (EJB)
container.
The Reports Servlet runs inside the Web servers servlet engine. The Reports Servlet
translates and delivers information between HTTP and the Reports Server.
The Reports CGI translates and delivers information between either a Web server or
a J2EE Container (for example,OC4J) and the Reports Server. This component
enables you to run a report dynamically from your Web browser.
The Reports Server processes client requests. It spawns runtime engines, fetches
completed reports from the Reports cache, and notifies the client that the report is
ready.
The Reports Engine includes components for running SQL- and PDS-based reports.
It fetches requested data from the data source, formats the reports, sends the output to
cache, and notifies the Reports Server that the job is complete.
The Reports Server Cache stores completed jobs.
When used in a Web environment, the OracleAS Reports Services architecture consists of
four tiers:
The client tier (a Web browser)
The Web server tier
The OracleAS Reports Services tier
The data tier, including databases and pluggable data sources
When used in a non-Web environment, there are three tiers (a Web server being
unnecessary):
The client tier
The OracleAS Reports Services tier
The data tier

Oracle Reports Developer 10g: Build Reports 21-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Enabling Single Sign-On Access

Oracle Internet Directory

Log in only once


Access application level authentication
Access data level authentication

Copyright 2004, Oracle. All rights reserved.

Enabling Single Sign-On Access


When deploying reports, you need to ensure that your user has the necessary privileges to
run that particular report, at that particular time, on that particular server.
Likewise, now that pluggable data sources are part of the benefits offered to you through
Oracle Reports, you need to ensure that your user has the privileges to access the required
data sources. You may want to spare your user the trouble of having to log in to multiple
data sources in order to run one job.
You can address application level authentication and data level authentication through
single sign-on (SSO).

Oracle Reports Developer 10g: Build Reports 21-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Enabling Single Sign-On Access (continued)
SSO enables you to establish unique identities for each user which are tied to resources

Oracle University Internal and TransAmerica Training Management Inc Partner use only
unique to that user. The users resources contain key-identified connection strings for
accessing different data sources. The user is uniquely identified through a once-per-
session login, and the login references the users resources to ensure that he or she has
access to the appropriate data sources, without users having to enter this information
themselves.
SSO is made possible through the partnership of OracleAS Reports Services, Oracle
Internet Directory (OID), and the Oracle Login Server, all delivered through the Oracle
Application Server.
Technical Note
For more information on data source single sign-on, see the OracleAS Reports Services,
Publishing Reports to the Web manual.
For information about the requirements and procedures required for setting up SSO-
related components, such as the Oracle Internet Directory, see the Oracle Internet
Directory Administrator's Guide and the Oracle HTTP Server Administrator's Guide on
the Oracle Application Server documentation CD and on the Oracle Technology Network
(http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 21-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running the Web Layout:
JSP Run-time Architecture

HTTP

Oracle HTTP Listener


mod_OC4J
rept.jsp JSP Engine

CORBA/IIOP CORBA/IIOP
OID
Reports
OracleAS
Engine
Reports Services
PDS

Copyright 2004, Oracle. All rights reserved.

Running the Web Layout: JSP Run-time Architecture


You use the JSP run-time architecture to run the Web layout.
The JSP engine runs the Reports JSP because in a Reports JSP, you can include not only
Reports custom JSP tags, but tags from other libraries as well. Hence, the Reports JSP
cannot be run within Oracle Reports because it may contain tags that are not Reports
custom tags.
The JSP engine executes the JSP, and the Reports custom JSP tags invoke the Reports
server to ensure that the user is authenticated to run the report. Once authentication has
been established, the Reports server spawns a Reports engine and sends the request to that
engine. The Reports engine retrieves the data from the specified data source(s) and passes
it to the JSP engine. The JSP engine formats the data and returns it to the user. The
communication between the JSP engine, the OracleAS Reports server, and the Reports
engine is done through industry standards, Common Object Request Broker Architecture
(CORBA) and Internet Inter-ORB Protocol (IIOP).

Oracle Reports Developer 10g: Build Reports 21-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running the Paper Layout:
Servlet Run-time Architecture
HTTP

Oracle HTTP Listener


mod_OC4J
Fax
Reports Servlet int
Pr
OID CORBA/IIOP
ma
il
OracleAS Reports Services

CORBA/IIOP

rept.rdf Reports
Engine
rept.jsp
PDS

Copyright 2004, Oracle. All rights reserved.

Running the Paper Layout: Servlet Run-time Architecture


You use the Servlet run-time architecture to run the paper layout.
When a request is received for the Reports servlet, the servlet contacts the Reports server
to ensure the user is authenticated to run the report. Once authentication has been
established, the Reports server spawns a Reports engine and sends the request to that
engine to run the report. The Reports engine executes the RDF by:
Retrieving and formatting the data
Populating the Reports cache
Notifying the Reports server that the report is ready.
The Reports server accesses cache and send the report to the specified output destination.
If the report is a Reports JSP that contains a paper layout, the Reports engine interprets the
paper layout, coded in XML, and executes the report as stated above.

Oracle Reports Developer 10g: Build Reports 21-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running a Paper Report on the Web

URL syntax:
http://vesuvius.world.com:8888/reports/rwservlet?
report=emp_dept.rdf&desformat=html&destype=cache&
server=repsrv1&dept_param=10
Key map file: cgicmd.dat

Copyright 2004, Oracle. All rights reserved.

Running a Paper Report on the Web


OracleAS Reports Services supports requests both from Web and non-Web clients. This
section covers how to run a report in both environments.
Thanks to the Reports thin client Web interfaces (the Reports Servlet or JSP), running a
report on the Web is simply a matter of entering a URL, just as you would fetch almost
any document on the Web. The URL specifies all the required information to run the
report, such as: what report to run, what format to produce the output in, whether to
schedule the report, and so on. Consider the following example:
http://vesuvius.world.com:8888/reports/rwservlet?
report=emp_dept.rdf&desformat=html&destype=cache&
server=repsrv1&dept_param=10

Oracle Reports Developer 10g: Build Reports 21-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Running a Paper Report on the Web (continued)
In the example, the first line contains the Web server hostname (vesuvius), the domain name

Oracle University Internal and TransAmerica Training Management Inc Partner use only
(world), the port (8888), and the alias (reports), a virtual path that stands in for the absolute
path to the files the URL will access. RWSERVLET invokes the OracleAS Reports Services
servlet. The question mark (?) identifies the beginning of the command line arguments such
as the module name, destination format, destination type, Reports server name, and a value
for a runtime parameter.
The Key Map File
As you can see from the example on the previous page, the URL can become quite long. To
get around this problem, the key map file cgicmd.dat can be used. The key map file
contains command strings for running reports, each identified by a unique keyword. By
using key mapping, the command line arguments are all hidden from the user. By default,
the key map file is located in the <oracle_home>/reports/conf directory. For the
example above the mapfile entry may look like the following:
emp_rep1: report=emp_dept desformat=html destype=cache
server=repsrv1 dept_param=%1
Note that the delimiter is the map file entry is a space.
The URL now becomes much shorter:
http://vesuvius.world.com:8888/reports/rwservlet?emp_rep1&10
Technical Note
For information on testing reports deployment without installing Oracle Application Server,
refer to the Oracle Reports Technical Note How to Execute Reports Services from 9iDS on
the Oracle Technology Network (http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 21-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running a Report from the Command Line

SERVER = <server_name>
MODULE|REPORT = <runfile>
DESTYPE = FILE, PRINTER, MAIL, CACHE,
LOCALFILE, SYSOUT,ORACLEPORTAL
DESNAME = <desname>
DESFORMAT = PDF, HTML, HTMLCSS, RTF,
DELIMITED, XML

RWCLIENT SERVER=server1 MODULE=my_rep.rdf


DESTYPE=cache DESFORMAT=html

Copyright 2004, Oracle. All rights reserved.

Running a Report from the Command Line


Example
1. Invoke the command line. In Windows NT, Select Start > Run.
2. Enter the command string, for example:
RWCLIENT.EXE SERVER=server1 REPORT=my_rep.rdf
DESTYPE=FILE
DESFORMAT=PDF DESNAME=my_rep_output.pdf
This command references an executable file that parses and transfers the command line to
the specified OracleAS Reports server. The report is run immediately.
Returning Control to the Client
Include BACKGROUND=Yes in your RWCLIENT command line, the report runs
asynchronously, and then RWCLIENT returns immediately after submitting a job request
to Reports Services.
Technical Note
For a complete list of command line arguments, refer to Oracle Application Server
Reports Services, Publishing Reports to the Web documentation.

Oracle Reports Developer 10g: Build Reports 21-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The OUTPUTIMAGEFORMAT Parameter

Commands that can use OUTPUTIMAGEFORMAT:

rwclient rwrun rwbuilder rwservlet rwcgi

Syntax:
OUTPUTIMAGEFORMAT={PNG|JPEG|JPG|GIF|BMP}

Copyright 2004, Oracle. All rights reserved.

The OUTPUTIMAGEFORMAT Parameter


Earlier in the course, you learned the various image formats that you can specify for your
report output. The OUTPUTIMAGEFORMAT parameter enables you to explicitly choose
the format for images in your report output. You can specify this parameter for the
rwclient, rwrun, rwbuilder, rwservlet, and rwcgi commands.
The values that you can specify for the OUTPUTIMAGEFORMAT parameter are:
PNG, JPEG, JPG supported image formats when the destination format is PDF,
HTML, HTMLCSS, or RTF
GIF supported image format when destination format is PDF, HTML, or HTMLCSS
BMP supported image formats when destination format is RTF
The format of the source image is converted to the format you specify using the
OUTPUTIMAGEFORMAT parameter. For example, invoke the Reports Builder using the
following command:
RWBUILDER.EXE HR/HR@ORCL OUTPUTIMAGEFORMAT=PNG
When you generate the report output to any file type, the output images will be stored in
PNG format regardless of the source format. You must take care to ensure that the format
that you specify is compatible with the output file type.

Oracle Reports Developer 10g: Build Reports 21-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Schedule Parameter

SCHEDULE = [FREQ from] TIME [retry n after LEN]

RWCLIENT...
SCHEDULE=monthly_last_weekday_from_17:00_Nov_22,_2003_
retry_3_after_1_hour

FREQ CLOCK DATE

TIME

Copyright 2004, Oracle. All rights reserved.

The Schedule Parameter


SCHEDULE is a scheduling parameter that you can include in the RWCLIENT command
line to control the time and frequency with which your report runs.
The syntax of the SCHEDULE parameter comes primarily from the syntax of a cron job
on UNIX. To avoid quoting the schedule string, use underscores (_) instead of spaces.
In default mode, the program runs the report immediately.

Oracle Reports Developer 10g: Build Reports 21-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
The Schedule Parameter (continued)
Syntax

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The full syntax of the SCHEDULE parameter is:, [SCHEDULE=] string, where the string
is, [FREQ from] TIME [retry {n} + after LEN]
FREQ = hourly|daily|weekly|monthly|{every
LEN|DAYREPEAT}|{last {WEEKDAYS| weekday | weekend} before
{n}+}
TIME = CLOCK [DATE] [INCR]
CLOCK = <hh:mm>
DATE=<calendar date>
INCR = {+LEN} | {next SUFFIX}
LEN = {n} * SUFFIX
SUFFIX = <time, date, FREQ>
Example
SCHEDULE=hourly_from_09:00am_Mar_01,_2002
SCHEDULE=last_weekday_from_17:00_Oct_23,_2001_retry_3_afte
r_ 1_hour
Note: This syntax is necessary only if you want to control your report jobs from the
command line. You can also specify the scheduled time and frequency of a report when
you define a new job in the easy-to-use Queue Manager screen, which you learn about
later in this lesson.

Oracle Reports Developer 10g: Build Reports 21-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Reports Caching

Cached reports on server:


Tolerance = n (minutes)
Tolerance = 0 (default/current behavior)
Maximum tolerance is 232 minutes (approximately
10,000 years)
Cached output controlled by a CACHEDIR server
parameter

Copyright 2004, Oracle. All rights reserved.

Reports Caching
Include the TOLERANCE parameter in your command line to set the maximum
acceptable time (in minutes) for reusing a report's cached output when a duplicate job is
detected. Setting the time tolerance on a report reduces the processing time when
duplicate jobs are found.
Setting TOLERANCE=60 means that Reports Services can detect a duplicate report
request for the same report and return the existing cached output to the client without
rerunning the report if the existing report output is 60 minutes old or less.
Setting TOLERANCE=0 forces the report to rerun for each request. This is the default
behavior.
Reports Services uses a parameter CACHEDIR to determine where to place the cached
output. The default directory is <oracle_home>\reports\cache.
Technical Note
For more information on OracleAS Reports Services, see the eClass Oracle9iAS Reports
Services: Deploy Internet Reports. Also refer to Oracle Application Server Reports
Services, Publishing Reports to the Web documentation.

Oracle Reports Developer 10g: Build Reports 21-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using Oracle Enterprise Manager

Copyright 2004, Oracle. All rights reserved.

Using Oracle Enterprise Manager


This section introduces Oracle Enterprise Manager as a means for monitoring OracleAS
Reports Services. It also explains the features of the Queue Manager and how to use it to
view and schedule reports in an easy-to-use GUI.

Oracle Reports Developer 10g: Build Reports 21-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Managing and Monitoring OracleAS
Reports Services

Start, stop, and restart a Reports server


View and manage:
Current Jobs queue
Scheduled Jobs queue
Finished Jobs queue
Monitor server performance
Edit server configuration

Copyright 2004, Oracle. All rights reserved.

Managing and Monitoring OracleAS Reports Services


OracleAS Reports Services operates under the centralized management provided for
Oracle Application Server by Oracle Enterprise Manager (OEM). Oracle Enterprise
Manager is Oracle's single, integrated solution for administering and monitoring global e-
business enterprises. OracleAS Reports Services can be managed through the new
browser-based user interface for Oracle Enterprise Manager.
Using OEM, you can:
Start and stop your OracleAS Reports server
Monitor response metrics
Edit server configuration
View server trace information
View the server log file
View the various job queues
Because OracleAS Reports Services is integrated with Oracle Enterprise Manager, you
can administer it right along with all the other Oracle Application Server components.

Oracle Reports Developer 10g: Build Reports 21-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
What Is the Queue Manager?

Real-time Reports Server status:


View report status and scheduled jobs
Refresh to see the up-to-date status
Reprioritize or cancel jobs

Administrator password encrypted in .conf file

Copyright 2004, Oracle. All rights reserved.

What Is the Queue Manager?


The Queue Manager is a facility that enables users and administrators to view the current
status of each report.
You can see all the jobs controlled by the master, as well as the server on which each job
is running, and the time that each report started and finished, and whether it terminated
successfully or with an error.
You can also view jobs that are scheduled to run at a future date or time.
You can reprioritize or cancel your own scheduled jobs. Administrators can reprioritize or
cancel any scheduled jobs.
Administrator Privilege
In the <servername>.conf file, the first line gives an encrypted password, IDENTIFIER=.
You can set this password the first time that you start the Reports Services. At the login
prompt, select any username and password to assign as Administrator.

Oracle Reports Developer 10g: Build Reports 21-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Queue Manager

Past jobs

Current jobs
Scheduled jobs

Copyright 2004, Oracle. All rights reserved.

Queue Manager
The Queue Manager status bar enables you to switch among different views of report
jobs.
Icon Name Description
Show Past Jobs Displays jobs that have already run for a given reports server
Show Current Jobs Displays jobs that are currently running
Show Scheduled Jobs Displays scheduled jobs in order to reprioritize or cancel a job

Oracle Reports Developer 10g: Build Reports 21-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Queue Manager

All my jobs

All jobs
Refresh

Copyright 2004, Oracle. All rights reserved.

Queue Manager (continued)


The Queue Manager status bar enables you to restrict the view of jobs by owner.

Icon Name Description


Show All My Jobs Displays your reports for a given reports server
Show All Jobs Displays all reports for a given reports server

Displaying Up-to-Date Job Status


Click Refresh on the status bar to refresh the screen and display the up-to-date status.
The default update interval is 15 seconds. You can alter this interval in the Queue
Manager preferences window. Select Options > Preferences > Polling Interval.

Oracle Reports Developer 10g: Build Reports 21-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using the Queue Manager

RSVR1
Queue
Manager
RSVR2

Connect to any number of servers


Administrator can shut down server
Reports Services restores scheduled jobs after
shutdown

Copyright 2004, Oracle. All rights reserved.

Using the Queue Manager


You can connect to Reports Services by changing the server name in the Queue Manager
status bar.
You can shut down Reports Services from the Queue Manager menu if you have
Administrator privileges. Select Queue > Shutdown. This option remains grayed out if
you are not logged on as Administrator.
Reports Services maintains a list of all scheduled jobs in a file, <oracle_home>/
reports/server/servername.dat. If Reports Services shuts down and restarts
for any reason, it reads this file at startup and restores all scheduled jobs.

Oracle Reports Developer 10g: Build Reports 21-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Describe the JSP and servlet run-time architectures
List several ways to run a report
Describe the features of Oracle Enterprise Manager
and Queue Manager for monitoring Reports
Services

Copyright 2004, Oracle. All rights reserved.

Summary
OracleAS Reports Services provides a flexible architecture for the distribution and
automated management of report generation engines on the same server and across
multiple servers, in both Web-based and non Web-based environments.
Run a report using several methods:
- RWCLIENT
- URL syntax
- OracleAS Portal
- SRW.RUN_REPORT
- Event-Driven Publishing API
OracleAS Reports Services Runtime Architecture
- Run Web layouts using the JSP runtime architecture.
- Run paper layouts using the Servlet runtime architecture.
Use Oracle Enterprise Manager to monitor OracleAS Reports Services.
Use Queue Manager to view and schedule reports.

Oracle Reports Developer 10g: Build Reports 21-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 21 Overview

Constructing a URL to run a report on the Web


Creating an entry in the key map file

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 21


This practice session contains:
Constructing a URL to run a report on the Web
Creating an entry in the key map file
You publish your reports using OracleAS Reports Services in the Oracle Application
Server. This practice session consists of paper-based questions to test your understanding
of OracleAS Reports Services.

Oracle Reports Developer 10g: Build Reports 21-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 21
1. You created a report called SalaryByDept.jsp that displays the salary

Oracle University Internal and TransAmerica Training Management Inc Partner use only
information for a particular department value by accepting a runtime parameter
p_deptno. You need to deploy the report on the Web using a URL.
Component Description
Web server neptune
domain name world
port 8889
alias for the directory path salarydata
The report should be executed by repserver4, the output should be in
HTMLCSS format, and go directly to OracleAS Reports cache. Access the data by
connecting to the Employee database using a username of scott, a password of
tiger, and EmpDB as the database connect string. Construct the URL to run the
report using the Reports servlet.
2. So that you do not have to enter such a long URL each time you run the
SalaryByDept report, create a key entry in the cgicmd.dat key map file entry
located under <ORACLE_HOME>\reports\conf.
a. Name the key salary. Be sure to include the runtime parameter p_deptno in
the key entry.
b. Reconstruct the URL to run the report using the key. Pass a value of 30 for
p_deptno.
3. In addition to using a URL, what are the other methods for requesting a report?
4. What is the JSP runtime architecture used for?
5. Which two facilities can be used to monitor OracleAS Reports Services?

Oracle Reports Developer 10g: Build Reports 21-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building Reports: Efficiency Guidelines

Copyright 2004, Oracle. All rights reserved.

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Objectives

After completing this lesson, you should be able to do


the following:
Describe performance areas
Use performance measuring tools
Build reports to run in other languages

Copyright 2004, Oracle. All rights reserved.

Overview
A report does not run in a vacuum. It is dependent on the underlying hardware, software,
and network connection. Because of this complex interrelationship, performance is always
an issue. The second part of this lesson focuses on performance in the run-time
environment and gives you a number of performance tips. You should also realize that
Report applications are portable across multiple platforms and multiple languages. You
can reduce cross-platform development effort by planning for platform-specific features
or restrictions. In this lesson, you also learn how to build reports to run on various
platforms, and in different environments and languages.

Oracle Reports Developer 10g: Build Reports 22-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Tuning Reports

No absolute rules
Investigate specific areas:
Data Model
Paper Layout
Web Layout and JSP report definitions
Run-time arguments

Copyright 2004, Oracle. All rights reserved.

Tuning Oracle Reports


Tuning a report is not a matter of applying a few small tweaks that will result in dramatic
improvements in performance. It is more a case of investigating specific areas. The areas
to investigate are the Data Model, the Paper Layout, the Web Layout and JSP reports
definitions, and run-time arguments. Investigating some of these areas can result in
significant performance improvements, minor performance improvements, or may have
no effect on the actual performance at all, but rather impact the perceived performance.
Be aware that there are no absolute standards.
The Reports Measurement Tools
The first step to take when attempting to tune a report is to determine where the report is
spending the majority of its time in execution. In other words, does the report spend a
large portion of its time in the database retrieving the actual data, in the formatting
process once the data has been retrieved, or waiting for runtime resources and
distribution?

Oracle Reports Developer 10g: Build Reports 22-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Tuning Oracle Reports (continued)
The Reports Trace Option

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Reports Trace option produces a file that describes the series of steps completed
during the execution of the report. You have the option to log all events or only a subset
of events such as SQL execution or breakpoints. The trace file can provide very useful
information for performance evaluation, and also tells you what executed when.
Tracing can be set for various methods of report execution, for both RDF and JSP report
definitions containing SQL and non SQL data sources, such as the XML and Text
pluggable data sources.
To set the Trace option, use the TRACEFILE=<filename> command line argument when
running the report, or from the main menu select Program > Tracing.
Typical profile output is shown below:
Reports Profiler Statistics
TOTAL ELAPSED Time: 29.00 seconds
Reports Time: 24.00 seconds (82.75% of TOTAL)
ORACLE Time: 5.00 seconds (17.24% of TOTAL
UPI: 1.00 seconds
SQL: 4.00 seconds
In this profile output, you see the execution time (total elapsed time) for the report, the
amount of time spent formatting the retrieved data (Reports time), and the amount of time
spent waiting for the data to be retrieved (Oracle time), comprised of time spent
establishing the database connection, parsing and executing the SQL statement (UPI
time), and the time spent fetching the data and executing SRW.DO_SQL() statements,
EXEC_SQL statements, PL/SQL cursors, and so forth (SQL time).

Oracle Reports Developer 10g: Build Reports 22-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Performance Measurement

Measurement tool: Trace option


Server and network measurements:
SQL Trace
Traffic and bandwidth

Copyright 2004, Oracle. All rights reserved.

Server and Network Specific Measurements


Oracle Reports uses Structured Query Language (SQL) to retrieve data from a relational
database. It is essential for anyone tuning reports to have a good working knowledge of
SQL and to understand how the database is going to executes these statements. For those
users less proficient in SQL, Oracle Reports provides wizards to help build queries.
However, wizards cannot prevent inefficient SQL from being created (e.g., SQL that does
not use indexes).
Database servers and network systems often provide measurement tools to obtain
performance information. An invaluable aid for tuning SQL is the SQL Trace facility
provided by the database. SQL trace allows you to determine the SQL statement sent to
the database as well as the time taken to parse, execute, and fetch the data. Once the trace
file has been generated, use the TKPROF utility to generate the execution plan as well as
vital time statistics. For more information, refer to the Oracle Database SQL Reference
Manual.
You may also want to consult with the database and network administrators. They may be
able to suggest ways to improve performance for their respective areas. An obvious
approach is to consider upgrading to a later, more efficient product release, or to increase
the capacities and speeds of the hardware systems and network connections.

Oracle Reports Developer 10g: Build Reports 22-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Non SQL Data Sources

Copyright 2004, Oracle. All rights reserved.

Non SQL Data Sources


As you have learned, it is possible to publish data from any data source in Oracle Reports.
Both the XML and Text pluggable data sources can be accessed through a remote URL. If
speed is a concern, download the data locally and use the local data stream rather than the
remote URL. You can also specify the domains for which you can bypass a proxy server.
The XML pluggable data source supports validation of the XML data at runtime. You can
activate this option by checking the Validate Data Source checkbox in the XML query
definition window. When you do, the XML data is validated against the data definition
you specified in the DTD or XML schema. This is a rather costly operation. If you are
sure that your XML data is valid, do not activate validation. You will see a noticeable
performance difference, especially if your XML data stream is very large.
You have the option to specify either an XML schema or a DTD for the data definition.
Using an XML schema forces type checking. With a DTD, the data is merely treated as a
string and no type checking is necessary.

Oracle Reports Developer 10g: Build Reports 22-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Non SQL Data Sources (continued)
You can also specify an Extensible Stylesheet Language file (XSL) for the XML data

Oracle University Internal and TransAmerica Training Management Inc Partner use only
stream. Unless you absolutely need to apply the XSL at runtime, it is better to have the
data in the correct format to start with.
The pluggable Text data source supports the use of cell wrappers. This causes the file
format level delimiter to be ignored for every field for which a wrapper is defined. Unless
you really need this feature, avoid using cell wrappers for performance reasons.

Oracle Reports Developer 10g: Build Reports 22-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Investigating the Data Model

Schema design Redundant queries


Indexes Break groups
Efficient SQL Group filters
Efficient PL/SQL Linking queries
Calculations

Copyright 2004, Oracle. All rights reserved.

Investigating the Data Model


If the report spends a large amount of time in the database, then it is often wise to review
the data structure and how it is being used. The following areas should be examined:
Schema design: The specific nature of your application will determine the most
efficient Data Model, but bad schema design can have a dramatic effect. Generally
speaking, query-driven applications can benefit from denormalized tables, whereas
normalized tables are usually best for applications that do many updates and inserts.
Oracle Reports is a typical nonprocedural tool geared for set-based data retrieval.
Hence, an overly normalized Data Model can result in many avoidable joins or
queries.
Use of indexes: A lack of appropriate indexes can result in many full table scans and
Cartesian joins. Indexes should be placed on columns used in the query WHERE
clause, and on the tables in the detail queries. Indexes on columns in the master
queries of a report have limited impact as these queries only access the database once.

Oracle Reports Developer 10g: Build Reports 22-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Investigating the Data Model (continued)
Efficient use of SQL: Inefficient SQL can severely impact performance. As

Oracle University Internal and TransAmerica Training Management Inc Partner use only
mentioned earlier, an invaluable aid to tuning SQL in a report is the SQL Trace
facility provided by the database. For reports that have large queries, it is advisable to
either activate the cost based optimizer (by running ANALYZE on the tables or by
setting the appropriate parameter in the init.ora file), or optimize all SQL
statements following the rules laid out for the rule based optimizer.
Efficient use of PL/SQL: PL/SQL that performs database operations will give better
performance if it is used in stored database procedures. Stored procedures perform
database operations faster than local PL/SQL program units. The opposite is true if
PL/SQL does not involve any database operations. In this case, PL/SQL should be
coded locally using the Program Units node in the Report Object Navigator. You may
also want to consider using PL/ SQL libraries, but the performance overhead is
outweighed only when the benefits of code sharing can be used.

Oracle Reports Developer 10g: Build Reports 22-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Investigating the Data Model

Schema design Redundant queries


Indexes Break groups
Efficient SQL Group filters
Efficient PL/SQL Linking queries
Calculations

Copyright 2004, Oracle. All rights reserved.

Investigating the Data Model (continued)


Performing calculations: For calculations within a report (either through summary or
formula columns), the rule of thumb is that the more calculations that can be
performed within SQL, the better. If calculations are included in SQL, they are
performed before the data is retrieved rather than performed on the retrieved data by
Oracle Reports.
PL/SQL code that performs a significant amount of database operations will perform
better if it is implemented as a stored database procedure. SRW.DO_SQL() should be
used as sparingly as possible because each call to SRW.DO_SQL() necessitates
parsing and binding of the command and the opening a new cursor (just as with a
normal query). Unlike the query, however, this operation will occur each time the
object owning the SRW.DO_SQL() fires. For example, if a block of PL/SQL in a
formula column calls SRW.DO_SQL() and the data model group where the formula
resides returns 100 records, then the parse/bind/create cursor operation will occur 100
times. It is therefore advisable to only use SRW.DO_SQL() for operations that cannot
be performed within normal SQL (for example to create temporary tables or any other
form of DDL).

Oracle Reports Developer 10g: Build Reports 22-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Investigating the Data Model (continued)
Redundant queries: Ideally, a report should have no queries that return data that is

Oracle University Internal and TransAmerica Training Management Inc Partner use only
not required in the report. In general, the fewer queries you have, the faster your report
will run. Single query Data Models tend to execute more quickly than multiquery Data
Models. However, situations can arise where a report not only needs to produce a
different format for different users, but also needs to utilize different query statements
depending on user input. Clearly, this could be achieved by producing two different
reports.
Break groups: If the report requires the use of break groups, care should be taken to
ensure that the break order property is set for as few columns in the break group as
possible as Oracle Reports appends an extra column to the ORDER BY clause of the
query for every break column. The creation of a break group may also make the
ORDER BY clause redundant and in this case should be removed. To give better
performance, break order columns should be as small as possible and should be
database columns wherever this is feasible.
Group filters: It is usually more efficient to incorporate a group filter into the query
WHERE clause. This restricts the number of rows returned from the database and
avoids local filtering by Oracle Reports itself.
Linking queries: There are a number of ways to create Data Models that include
more than one table. You can create a single query with a join condition or you can
create two separate queries and create a link between the two. In general, it is
preferable to minimize the actual number of queries as each time a query is issued,
Oracle Reports needs to parse, bind, and execute a cursor. A single query report is
therefore able to return all the required data in a single cursor rather than many. Also,
with master detail queries, the detail query will be reparsed, rebound, and reexecuted
for each master record retrieved. In this case, it is often more efficient to use a single
query report with break groups.

Oracle Reports Developer 10g: Build Reports 22-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Investigating the Paper Layout

Frames
Object size
Format triggers
Fetching ahead
Bursting and distribution

Copyright 2004, Oracle. All rights reserved.

Investigating the Paper Layout


Once the data has been retrieved, Oracle Reports needs to format the output following the
Paper Layout the user has created. The time it takes to generate the layout depends on a
number of factors, such as:
Frames: When generating a default layout, Oracle Reports puts a frame around
virtually every object to protect the object from being overwritten by another object.
In some situations, such as boilerplate text column headings, there is clearly no risk of
the objects being overwritten, hence the immediately surrounding frame can be
removed.
Object size: An object that is defined as variable, expanding, or contracting in either
or both the horizontal and vertical directions requires extra processing. In this case,
Oracle Reports must determine the size for the objects instance before actually
formatting the object and any objects around it. If the sizing can be set to fixed, this
can be avoided as the positional relationship between objects is already known.

Oracle Reports Developer 10g: Build Reports 22-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Investigating the Paper Layout (continued)
Format triggers: Care should be taken when using format triggers as the trigger fires

Oracle University Internal and TransAmerica Training Management Inc Partner use only
every time the object is formatted at runtime. Format triggers should also be placed at
the highest level possible in the object/frame hierarchy so that the triggers fires at the
lowest possible frequency.
Fetching ahead: Oracle Reports provides the ability to display data such as the total
number of pages or grand totals in the report margin or header pages. This requires
that the entire report is fetched ahead before the first page can be output. The usual
execution model is to format pages on an as-needed basis. Using the read ahead
functionality does not affect the overall time it takes to generate the report, but rather
affects the amount of temporary storage required and the time it takes before the first
page can be viewed. To enhance perceived performance, reading ahead should be
avoided when a report is going to be run to the screen in a production environment.
Bursting and distribution: With the introduction of report bursting, a report layout
can be made up of three distinct sections: header, body, and trailer. A report can
comprise all three sections or it can be viewed as three separate reports within one
report. Oracle Reports allows you to control bursting at the group record level,
offering a further level of granularity in report bursting. The use of report bursting in
conjunction with distribution offers considerable performance gains. Each section of a
report can have multiple different formats and can be sent to multiple destinations in
one single run rather than running the same report multiple times.
Web Layout and JSP Report Definition
You learned that Oracle Reports takes full advantage of JSP technology to deliver high
quality Web publishing. Recall that you can use your favorite Web authoring tool to
design the static portion of your Web page and then use Oracle Reports to add the
dynamic portion (data) into the appropriate sections of the page. A poorly designed Web
page has an impact on the perceived performance.
Because it is possible to include any Java code in the JSP, it is easy to get carried away
and mix business and data access Java code with the presentation logic. This should be
avoided as it increases the footprint of the JSP and limits the efficient use and
management of system resources.
Customized formatting of a Web page is always an expensive operation. Any type of
formatting that you cannot natively achieve through Oracle Reports (e.g., changing the
foreground color of a report block) should be done using Java in the most direct way. The
use of PL/SQL wrappers for formatting purposes in discouraged.
A .jsp report definition can contain both a paper layout and a Web layout. Since the Web
layout section of a JSP report could contain an <rw:include> tag referencing a paper
layout object, Oracle Reports always formats the paper layout when executing the report.
If your JSP report does not reference any paper layout objects, it is recommended that you
use the SUPPRESSLAYOUT command option to prevent executing the paper layout.

Oracle Reports Developer 10g: Build Reports 22-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running the Report

RUNDEBUG=NO
Array processing
LONGCHUNK
PARAMFORM
Batch processing

Copyright 2004, Oracle. All rights reserved.

Running the Report


Having designed a report to run efficiently, it is possible to further affect the overall
performance of a report by setting specific run-time arguments.
By default, Oracle Reports automatically runs error checks on the layout and bind
variables within a report. This is useful at the design stage but is generally superfluous in
a production environment. Setting the runtime parameter RUNDEBUG= No turns off this
extra checking at run-time.
Oracle Reports is able to take advantage of array processing capabilities. This allows
records to be fetched in batches instead of one at a time and results in fewer calls to the
database. The downside of array processing is that more space is required on the
execution platform for storing the arrays of records returned. If the load on the network
becomes a major bottleneck in the production environment, the ARRAYSIZE argument
(defined in kilobytes) can be set to as large a value as possible for the execution
environment to reduce the number of network trips made to fetch the data for the report.
The default value for ARRAYSIZE is 10 kilobytes.

Oracle Reports Developer 10g: Build Reports 22-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Running the Report (continued)
If the report has columns of the LONG, CLOB, or BLOB datatype, the LONGCHUNK

Oracle University Internal and TransAmerica Training Management Inc Partner use only
parameter can be set to a large value to reduce the number of increments it takes Oracle
Reports to retrieve the long values.
If a parameter form or online previewing is not required, these functions can be bypassed
by setting the PARAMFORM and BATCH system parameters to No and Yes,
respectively.
Calling Reports from Forms
In an application built using Forms Builder and Reports Builder, it is often the case that
some type of report is required on data that has already been retrieved and/or updated by
the Oracle Forms section of the application. The tight integration between Oracle Forms
and Oracle Reports allows you to pass blocks of data between the associated products.
Passing data is achieved using record groups and data parameters in conjunction with the
RUN_REPORT_OBJECT built-in for calling reports from forms. Sourcing a Reports
query from a Forms record group avoids requerying the database and hence Oracle
Reports will only spend time formatting the data.
Technical Note
For more information on tuning your reports, see the whitepaper Tuning Oracle Reports
on the Oracle Technology Network (http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 22-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Different Development and Run-Time
Environments

Reports Builder development


Bitmapped only
Reports Builder Runtime
Bitmapped
MODE = bitmap
Character mode
MODE = character

Copyright 2004, Oracle. All rights reserved.

Different Development and Run-Time Environments


Although you always develop your reports in a bitmapped environment, the production
reports can run in either bitmapped or character mode.
Therefore, you can develop a report in a bitmapped environment that is to run in a
character mode environment.
Bitmapped Environment
This environment has a unit of pixel and typically supports a mouse. Interaction with the
host computer is continuous.
The bitmapped Designer allows you, as a developer, to take advantage of the graphical
user interface.

Oracle Reports Developer 10g: Build Reports 22-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Different Development and Run-Time Environments (continued)
Character Mode Environment

Oracle University Internal and TransAmerica Training Management Inc Partner use only
This environment has a unit of character, typically 80*24, and rarely supports a mouse.
Interaction with the host computer is at field level; that is, when the user navigates from
the field.
A report that runs in character mode cannot display any graphics features, such as images,
drawings, or multimedia objects.
Running a Character Mode Report from the Builder
You can test your character mode reports very easily in the bitmapped Reports Builder
and view the report output in the Previewer (File > Print Preview).
The execution of the report as bitmapped or character simply depends on a system
parameter called MODE. You can change this parameter in Reports Builder to test the
character output during your report development.

Oracle Reports Developer 10g: Build Reports 22-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Developing Reports to Run in Different
GUIs

Use common fonts or map fonts in


uifont.ali
Use common colors
Be aware of dots per inch (DPI)

Copyright 2004, Oracle. All rights reserved.

Developing Reports to Run in Different GUIs


There are a few points that you should consider when moving a report from one GUI to
another, because the following GUI differences may affect the report output.
If possible, use fonts that you know exist on the target GUI; otherwise, remember to set up
your font alias file so that the fonts that you use during development map to existing
similar fonts on the target GUI.

Oracle Reports Developer 10g: Build Reports 22-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Developing Reports to Run in Different GUIs (continued)
Example

Oracle University Internal and TransAmerica Training Management Inc Partner use only
In the uifont.ali file on Microsoft Windows, map Motif and Mac fonts to Microsoft
Windows:
/* Motif fonts */
lucidatypewriter = "Courier New"
lucidabright = "Times New Roman"
fixed = "Courier New"

/* Mac fonts */
"Avant Garde = "Arial"
"New York = "Times New Roman"
In the uifont.ali file on UNIX (motif), map Microsoft Windows fonts to Motif:
/* Microsoft Windows fonts */
"Courier New" = lucidatypewriter
"Times New Roman = lucidabright
Using Common Colors
If possible, use a color that you know exists on the target GUI; otherwise, use one that
maps well to the default color of the target GUI.
Beware of Dots Per Inch
The dots per inch (DPI) may differ among machines, even if they use the same GUI. This
only affects how alphanumeric characters wordwrap on the screen. Therefore, if you
design a report that is displayed in the Previewer, try to use the same DPI as the users who
will eventually run the report.

Oracle Reports Developer 10g: Build Reports 22-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Setting NLS Language Environment
Variables

NLS_LANG
DEVELOPER_NLS_LANG, USER_NLS_LANG

NLS_LANG=French_France.WE8DEC

Unicode:

NLS_LANG=<lang>_<territory>.UTF8

Copyright 2004, Oracle. All rights reserved.

Building Reports to Run in Different Languages


This section gives a brief overview of the features available on the server and in Oracle
Reports Developer that provide support for building multilingual applications.
Switching languages using Oracles National Language Support (NLS)
Translating an application using Oracles TranslationHub
Setting NLS Language Environment Variables
Three language environment variables are available:
NLS_LANG
DEVELOPER_NLS_LANG
USER_NLS_LANG
DEVELOPER_NLS_LANG and USER_NLS_LANG take the same parameter as
NLS_LANG. Use them as an alternative to NLS_LANG when you need to use two sets of
resource and message files at the same time; for example, if you prefer to develop using
English but need to build an application in another language.

Oracle Reports Developer 10g: Build Reports 22-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Building Reports to Run in Different Languages (continued)
Syntax

Oracle University Internal and TransAmerica Training Management Inc Partner use only
NLS_LANG = <language>_<territory>.character_set
Language: Language conventions for displaying messages and day and month names
Territory: Conventions for default date format, and for displaying currency, decimal,
and thousands symbols
Character_set: Character set in which data is displayed
Example
NLS_LANG=French_France.WE8DEC
Using Unicode in Oracle Reports Developer
Unicode is a global character set that allows multilingual text to be displayed in a single
application. Unicode is a fixed-length two-byte character set that represents up to 65,536
characters.
Using Unicode in Oracle Reports enables you to display multiple languages in one
application without switching character sets.
To enable Unicode support, set the NLS_LANG environment variable as follows:
NLS_LANG = <language>_<territory>.UTF8
The data must also be stored in Unicode.

Oracle Reports Developer 10g: Build Reports 22-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Translating an Oracle Reports Application

Use TranslationHub to translate messages and text


defined as part of the application.
Consider:
Format masks
Hard-coded strings
Multiple character sets

Copyright 2004, Oracle. All rights reserved.

Translating an Oracle Reports Application


In any Oracle Reports application, you see many types of messages, including:
Error messages from the database
Runtime error messages produced by OracleAS Reports Services
Messages and boilerplate text defined as part of the application
If the NLS environment variable is set correctly and the appropriate message files are
available, then translation of messages for the first two bullets is done for you. To
translate messages and boilerplate text defined as part of the application, you can use the
Oracle translation tool, TranslationHub.
For more information about using TranslationHub, see the Oracle Technology Network
(http://otn.oracle.com).

Oracle Reports Developer 10g: Build Reports 22-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Translating an Oracle Reports Application (continued)
Considerations When Designing Multilingual Applications
Format masks: Make sure to provide extra space for translation of date and numeric

Oracle University Internal and TransAmerica Training Management Inc Partner use only
format masks.
Text strings: Avoid hard-coding a string containing language-specific words such as a
month name.
Character sets: If using an application that will run with multiple character sets,
determine the one that is most frequently used and generate the application files with
the relevant NLS language settings.

Oracle Reports Developer 10g: Build Reports 22-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Summary

In this lesson, you should have learned how to:


Use performance measuring tools
Describe the facilities for running reports in other
languages

Copyright 2004, Oracle. All rights reserved.

Summary
Analyze the performance of your reports using the Trace option in Oracle Reports, as
well as the SQL trace facility in the database. Tune reports by optimizing SQL,
minimizing calls to the database, and minimizing the amount of unnecessary format
processing required for the layout of returned data.
Using Oracles translation tool, TranslationHub, the NLS parameters, and various
features in Oracle Reports, you can build multilingual report applications.

Oracle Reports Developer 10g: Build Reports 22-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice 22 Overview

Identifying areas to investigate for tuning reports


Using the trace facility
Interpreting time statistics
Improving performance

Copyright 2004, Oracle. All rights reserved.

Practice Session Overview: Lesson 22


This practice session contains:
Generating and interpreting report trace information
Modifying a report to make it more efficient
Report performance is always an issue. Reports Builder offers a few tools that allow you
to measure performance. In this practice you will use them and interpret the results.

Oracle Reports Developer 10g: Build Reports 22-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session: Lesson 22
1. Name four main areas to investigate when tuning reports.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
2. What is the name of the font mapping file?
3. Generate and interpret Reports Runtime Trace information.
a. Open report p19q4.rdf. From the menu select Program > Tracing.
b. In the Runtime Trace Settings dialog box specify p19q4.txt as the trace file and
select the All check box under Trace Settings.
c. Select OK to close the dialog box.
d. Run the paper layout. Paginate through the report in the Paper Design view.
e. Open p19q4.txt and look at the results. Where does this report spend time?
f. Repeat the same steps for report p22q2b.rdf. Specify p22q2.txt as the
trace file. Compare the result. How do you explain this?
4. Make a suggestion to improve performance.
a. Open the report p12q1.rdf and generate Reports Trace information. Look at
the time statistics.
b. Examine the Data Model. What could you possibly do to make the report run
faster?
c. Implement your change and regenerate the time statistics. Did things improve?

Oracle Reports Developer 10g: Build Reports 22-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Practice Solutions

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 2
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports A-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 2
1. Invoke the Reports Builder executable.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Select Reports Builder from the Oracle Reports menu: Start > Programs >
Oracle Developer Suite > Reports Developer > Reports Builder.
This may differ according to the classroom setup.
Click Cancel in the Welcome to Reports Builder dialog box
2. Open the report called p2q2.jsp. Run the Web layout.
From the menu select File > Open. Locate p2q2.jsp in your working
directory and click Open.
Select Program > Run Web Layout from the menu or select the Run Web
Layout icon on the horizontal toolbar.
Specify the database details in the Connect dialog box.
a. Examine the report in your browser. Among the styles discussed in this
lesson as a reference, what style of report is it?
Tabular report.
b. How many groups of data are there in this report?
One group of data, each row being displayed once within the group.
c. In the browser, use the scroll bars to move up and down the report to see all
of the data.
Use the scroll bar on the right side of the browser window to scroll up
and down the report data.
d. Close the browser window. You are now back in Reports Builder.
In the browser, click the Close icon in the upper right corner or select
File > Close from the menu.
3. Open report p2q3.rdf and run the paper layout.
From the menu select File > Open. Locate p2q3.rdf in your working
directory and click Open.
Select Program > Run Paper Layout from the menu or select the Run Paper
Layout icon in the horizontal toolbar.
a. In the Paper Design view, move to the next page. Notice that this report has a
header page with text.
Select Next Page to navigate from one page to another.
b. What style of report is this?
Tabular report.

Oracle Reports Developer 10g: Build Reports A-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 2 (continued)
c. Close the Paper Design view. From the File menu, select Print Preview. In

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the Previewer window, experiment with the horizontal and vertical split
screen features.
Select File > Print Preview. To split the Previewer horizontally: Select
the small gray area at the top of the right scroll bar. Press the left mouse
button down and drag the gray area. As you do this, you see that a thick
dotted line is dragged down the Previewer. Depress the left mouse button
when you have reached the desired split point. Now you have two
windows, which work independently from each other.
Move the split bar back to its original position.
To split the Previewer vertically: Select the small gray area at the left of
the horizontal scroll bar at the bottom of the window. Press the left
mouse button down and drag the gray area. As you do this, you see that
a thick dotted line is dragged right across the Previewer. Depress the left
mouse button when you have reached the desired split point. Now you
have two windows, which work independently from each other.
d. Close the Previewer window.
In the Previewer, click the Close Previewer button.
4. Open report p2q4.jsp and run the Web layout.
Select File > Open, locate p2q4.jsp, and click Open.
Select Program > Run Web Layout from the menu or select the Run Web
Layout icon on the horizontal toolbar.
a. What style of report is this?
It is a Group Left master/detail report.
b. How many groups of data are in this report?
There are two groups of data.
c. How many pages are there in this report?
There are no pages in a Web report. In Reports Builder, run the paper
layout to determine the number of pages. There are three pages in this
report.
d. Close the browser.
In the browser, click Close.

Oracle Reports Developer 10g: Build Reports A-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 2 (continued)
5. Open report p2q5.jsp and run the Web layout.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
From the menu select File > Open. Locate p2q5.jsp and select Open.
Select Program > Run Web Layout from the menu or select the Run Web
Layout icon from the horizontal toolbar.
a. What style of report is this?
It is a Matrix report.
b. How many groups of data are in this report?
There are four groups of data:
Year
Department Name
Job ID
Salary
There actually is an additional, invisible cross product group around
Year, Department Name, and Job ID; this special group defines the
matrix structure and is explained in the lesson on matrix reports.
c. Close the browser window.
In the browser, click Close.
6. Open report p2q6.rdf and run the paper layout.
From the menu select File > Open. Locate p2q6.rdf and click Open.
Select Program > Run Paper Layout from the menu or select the Run Paper
Layout icon in the horizontal toolbar.
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.
Click in the customer ID field and enter one of the suggested numbers.
Select Run Report.
c. What do you think would be a better method of providing valid values to a
user?
It would be more user-friendly to display a list of values. And it would be
even more meaningful to add customer names. This can easily be built
into the report. You will see how this is done in a later lesson.

Oracle Reports Developer 10g: Build Reports A-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 2 (continued)
d. Close the Paper Design view.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
In the Paper Design view, click Close.
e. Run the paper layout again. This time do not specify a customer ID.
From the menu select Program > Run Paper Layout. Immediately select
Run Report without entering a value for customer ID.
i. What is the result?
The result is that the report does run; however, it does not display any
data. There are no NULL customer IDs.
ii. In a production situation, what should happen in this instance?
The user should be prevented from entering a NULL value or a blank.
In later lessons you will see how this can be implemented.
f. Close the Paper Design view.
In the Paper Design view, click Close.
g. Run the paper layout again. This time enter Customer ID 999.
From the menu select Program > Run Paper Layout. Enter the customer
ID 999 and select Run Report.
i. What is the result?
The result is that the report does run; however, it does not display any
data. There is no customer ID 999.
ii. In a production situation, what should happen in this instance?
The user should be prevented from entering an invalid value. In later
lessons you will see how this can be implemented.
h. Close the Paper Design view.
In the Paper Design view, click Close.
7. Open report p2q7.rdf and run the paper layout.
From the menu, select File > Open. Locate p2q7.rdf and select Open.
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.
Select a customer name from the list of values for customer and click
Run Report.
c. Close the Paper Design view.
In the Paper Design view, click Close.

Oracle Reports Developer 10g: Build Reports A-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 3
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 Report executables.

Oracle Reports Developer 10g: Build Reports A-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 3
1. Start Reports Builder and open the existing report: p3q1.jsp. Run the paper

Oracle University Internal and TransAmerica Training Management Inc Partner use only
layout.
On your desktop, locate the Reports Builder icon and launch the executable.
In the Welcome dialog box of Reports Builder select the Open an existing
Report option and click OK.
Open p3q1.jsp from the file system and run the paper layout. Use the iconic
button on the horizontal toolbar, or use the Run Paper Layout option in the
Program menu.
If prompted, connect to the database using the login information your
instructor gives to you.
When the Runtime Parameter Form comes up, select one of the customers in
the list, and select Run Report.
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.
If the Report Editor window is still active from the previous exercise, select
View > Change View > Data Model from the menu.
If you closed the Report Editor after the previous exercise:
Select Tools > Report Editor from the menu and then select View > Change
View > Data Model from the menu. Or, double-click the Data Model object
icon in the Object Navigator.
Move the Data Model window to the right of your screen so that you can also
see the Object Navigator.
Activate the Object Navigator window.
Click in the Find field and enter Q_1. The Navigator expands the appropriate
node and highlights the first object that meets the entered value.
In the Data Model view, the query object Q_1 is selected.

Oracle Reports Developer 10g: Build Reports A-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 3 (continued)
3. Using the same report, switch to the Paper Layout view of the Report Editor.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
While the Report Editor window is active, select View > Change View > Paper
Layout from the menu.
Activate the Object Navigator window.
Click in the Find field and enter F_. The Navigator expands the appropriate
node and highlights the first object that meets the entered value.
In the Paper Layout view the field F_CUSTOMER_ID is selected.
In the Object Navigator window, select the Paper Layout node and select
Expand All in the vertical toolbar; or select View > Expand All from the
menu. Select R_G_ORD_ID.
In the Paper Layout view, the repeating frame R_G_ORD_ID is selected.
4. Using the same report, run the Web layout.
Select Program > Run Web Layout from the menu, or select the Run Web
Layout iconic button from the horizontal toolbar.
5. Use Help Contents to answer the following questions:
From the menu, select Help > Help Contents. Use the Index tab to locate each
term.
a. What is RWSERVLET?
Enter RWSERVLET. RWSERVLET is the executable for the Reports
Servlet.
b. What is RWCLIENT?
Enter RWCLIENT. RWCLIENT is the executable for the Reports Client.
It parses and transfers the command line to the Reports Server.
c. What is the Web Source view?
Enter Web Source. The Web Source is a view of the Report Editor that
displays the source code for your Web report, including JSP and HTML
tags.

Oracle Reports Developer 10g: Build Reports A-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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, keep to the file naming
conventions that the questions specify. You might 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 beforehand; be sure to use Save
As, not Save, so that you do not overwrite the existing file name.

Oracle Reports Developer 10g: Build Reports A-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4 (continued)
Invoking Reports Builder and the Wizard

Oracle University Internal and TransAmerica Training Management Inc Partner use only
If Reports Builder is open after the previous practice session:
Close any reports currently in the Object Navigator.
Create a new report by selecting the Reports node and selecting the Create icon.
Note: There is an alternative method. If no reports are open in the Object Navigator, you
can double-click the Reports node.
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
Display all fields. Do not make any changes to the other Wizard pages.
In the New Report dialog box, select the option "Use the Report Wizard" and
click OK.
In the Welcome to the Report Wizard! page, click Next.
In the report layout page, select Create Paper Layout only and click Next.
In the report style page, Tabular is selected by default. Click Next.
In the data source type page, SQL Query is selected by default. Click Next.
In the data source definition page, click Query Builder.
In the Select Data Tables dialog box, highlight the DEPARTMENTS and
EMPLOYEES tables, click Include, and close the dialog box.
In the Query Builder window, select the columns from the tables and click
OK.
Click Next.
Copy all fields from the Available Fields area to the Displayed Fields area.
Click Next on all other Wizard pages and click Finish on the last page.

Oracle Reports Developer 10g: Build Reports A-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4 (continued)
2. Using the reentrant Report Wizard, make the following modifications (test your

Oracle University Internal and TransAmerica Training Management Inc Partner use only
report frequently).
Select Tools > Report Wizard from the menu or the right-mouse-button
menu.
a. Modify the query to sort the data in descending order of salary.
On the Data tab choose Query Builder.
In the Query Builder window select Sort. Copy the SALARY column to
the Sorted Columns, select it, and select Sorting Order as Descending.
Close the Sort dialog box and the Query Builder.
Click Finish to test your report.
b. Add a summary to show the total salary value.
Reenter the Report Wizard by choosing Report Wizard from the menu.
On the Totals tab select SALARY and click Sum.
c. Ensure the width of SALARY and TOTAL is 6.
Make the necessary changes on the Labels tab.
d. Select the Green template.
Select the Green template on the Template tab and click Finish to test
your report.
e. Save the report to a file named p4q2.rdf.
Select File > Save As from the menu and save the file to disk.
3. Using the reentrant Wizard, modify the report to create a break report.
a. Select the report style Group Above.
Select the report style on the Style tab.
b. Modify the query and remove the join clause so that the report contains all
employees and not just managers.
Select the Data tab. Edit the query, removing the join clause
DEPARTMENTS.MANAGER_ID=EMPLOYEES.EMPLOYEE_ID.
Watch for syntax errors!
c. Group the report by the department name.
On the Groups tab copy DEPARTMENT_NAME to the Group Fields
area.
Click Finish.
d. Save the report as p4q3.rdf.
Select File > Save As from the menu and save the file to disk.

Oracle Reports Developer 10g: Build Reports A-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4 (continued)
4. Create a new report as follows:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Using the Report Wizard, create a paper layout and select the Mailing Label
style.
Create a new report by selecting the Reports node in the Object
Navigator and choosing the Create icon.
As an alternative you can also select File > New > Report from the menu.
Select Create Paper Layout only. Select Mailing Label style.
b. Enter the query in the data source definition window:
For the query type, accept the default selection of SQL query.
Enter the query text:
select c.cust_first_name || ' ' ||
c.cust_last_name Name, c.cust_address
from customers c
c. In the text area, include each of the following fields on a new line: NAME,
STREET_ADDRESS, CITY, and STATE_PROVINCE. Include
COUNTRY_ID, and POSTAL_CODE on the same line.
Copy NAME, STREET_ADDRESS, CITY, STATE_PROVINCE,
COUNTRY_ID, and POSTAL_CODE to the Mailing Label Text area.
To enter the line feeds you can either use the New Line button or simply
press the [Return] key.
d. Select No template and click Finish.
Select the No template radio button on the Template page and click
Finish.
e. Save the report to a file named p4q4.rdf.
Select File > Save As from the menu and save the file to disk.

Oracle Reports Developer 10g: Build Reports A-13

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4 (continued)
5. Using the reentrant Wizard, modify the report to create a Form Letter style.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Select Tools > Report Wizard from the menu or the right-mouse-button
menu.
On the Style tab select Form Letter.
a. Modify the query to include order information for each customer:
On the Data tab, modify the query text as follows:
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
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.
Copy the fields that you want to use to the Form Letter Text area and
enter your free-flowing text.
c. Select a different template and click Finish.
On the Template page in the Wizard, select any one of the predefined
templates. Click Finish.
d. Save the report as p4q5.rdf.
Select File > Save As from the menu and save the file to disk.
6. Create a new report.
Create a new report by selecting the Reports node in the Object Navigator
and choosing Create icon.
As an alternative you can also select File > New > Report from the menu.
a. Create both a Web and paper layout. Select the matrix report style.
On the first page, select Create both Web and Paper Layout. On the
Style page choose Matrix.
b. For the query, import the contents of p4q6.sql.
Choose Import Query and select p4q6.sql from the Import dialog
box.
c. Display customer names down the left side of the page.
Copy NAME to the Matrix Row Fields area.
d. Display product numbers across the top of the page.
Copy PRODUCT_ID to the Matrix Column Fields area.

Oracle Reports Developer 10g: Build Reports A-14

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4 (continued)
e. Display the sum of the total values in the cells.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Select Sum to copy the sum of TOTAL_VALUE to the Matrix Cell Fields
area.
f. Create a summary to give the total of the sum(total_value) values.
Select SumTOTAL_VALUE and choose Sum.
g. Change the width of all four summaries to 4. Change the PRODUCT_ID
label to Product. Remove the label for SumTOTAL_VALUE.
Make the necessary changes in the Labels and Width fields.
h. Select any template and click Finish to preview your report.
Select a template and click Finish to run your report.
i. Save the report to a file named p4q6.jsp.
Select File > Save As from the menu and save the file to disk.
7. Modify the matrix report to create a Matrix with Group.
Select Tools > Report Wizard from the menu or the right-mouse-button
menu.
On the Style tab select Matrix with Group.
a. Select Month as the group and check that all totals have a width of 4.
Go to the Groups tab and copy MONTH to the Matrix Group Fields
area.
Check on the Labels tab that all fields with a label Total: have a width of
4.
b. Click Finish to preview your report and save the report as p4q7.jsp.
Select File > Save As from the menu and save the file to disk.
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.

Oracle Reports Developer 10g: Build Reports A-15

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 4 (continued)
8. Web-enable a paper report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Open report p2q9.rdf and run the paper layout.
To open the file select File > Open from the menu or choose Open from
the Toolbar. Run the report by selecting the Run Paper Layout icon
from the horizontal toolbar.
b. Add a bookmark to the report, letting the department names serve as
bookmarks.
Select Insert > Bookmark from the menu. Copy the Department_Name
field from the Available Columns to the Bookmarks. Click OK.
c. Generate HTML Style Sheet output. Save the file as p4q8.htm.
Select File > Generate to File and select Paginated HTMLCSS. In the
Save file dialog box change the filename to p4q8.htm and select Save.
d. Open the report in a browser.
Start your browser. Select File > Open and use the Browse button to
specify the location and name of your file.
e. What happens when you click on the bookmarks?
The cursor jumps to that specific part in the report.
f. Close the browser and in Reports Builder, save the report as p4q8.rdf.
Close the browser. Select File > Save As and change the filename to
p4q8.rdf. Select Save.
g. Save and close all reports.
For each open report, select File > Save from the menu or Choose Save
from the horizontal toolbar. Then Select File > Close.

Oracle Reports Developer 10g: Build Reports A-16

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 5
This practice session involves modifying reports by applying changes in the Paper

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Design view of the Report Editor.
Introduction
In this practice session, you will reuse some of the reports that you created in the last
session.

Oracle Reports Developer 10g: Build Reports A-17

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 5
1. Open report p4q2.rdf. Make the following changes in the Paper Design view:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
To open the file select File > Open from the menu or select Open on the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting the Run Paper
Layout icon in the toolbar.
a. Make the SALARY column right-justified. Do not forget to justify the
column header accordingly.
Select the column SALARY and its label. Then choose Align Right from
the style bar or select Format > Justify > Right from the menu.
b. Add a comma and a currency symbol to SALARY. Add two decimal places.
While the SALARY column is selected, click Commas from the style bar.
This adds the group separators. Click Currency from the style bar. Then
click Add Decimal Place from the style bar to add one decimal place.
Repeat the action for the second decimal place. You can also select the
commas and decimal places options from the Format > Number menu.
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.
Select the column, then select Align Right from the style bar or select
Format > Justify > Right from the menu.
While the column is selected choose Commas, Currency, and then Add
Decimal Place from the style bar. Repeat the action for the second
decimal place.
d. Change the label of the total to italic font.
Select the label, then select Italic from the style bar or use Format > Font
in the menu.
e. Make whatever other changes you like.
No formal solution.
f. Save the report to a file named p5q1.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-18

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 5 (continued)
2. Open report p4q3.rdf. Make the following changes in the Paper Design:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting Run Paper Layout
from the toolbar.
a. Add a border with a with a hairline width around the total for each
department.
Select the column for department total and choose Line Color from the
vertical toolbar. Select any color to add the border. With the column
selected, format the width of the border: select Format > Line > Line
Width > Hairline.
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.
Select the total, the column, and its header, then select Align Right from
the style bar or select Format > Justify > Right from the menu.
While the column is selected choose Commas and then Add Decimal
Place from the style bar. Repeat the action for the second decimal place.
You can also select the options from the Format menu.
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).
Select the column, then choose Align Right from the style bar or select
Format > Justify > and from the menu.
While the column is selected choose Commas and then Add Decimal
Place from the style bar. Repeat the action for the second decimal place.
You can also select the options from the Format menu.
d. Change the color of the employee data heading to blue.
Select a label, and choose Select Parent Frame from the style bar. Select
Fill Color from the vertical toolbar.
e. Make whatever other changes you like.
No formal solution.
f. Save the report to a file named p5q2.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-19

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 5 (continued)
3. Open report p5q3_a.rdf. Make the following changes in the Paper Design:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting Run
Paper Layout from the Program menu or selecting Run Paper Layout from
the toolbar.
a. Add a date at the top center of the page. Give it any format you want.
Select Insert > Date and Time from the menu. Choose the font, style, and
text color you want.
b. Make whatever other changes you like.
No formal solution.
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:
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting Run Paper Layout
from the toolbar.
a. Right-justify the Product ID field.
Select the Product ID field, then select Align Right from the style bar or
select Format > Justify > Right from the menu.
b. Add commas and two decimal places to the cells and summaries and make
them right-justified.
Select the columns and choose Align Right from the style bar or select
Format > Justify > End from the menu.
While the columns are selected choose Commas from the style bar. Click
Add Decimal Place twice from the style bar. You can also select the
options from the Format menu.
c. Why are some of the cell and summary values displayed with asterisks?
What can you do to correct this?
The addition of the comma and two decimal places increased the width
of the data such that it exceeded the display size. To correct this, reenter
the Wizard and increase the width of the cell and summary fields. Select
Report Wizard from the right-mouse-button menu. Select the Labels tab
and choose a width more suitable for displaying the formatted values.
Try a width of 6.
d. Add a blue line color to the parent frame of NAME.
Select the column NAME and choose Select Parent Frame from the style
bar. Select Line Color from the vertical toolbar.
e. Save the report to a file named p5q4.jsp and close it.

Oracle Reports Developer 10g: Build Reports A-20

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 5 (continued)
If You Have Time

Oracle University Internal and TransAmerica Training Management Inc Partner use only
5. Open the file p5q2.rdf and conditionally highlight the SALARY field.
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting Run Paper Layout
from the toolbar.
a. If the salary is less than 8500, print the field in italics.
Select the SALARY field, then choose Format > Conditional Formatting
from the menu or use the right-mouse-button to open the pop-up menu
and select Conditional Formatting from the pop-up menu.
The Conditional Formatting dialog box opens. Click New and enter the
condition and formatting as required. Select a font name. Click OK to
return to the first page but do not close the dialog box.
b. If the salary is more than 12000, print the field in bold italics and make the
text color red.
Click New again and enter the second condition and formatting as
required. Click OK to return to the first page of the dialog box and then
OK again to close the dialog box.
c. Save the report to a file named p5q5.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-21

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 6
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Customizing an existing 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 Oracle Reports Developer 10g 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.

Oracle Reports Developer 10g: Build Reports A-22

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 6
1. Customize an existing template, adding a company logo and report title to the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
Select the Templates node in the Object Navigator.
Select Open and select the file named rwblue.tdf.
b. Display the margin region. (This usually appears by default when you open a
template.)
Select Tools > Template Editor from the menu. If the margin region is
not displayed, click the Margin icon in the horizontal toolbar.
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.
Select the Your Company logo and press the [Delete] key.
Select Insert > Image from the menu.
Use the Browse button to locate towers2.jpg
Resize it to fit into the margin region.
d. Add a report title: Lakeside Technologies.
Select the Text tool from the vertical toolbar. Click inside the editor and
type in the title. Select a font and font size. Click outside the textbox to
end.
e. Display the body region to view the changes you will make in the next steps.
Click the Margin button in the horizontal toolbar in the Template
Editor.
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.
Select the number field and the number heading in the Template Editor
and click the Align Right tool from the stylebar.
Alterative solution:
Open the Field Labels/Headings and the Fields nodes under Paper
Layout > Section > Body > Default in the Object Navigator.
Open the Property Inspector for your selections.
Click Union (the button is a toggle and the tooltip says Intersection at
this point) from the Property Inspector toolbar to display all properties.
Under the headings Labels and Fields, change the Number Justification
property to Right.
Select Summaries > Number in the Object Navigator.
In the Property Inspector change the Number Justification property for
fields to Right.
g. Save the template as laketech.tdf.

Oracle Reports Developer 10g: Build Reports A-23

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 6 (continued)
2. Apply the modified template to an existing report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Hint: You must search for the template file; it does not appear in the list of
predefined templates.
a. Open p4q3.rdf.
b. Apply laketech.tdf to the report.
Invoke the Report Wizard. On the Template tab select the option
Template file. Click Browse to enter the name of the file in the field
below.
c. The report shows some changes but not all. Which template changes have
been applied and which have not?
Changes applied: Logo and report title
Changes not applied: Number justification
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.
Note: When you delete the objects, Reports Builder displays the
following warning: This will delete the frame and all the objects it
encloses. Continue?. Click Yes
e. Save the report as p6q2.rdf.

Oracle Reports Developer 10g: Build Reports A-24

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 6 (continued)
3. Continue to modify the template and test it using a new report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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. To see the entire
template layout structure, and recognize the difference between the master
group fields and the detail group fields, select View > Zoom > Zoom Out
from the menu.
Select the Character, Number, and Date fields and change the text color
with the Text color palette.
Alternative solution:
In the Object Navigator, expand the Override node, then the Group Left,
the Section (Level1), and the Fields nodes.
Bring up the Property Inspector for all the fields
Change the text color to red.
b. Save your template as laketech2.tdf and close it.
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.
No formal solution.
d. Save the report as p6q3.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-25

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 7
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports A-26

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 7
1. Create a tabular report, Web and paper layout, entitled Compensation Report. The

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
Create a new report using the Report Wizard. Create both a Web and
paper layout. Select Tabular as the style and enter Compensation Report
as the title. Select SQL as the data source and enter the query text from
above. Select all fields for display. Do not create any totals. Select the
Blue template and Finish the Wizard.
b. Run the Web layout to test.
Select Program > Run Web Layout from the menu or select the Run
Web Layout icon from the horizontal tool bar.
c. Examine the Web source. How many <rw:foreach> tags are in the code?
Why this number?
Display the Web Source view of the Report Editor by one of the
following methods:
- Double-click the Web Source object icon in the Object Navigator.
- Click the Web Source button in the Report Editor toolbar.
Use Edit > Find and Replace to locate the rw:foreach tag(s). There is one
tag in this Web source code because there is one group in the data model.
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. Reenter the Wizard. Select Group Left as the style. On the
Groups page, select DEPARTMENT_NAME from the Available Fields
list and copy into the Group Fields list. On the Totals page, select
SALARY and click Sum >. Finish the Wizard.
e. Examine the Web source again. Now how many <rw:foreach> tags are in the
code?
Display the Web Source view of the Report Editor. Use Edit > Find and
Replace to locate the rw:foreach tag(s). There are two rw:foreach tags,
one for each group in the Data Modelone for the master group, one for
the detail group.

Oracle Reports Developer 10g: Build Reports A-27

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 7 (continued)
f. Which JSP tag identifies the overall appearance and formatting of the data in

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the Web report?
The rw:style tag identifies the style sheet for the report.
g. Which JSP tag delimits the data model and layout information? Can you
view this information in the Reports Builder?
The rw:objects tag delimits the data model and the layout information
for a Reports JSP. Reports Builder displays the <rw:objects > tags,
but, hides the data model and layout information. To see this, use a text
editor such as Wordpad.
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..


Create a new report using the Report Wizard. Create both a Web and
paper layout. Select Tabular as the style and enter Our Products as the
title. Select SQL as the data source and enter the query:
SELECT product_id, product_name,
product_description, catalog_url
FROM products
ORDER BY product_id
Select all fields for display. Do not create any totals. Modify the labels as
above.
b. Select the predefined Beige template.
Select the Beige template and Finish the Wizard.
c. Run the Web layout to test.
Select Program > Run Web Layout from the menu or select the Run
Web Layout icon from the horizontal tool bar.
d. Save the report as p7q2.jsp.

Oracle Reports Developer 10g: Build Reports A-28

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 8
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports A-29

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 8
1. Open report p8q1_a.jsp, a tabular report showing customer information.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Run the paper layout.
Select Program > Run Paper Layout from the menu or select Run Paper
Layout from the toolbar.
b. In the Data Model view, create a break group using NLS_TERRITORY as
the break column. Rename the group G_COUNTRY.
Click the Data Model button in the toolbar of the Report Editor.
Click and drag NLS_TERRITORY up out of the G_CUSTOMER_ID
group, creating a new group above G_CUSTOMER_ID.
Double-click the group bar to display the Property Inspector for this new
group. Enter G_COUNTRY in the Name property field.
Alternative solution: In the Object Navigator, double-click on the name
to obtain the I-beam, and then edit the name as desired.
c. Reenter the Report Wizard to update the layout. Select the Group Left style.
Ensure that all fields are displayed.
Select Tools > Report Wizard from the menu or the right-mouse-button
menu.
On the Style tab select Group Left.
On the Fields tab, make sure that all fields are listed in the Displayed
Fields area.
Click Finish.
Examine the Web Source and note that is was updated with the new
group information. Locate the <rw:foreach . . .> tag for the
group G_country.
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.
Select the group G_CUSTOMER_ID in the data model and open the
Property Inspector. Set the property Filter Type to First and enter 10 for
the Number of Records property. Run the paper layout.
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.
In the Data Model, right-click the query Q_1, and select Edit Query.
Alternatively, you can also modify the query in the Property Inspector.
Enter WHERE CREDIT_LIMIT > 1500 directly in the query
statement area.
b. Save the report as p8q3.jsp and run the Web layout.

Oracle Reports Developer 10g: Build Reports A-30

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 9
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports A-31

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 9 (continued)
1. Open p8q1_a.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. In the Data Model, create the following query:
QUERY: Q_ORDERS
select customer_id, order_id, to_char(order_date,
'dd-Mon-yyyy') order_date,
order_total
from orders
Open p8q1_a.jsp from the file system. Display the Data Model view of
the Report Editor by double-clicking the Data Model icon in the Object
Navigator.
Select the SQL Query tool and click in the Data Model painter area.
Enter the query as above and click OK.
b. Change the name of the group to G_ORDERS.
Double-click the group bar to display the Property Inspector for new
group. Enter G_ORDERS in the Name property field.
c. Open the Report Wizard, create both a Web and paper layout, and select a
Tabular style.
Invoke the Report Wizard. Make the appropriate selections on the
Report Type and Style pages.
d. Copy group G_ORDERS to the Displayed Groups area.
On the Groups page, select G_ORDERS from the Available Groups area
and click the Down > button.
e. Copy all remaining fields to the Displayed Fields area.
On the Fields page, select all the remaining fields from the Available
Fields area and copy 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 is displayed 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.

Oracle Reports Developer 10g: Build Reports A-32

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 9 (continued)
2. Continue with the same report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. In the Data Model, link the two queries together on the primary and foreign
keys.
Select the Data Link tool. Click and drag from the CUSTOMER_ID
column in the Customer group to the CUSTOMER_ID1 column in the
Orders group.
b. Redo the layout by opening the Report Wizard. Select the Group Above
style.
Do not display CUSTOMER_ID.
Reenter the Report Wizard and make the necessary changes.
c. Save the report as p9q2.jsp.
d. Run the Web layout.
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.
On the Groups page, select NAME and EMPLOYEE_ID in the Available
Fields area and copy them to the Group Fields area, making sure they
are both at the same level.
d. Do not display EMPLOYEE_ID, but display all other fields in the order
described in the table below.
e. Change the following field attributes:

Column Label Width


name Name 15
product Product 15
product_id ID 4
quantity Quantity 4
prod_total Total 5

Modify the lables and widths according to the table above.


f. Use the predefined Gray template.
g. Click Finish to run your paper layout.

Oracle Reports Developer 10g: Build Reports A-33

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 9 (continued)
h. Now you need to show not only which products the sales representatives

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.
Display the Data Model view. Select the SQL Query tool and click in the
painter area. Select Import SQL Query and locate the file p9q3_b.sql.
i. Ensure that the group is named G_CUSTOMER.
j. Link the second query to the correct group.
Select the Data Link tool. Click and drag EMPLOYEE_ID in G_NAME
to SALES_REP_ID in G_CUSTOMER.
k. Use the Report Wizard to display the new group. Display only the
CUSTOMER, CUSTOMER_ID, CUST_TOTAL fields.
Reenter the Wizard and make the requested changes.
l. Change the following field attributes:

Column Label Width


CUSTOMER Customer 15
CUSTOMER_ID ID 2
CUST_TOTAL Total 5

m. Save the report as p9q3.jsp.


n. Run the Web layout.
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.
Select File > New > Report or select the Reports node in the Object
Navigator and click the Create icon. Select the radio button Build a new
report manually.
b. In the Data Model view, create a SQL query. Import the SQL query
p9q4.sql.

Oracle Reports Developer 10g: Build Reports A-34

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 9 (continued)
c. Create an XML Query. For the Data Definition, locate the file

Oracle University Internal and TransAmerica Training Management Inc Partner use only
warehouse_inventory.xsd. For the Data Source, locate the file
warehouse_inventory.xml.
Select the XML Query tool. Click in the painter area of the Data Model
view. Specify the Data Definition by clicking the Browse button and
locating the file warehouse_inventory.xsd. Make sure the file type
selected in the Open dialog box is XSD.
Specify the Data Source by clicking the Browse button and locating 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.
Select the Data Link tool. Click and drag from WAREHOUSE_ID in the
SQL query group to WAREHOUSE_ID1 in the XML query group.
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.
Invoke the Report Wizard. Work through the pages of the Wizard
making the selections as indicated. Click Finish to run the paper layout.
f. Save the report as p9q4.jsp.
g. Run the Web layout.

Oracle Reports Developer 10g: Build Reports A-35

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 9 (continued)
5. Create a new report using a REF cursor query.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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

Create a new report manually. Select the Program Units node in the
Object Navigator and click the Create icon.
In the New Program Unit dialog box, enter RefCur as the name for the
package and choose Package Spec.
Enter the code for the package specification. This code is available in
p9q5a.txt.
PACKAGE RefCur IS
TYPE EmpRec IS RECORD (
last_name employees.last_name%TYPE,
first_name employees.first_name%TYPE,
salary employees.salary%TYPE);
Type EmpCur IS REF CURSOR RETURN EmpRec;
END;
Compile the code and close the PL/SQL editor.
b. In 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
Select the Ref Cursor Query tool and click in the painter area. Define the
following function or copy the code from the text file p9q5b.txt.
function QR_1RefCurDS return RefCur.EmpCur is
V_EmpCur RefCur.EmpCur;
begin
OPEN V_EmpCur
FOR
SELECT last_name, first_name, salary
FROM employees;
RETURN V_EmpCur;
end;
Compile the code and close the PL/SQL editor.
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.

Oracle Reports Developer 10g: Build Reports A-36

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 10
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 may need to include additional columns with summary functions
or even add summaries, such as break totals and report totals. This practice gives you the
opportunity to create summaries and additional columns with functionality that cannot
be achieved using SQL alone.

Oracle Reports Developer 10g: Build Reports A-37

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 10
1. Create a new report using the Report Wizard. Create both a Web and paper layout

Oracle University Internal and TransAmerica Training Management Inc Partner use only
and select a Group Above report style.
a. Select the following columns in the Query Builder:
Table Columns
ORDERS order_id, order_date
ORDER_ITEMS line_item_id, product_id, unit_price, quantity

Hint: Manually edit the query created by Query Builder to modify the
display of order_date using the TO_CHAR function and specify an alias:
TO_CHAR(order_date, dd-Mon-yyyy)Order_Date
b. Modify the query to include line_total as a calculation of
unit_price*quantity.
Enter the formula unit_price*quantity into the query text and
give it an alias name of line_total.
You can also use the Query Builder to create expressions in the query:
Select the table ORDER_ITEMS.
Select Define Column from the toolbar.
Enter Line_Total inside the Defined Columns box.
Enter the expression unit_price*quantity inside the Defined as
box and click OK.
Note: Performing the calculation directly in the query is a better solution
than having a formula column.
c. Group the data on Order ID and Order Date and display all the fields.
Move Order_ID and Order Date to the Group Fields section. Make sure
they are at the same level.
d. Create the following summaries. Can you use the Report Wizard to create the
summaries?
Because this is a single query report, you can use the Report Wizard.
Column Summary
line_total sum
line_total % Total

e. Specify the following labels and widths.

Column Label Width


order_id Ord. No. 4
order_date Order Date 10
line_item_id No. 2
product_id Product No. 5
unit_price Price 4
quantity Quantity 4
line_total Total 4

Oracle Reports Developer 10g: Build Reports A-38

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 10 (continued)
f. Use the Gray template and finish the Wizard.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
In the Template tab choose and apply the template. Finish and run the
report.
g. 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.
Click on ORDER_DATE and drag it above ORDER_ID; be careful not
to drag it outside the group.
Open the Property Inspector for ORDER_DATE and change the Break
Order property to Descending.
h. Run both the paper and Web layouts to test the report (do not reenter the
Wizard).
i. Save the report as p10q1.rdf and close it.
2. Open report p9q3.jsp.
a. Create columns to show the percentage of the total per sales representative
for PROD_TOTAL and CUST_TOTAL.
In the Data Model, select Summary Column in the vertical toolbar and
click inside the group G_PRODUCT. This creates a new summary.
Open the Property Inspector for the new column and name it
PCT_PROD.
In the Summary section select the function % of Total.
The Source is PROD_TOTAL.
Reset at G_PRODUCT.
Compute at G_NAME.
Select Summary Column in the vertical toolbar and click inside the
group G_CUSTOMER. This creates a new summary.
Open the Property Inspector for the new column and name it
PCT_CUST.
In the Summary section select the function % of Total.
The Source is CUST_TOTAL.
Reset at G_CUSTOMER.
Compute at G_NAME.
b. Update the layout. Make all the new summaries four characters wide.
Reenter the Wizard to update the layout. Display the new columns and
ensure each has a width of four.
c. Save the report as p10q2.jsp.
d. Run the Web layout.

Oracle Reports Developer 10g: Build Reports A-39

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 10 (continued)
3. Create a new report to list employees by department ranked by their salaries.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Create both a Web and paper layout and select the Group Left report style.
a. Import the query from p10q3.sql. Select the group field as
DEPARTMENT_NAME and 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.
Edit the query and add ORDER BY EMPLOYEES.SALARY DESC.
d. To display the ranking, add a column call RANK in the group
G_EMPLOYEE_ID.
Create a summary column in the group G_EMPLOYEE_ID.
Name it Rank.
Select the function Count.
The Source is EMPLOYEE_ID.
Reset at G_DEPARTMENT_NAME.
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.
4. Open report p10q1.rdf 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.

Oracle Reports Developer 10g: Build Reports A-40

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 10 (continued)
Hint: You need one formula column and two summaries and two

Oracle University Internal and TransAmerica Training Management Inc Partner use only
placeholders. You can import the code for the formula column from the file
p10q4.txt.
Display the Data Model for the report.
Create two summary columns at the report level :
Name Function Source Reset At
CS_Max Maximum SumLineTotalPerORDER_ID Report
CS_Min Minimum SumLineTotalPerORDER_ID Report

Also at report level create two placeholder columns. Name them


CP_Maxid and CP_Minid. This is where the ORDER_IDs of the highest
and lowest orders will go.
Create a formula column in the G_ORDER_ID group and name it
CF_GetIds.
Return number 1 (although it does not really matter what you return if
the formula column is a character type).
The PL/SQL formula is the following:
function CF_GetIdsFormula return Number is
begin
if :SumLine_TotalPerOrder_Id = :CS_Max then
:CP_Maxid := :ORDER_ID;
end if;
if :SumLine_TotalPerOrder_Id = :CS_Min then
:CP_Minid := :ORDER_ID;
end if;
return (1);
end;
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.
Display columns CS_Max, CS_Min, CP_Maxid, and CP_Minid. Give
them more meaningful labels.
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.

Oracle Reports Developer 10g: Build Reports A-41

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports A-42

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11 (continued)
1. Open report p10q1.rdf. Modify the report as follows:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a header section.
Open the Paper Layout view of the Report Editor. Select Header Section
from the horizontal toolbar or choose View > Layout Section > Header
from the menu. Make sure that you are editing the Body region, not the
Margin.
Display the monitor.jpg file as fixed boilerplate in the Body region.
Select Insert > Image from the menu to insert the file. Move and resize it.
Add a rectangle boilerplate object. Give it fill color.
Select the Rectangle tool from the vertical toolbar. Make the rectangle
large enough to fit the image inside.
Select Fill Color from the vertical toolbar.
Place the image on top of the rectangle. Center the two objects.
Hint: Use the Layout option from the menu.
Select the rectangle and select Layout > Send To Back from the menu.
Select the image, press the [Shift] key, and select the rectangle.
Select Layout > Alignment from the menu. In the dialog box select Align
to Each Other and then Align Center both horizontally and vertically.
Click OK.
Include todays date in the top right portion of the margin.
Select Edit Margin from the horizontal toolbar. Select Insert > Date and
Time from the menu. Select Top-Right as the placement of the date field.
Select any of the formats for the date. Click OK.
b. Add a report title in the body region.
Use Arial bold as the font and 20 as the size.
Click the Text tool from the vertical toolbar and click in the layout area.
Enter the text and click outside the text object.
While the text object is selected, choose font and size from the stylebar.

Oracle Reports Developer 10g: Build Reports A-43

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11 (continued)
c. Add a trailer section that displays todays date with the text End of Report

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 header section of
the report.
Select Trailer Section from the horizontal toolbar, or Select View >
Layout Section > Trailer from the menu. Make sure that you are editing
the Body region.
Click the text tool from the vertical toolbar and click in the layout area.
Enter the text and click outside the text object.
While the text object is selected, select font and size from the stylebar.
Select Edit Margin from the horizontal toolbar. Now select Header
Section.
Select the f_date1 field and then select Edit > Copy from the menu.
Select Trailer Section from the horizontal toolbar. Deselect Edit Margin.
Select Edit > Paste from the menu and move the field to the desired
place.
d. Save the report as p11q1.rdf.
e. Run the Paper Layout. Run the Web layout. What is different?
The paper layout has the header and trailer sections, the Web layout
does not.

Oracle Reports Developer 10g: Build Reports A-44

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11 (continued)
2. Open report p10q1.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the report to add a header section that lists all order numbers, order
dates, and order totals in the body region.
Open the Paper Layout view of the Report Editor. Select Header Section
from the horizontal toolbar, or choose View > Layout Section > Header
from the menu. Make sure that you are editing the Body region.
Select the Report Block tool from the vertical toolbar and click in the
Layout area. In the Report Block Wizard, select a tabular layout.
Select the group G_ORDER_ID and give a print direction down.
Select the fields ORDER_ID, ORDER_DATE, and
SumLinetotalPerOrder_Id.
b. Add Executive Summary as boilerplate text in the margin region of the
header section.
From the horizontal toolbar, choose Edit Margin. Select the Text tool
and create the boilerplate text.
c. Set the distribution for the header section to an HTMLCSS file.
In the Object Navigator, open the Property Inspector for the Header
Section. Select the Distribution property. In the Distribution Dialog box
set the Distribution ID to any string identifier, DESNAME to the
filename that you want, and DESFORMAT to HTMLCSS.
d. Set the distribution for the main section to a PDF file.
In the Object Navigator, open the Property Inspector for the Main
Section. Select the Distribution property. In the Distribution Dialog box
set the Distribution ID, DESNAME, and DESFORMAT fields. Make
sure the output format is PDF.
e. Run and test the report using the Distribute facility in Reports Builder.
Select File > Distribute.
f. Look at the output generated for both file formats.
Locate the files in your file system having the filenames that you
specified in the DESNAME field. Double-click each of them to look at
the output.
g. Save the report as p11q2.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-45

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11 (continued)
3. Open report p11q3.rdf. Modify the report to burst on repeating data, based on

Oracle University Internal and TransAmerica Training Management Inc Partner use only
warehouse ID, and distribute a PDF report for each warehouse.
a. In the Paper Layout view of the Report Editor, select the outermost repeating
frame and delete it.
Invoke the Paper Layout view of the Report Editor. Locate the repeating
frame R_G_WAREHOUSE_ID in the Object Navigator. The repeating
frame is now selected in the Paper Layout. With focus on the Paper
Layout, delete the repeating frame. Be sure you do not delete the frame
from the Object Navigator as this will delete all the objects within the
frame as well.
b. Set the property for the main section of the report to burst on each warehouse
ID.
Select the Main Section node in the Object Navigator. Double-click the
object icon to display the Property Inspector or select Tools > Property
Inspector from the menu.
Locate the Repeat On property and select G_WAREHOUSE_ID from
the drop-down list.
c. Define the distribution for the report. Generate a PDF file for each
warehouse, using the warehouse name as a unique identifier for each PDF
file, such as rptBejiing.pdf.
Select the Distribution property for the Main section. In the Distribution
Dialog box set the Distribution ID, DESNAME, and DESFORMAT
fields. Use warehouse_name in the DESNAME field, for example:
rpt&<warehouse_name>.pdf. Make sure the output format is PDF.
d. Activate the distribution.
Select File > Distribute from the menu.
e. Save the report as p11q3.rdf.
f. Look at the output generated for several of the warehouses.
Locate the files in your file system, for example, rptBeiging.pdf,
rptBombay.pdf and double-click several of them to look at the output.
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.
Select the line tool from the vertical toolbar. Create a line between the
fields. If you want to ensure that the line is vertical, press the [Shift] key
while drawing. In the Property Inspector, set Line Stretch with Frame to
R_G_PRODUCT_ID.
c. Run the Paper Layout to test.
d. Save the report as p11q4.rdf.

Oracle Reports Developer 10g: Build Reports A-46

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11 (continued)
5. Open and run report p2q10.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Using the Paper Design view, compare the output with s11q5a.rdf
from the \Soln directory. What is different? Change the report so that
it looks like s11q5a.rdf.
Both are master detail reports. But in s11q5a.rdf the groups are
intermixed.
b. Fully expand the Paper Layout node for p2q10.rdf.
Select the Paper Layout node for p2q10.rdf. Then select Expand All
in the Vertical toolbar.
c. Open the Paper Layout and move the window to the right. Make sure it
doesnt obscure the Object Navigator window.
d. Move the F_EMPLOYEE field down 2 inches. It should not be enclosed by
any frame.
Select Flex Off and Confine Off in the Horizontal toolbar. Click and
drag the F_EMPLOYEE field down 2 inches. Notice where the field is
being placed in the object hierarchy.
e. Resize the R_G_EMPLOYEE frame so that it only encloses the F_SALARY
and F_JOB_ID fields.
In the Object Navigator, select R_G_EMPLOYEE. In the Paper Layout,
resize the frame.
f. Resize the M_G_EMPLOYEE_GRPFR frame so that it encloses the
R_G_EMPLOYEE repeating frame.
In the Object Navigator, select M_G_EMPLOYEE_GRPFR. In the
Paper Layout, resize the frame.
g. Move the F_DEPARTMENT_NAME and F_DEPARTMENT_ID fields to
the right.
Click and drag the fields to the right.
h. Create a new repeating frame in the free space. Set the Line color attribute to
No line.
Select Repeating Frame form the Vertical toolbar. Click and drag an
area in the space previously occupied by F_DEPARTMENT_ID and
F_DEPARTMENT_NAME.
Using the Line Color palette, set the line color to No Line.
Note: Ensure that the new repeating frame R_1 is at the same level as
M_G_EMPLOYEE_GRPFR. Use the Object Navigator to verify this.

Oracle Reports Developer 10g: Build Reports A-47

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 11 (continued)
i. Link the repeating frame to the G_EMPLOYEE group.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Open the Property Inspector for the new repeating frame and set the
Source property to G_EMPLOYEE.
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?
A run-time error occurs as the F_EMPLOYEE field is at the wrong
hierarchy level, meaning not enclosed by the right parent object.
l. Fix the layout hierarchy error.
Select F_EMPLOYEE, the from the menu select Layout > Bring to
Front.
The field is now enclosed by R_1.
m. Rearrange the column headers.
Click and drag the column headers to match the column positions.
n. Run the paper layout.
The two data groups are now intermixed.
o. Close the report. Save as p11q5a.rdf.

Oracle Reports Developer 10g: Build Reports A-48

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 12
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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.

Oracle Reports Developer 10g: Build Reports A-49

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 12
1. Create a new break report showing each customer and the relevant orders.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a group above master detail report. Use the query p12_1.sql to
create the report.
In the Report Wizard, select the Group Above report style and use
Import SQL Query.
b. Select Name as the group field and display all the customer data in the break
group. Create a sum for the quantity.
The break group should contain all the fields from the CUSTOMERS
table. Create totals by using the Sum function on the quantity column.
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

d. Run the paper layout. What do you see?


Some of the customer master records print without their detail order
information on the same page.
e. Ensure that no customer data displays on a page without details.
Open the Property Inspector for the repeating frame and set the Page
Protect property to Yes.
f. Save the report as p12q1.rdf.
g. Run the paper layout again to test.

Oracle Reports Developer 10g: Build Reports A-50

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 12 (continued)
2. Create a new tabular report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
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 reports 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. Move the rectangle behind the
image to create the effect of a colored border around the image.
In the Paper Layout, select Edit Margin. Select the Your Company, Inc.
logo and delete it.
Select the margin rectangle. Using the central handle on the top edge,
size the margin to 1.75 inches.
Then from the menu, select Insert > Image and browse for
dinner1.bmp. Click OK.
From the vertical toolbar, select Rectangle.
Click and drag a rectangle around the image. Give it a solid fill. From
the menu, select Layout > Send to Back.
c. When you click on the image in HTML output you want to open a local
.pdf file named mousse.pdf.
Open the Property Inspector for the image and set the hyperlink
property to 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.
Save the report. Select File > Generate to File > Paginated HTMLCSS.
Start your browser, open the file, and click on the image.

Oracle Reports Developer 10g: Build Reports A-51

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 13
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modifying the printing of a mailing label report
Controlling the number of records on a page
Adding a link file 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 link file to display a company logo by dynamically referencing a file at run
time.

Oracle Reports Developer 10g: Build Reports A-52

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 13
1. Open report p4q4.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the layout so that the mailing labels are 2 inches wide and 1 inch
high. Use the Layout option on the menu. Ensure that the customer names are
printed in alphabetical order across the page.
Open the Paper Layout view of the Report Editor and select the
repeating frame. From the menu, select Layout > Size Objects. Select
Custom for both width and height and enter the size in the fields. You
can also drag and resize the repeating frame in the Paper Layout.
Add an ORDER BY clause to the query to sort the labels on
cust_last_name.
b. Give each label a solid fill.
Select Fill Color from the vertical toolbar and select a color.
c. Make the boilerplate object 1.8 inches wide and center it horizontally and
vertically in the repeating frame.
Select the boilerplate object in the Paper Layout and choose Layout >
Size Objects from the menu. Select Custom for the width and No Change
for the height. Enter the width in the field below.
Select both the boilerplate object and the repeating frame and choose
Layout > Alignment from the menu. Select Align to Each Other, and
then Align Center, both horizontally and vertically.
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.
Select the repeating frame and open its Property Inspector. Set Horiz.
Space Between Frames to .25 and Vert. Space Between Frames to .5.
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.
Select the repeating frame and open its Property Inspector. Set
Maximum Records per Page to 6.
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.
Ask your instructor for help if needed.

Oracle Reports Developer 10g: Build Reports A-53

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 13 (continued)
b. Delete the logo in the margin area and create a file link in its place to display

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the contents of logo.tif.
Select Edit Margin from the horizontal toolbar. Select the logo
boilerplate and press [Delete]. Select the File Link tool from the vertical
toolbar and create an external boilerplate object in the margin region
where the logo was. Set the following properties:

Property Value
Name B_logo
Source File Format Image
Source Filename 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.
Select Edit Margin from the horizontal toolbar. Open the Property
Inspector for the repeating frame R_G_ORDER_ID and set the property
Page Protect to Yes.
b. Save the report as p13q4.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-54

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 14
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Adding dynamic content to an existing Web page to create a Reports JSP
Customizing a Web report using JSP tag attributes
Introduction
In this practice, you will create a Web report by adding dynamic report data to an
existing HTML page. You will also customize the Web report by using JSP tag
attributes.

Oracle Reports Developer 10g: Build Reports A-55

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 14
1. Create a new Web report by adding dynamic content to an existing Web page.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Open the file mywebpage.htm in Reports Builder.
b. Define a data model using the Data Wizard. Import the query p14q1.sql.
Use DEPARTMENT_ID and DEPARTMENT_NAME as the group fields.
Include a sum of the salaries.
Display the Data Model view of the Report Editor. Right-mouse-click in
the Data Model painter area and select Data Wizard from the menu.
Select SQL Query on the Data Source page.
Import the query p14q1.sql.
Copy department_id and department_name from the Available
Fields area to the Group Fields area. Be sure both columns are at the
same level (Level 1).
Select the salary column and click Sum >.
Click Finish to complete the Data Wizard.
c. Save the report as p14q1.jsp.
d. Create a report block and add it to the Reports JSP. The Web source code has
a place holder for your report block. Choose the Group Left style and include
a title Salaries by Department. Include all groups and display in the down
direction. Display all fields. Use a label of Name for
DEPARTMENT_NAME and Title for JOB_ID. Select the predefined Beige
template.
Display the Web Source view of the Report Editor by double-clicking on
the object icon for the Web Source in the Object Navigator.
Scroll through the code until you locate the placeholder Insert your
report block here.
With your cursor in that position, select Insert > Report Block from the
menu.
Select the style Group Left and enter Salaries by Department in the title
field.
Select the group G_department_id and click Down >.
Select the group G_Employee and click Down >.
Copy all the columns from the Available Fields area to the Displayed
Fields area.
On the labels page, make the appropriate changes.
Select the Beige template. Click Finish.
e. Run the Web layout to test. Save the report.

Oracle Reports Developer 10g: Build Reports A-56

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 14 (continued)
2. Customize report p14q1.jsp using JSP tag attributes.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Display the salary and summary values with an appropriate currency format.
Display the Web Source view of the Report Editor. Locate the rw:field
tag for F_SALARY and add the formatMask attribute:
<rw:field id="F_salary" src="salary"
nullValue="&nbsp;" formatMask="$999,999.00">.
Locate the rw:field tag for F_SumsalaryPerdepartment_id and add the
same format mask attribute:
<rw:field id="F_SumsalaryPerdepartment_id...
"formatMask="$999,999.00">
Locate the rw:field tag for F_SumsalaryPerReport and apply the same
formatMask attribute.
b. Run the Web layout to test. Did you remember to format the report
summary? Save the report as p14q2.jsp.

Oracle Reports Developer 10g: Build Reports A-57

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 15
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Running a report using an XML definition
Applying an XML report definition to an existing .rdf file
Introduction
Using XML you can build fully functional reports or partial reports that can serve as a
customization file.
You will run an XML file and apply an XML definition to an existing report.

Oracle Reports Developer 10g: Build Reports A-58

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 15 (continued)
1. Run an XML report definition.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Open p15q1.xml using Wordpad. Examine the code. What type of report
definition is this? What goes on in this file?
It is a full XML report definition with both a fully functional data model
and layout. It builds a two query group above report. It creates a data
link between the two queries and a summary column in the master
group. It uses the template rwbeige.tdf, but overrides the formatting
for the F_SAL field through a formatting exception.
b. Execute p15q1.xml using the Run Paper Layout option in Reports Builder.
Open p15q1.xml in Reports Builder and select Program > Run Paper
Layout from the menu or use the Run Paper Layout icon from the
toolbar.
2. Apply run-time customizations.
a. Open p15q2.rdf. Run the paper layout.
b. What type of report is this? Investigate the data model, the paper layout, and
the report sections.
It is a simple tabular report. There is nothing in the Header and Trailer
sections. There are no summary fields, and no data formatting.
c. Open p15q2.xml. Examine the code. What goes on in this XML definition
file?
It has a data source that is different from what is in the p15q2.rdf
report. The data is going to be formatted in the header section. In the
main section it has a formatting specification for the SALARY column in
the main section.
d. Apply p15q2.xml to p15q2.rdf using the RWRUN command and send
the output to a PDF file.
Specify the following command in the Command Prompt window:
RWRUN report=p15q2.rdf customize=p15q2.xml
destype=file desformat=PDF desname=myreport.pdf
userid=<username>/<password>@<database>
e. Examine the newly created report output. What do you see?

Oracle Reports Developer 10g: Build Reports A-59

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 16
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Modifying an existing report to use a bind parameter
Adding a dynamic list of values
Adding a lexical parameter
Adding a static list of values
Creating a customized parameter form
Introduction
In this practice session, you create bind and lexical parameters to restrict records in the
report. You add lists of values to select valid values at run time.
You then create your own default parameter form and customize it to include extra text
and graphics.

Oracle Reports Developer 10g: Build Reports A-60

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 16
1. Open report p13q3.rdf.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the data model and add the following columns from the
CUSTOMERS table. Create a new group for the customer information above
the G_ORDER_ID group.
Column Label Width
cust_first_name || || cust_last_name Name 30

cust_email Email 20

Create a reference to a bind parameter P_CUSTOMER in the query to restrict


orders to the parameter value you input at run time.
Note how Reports creates the parameter automatically.
Add the following to the WHERE clause of the query:
AND customers.customer_id =:p_customer
b. Run and test the report with valid customer IDs.
Choose any number in the range 101 to 170.
c. Save the report as p16q1.rdf. Do not close it.
2. Continue with report p16q1.rdf.
a. Add a list of values to select any valid CUSTOMER_ID in the
CUSTOMERS table that has an order in the ORDERS table. Do not allow
users to enter any other value. The list should display customer names, not
CUSTOMER_ID numbers. Ensure that each customer name appear only
once in the list, even if the customer has several orders.
In the Object Navigator, expand the Data Model node and the User
Parameters node.
Open the Property Inspector for the P_CUSTOMER parameter and
make sure that the datatype is Number.
In the parameter Property Inspector, select List of Values.
In the dialog box, choose Select Statement.
Make sure that the Restrict List to Predetermined Values check box is
selected.
Select the Hide First Column check box.
Enter the following statement in the Enter Query area:
select unique c.customer_id, c.cust_first_name ||
'|| c.cust_last_name Name
from customers c, orders o
where c.customer_id = o.customer_id

Oracle Reports Developer 10g: Build Reports A-61

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 16 (continued)
b. Save the report as p16q2.rdf. Do not close it for the moment.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
c. Run the paper layout to test the report. Run the Web layout as well.
3. Open report p5q3.rdf.
a. Create a lexical parameter to enable users to order the data by different
columns (or not at all) at run time. Include an ORDER BY clause in the
query with a lexical reference to the parameter. Enter an initial value for the
parameter to order by the employees last name.
In the Object Navigator, expand the Data Model node. Double-click the
User Parameters node to create a parameter.
Select the parameter name P_1 and change it to P_ORDER.
Open the parameter Property Inspector.
Make sure that the datatype is Character and increase the width to 50.
Enter an Initial Value:
ORDER BY employees.last_name
In the Data Model, open the query Property Inspector and add the
following lexical reference to the end of the query:
&P_ORDER
b. Add a static list of values for the parameter P_ORDER. Code two or three
alternative ORDER BY clauses. Allow any clause to be entered at run time.
Display the Property Inspector for the parameter P_ORDER and select
List of Values.
In the dialog box choose Static Values and enter other ORDER BY
clauses in the Value field; for example:
ORDER BY employees.last_name
ORDER BY employees.job_id
For each value, remember to select Add>> to add the value to the list.
Clear the Restrict List to Predetermined Values check box.
c. Run the paper layout to test.
Select an ORDER BY clause from the list.
Enter your own ORDER BY clause.
Delete the initial parameter value.
d. Save the report as p16q3.rdf and close it.
4. Continue with report p16q2.rdf.
a. Create a default parameter form.
Include a Title message but not a Hint message.
Display the P_CUSTOMER parameter.
Select Tools > Parameter Form Builder from the menu.
Enter your own Title message. Delete the Hint message.
Select P_CUSTOMER.

Oracle Reports Developer 10g: Build Reports A-62

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 16 (continued)
b. Use your imagination to customize the form in the Parameter Form editor.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Make sure that the parameter P_CUSTOMER is placed in a prominent
position for user entry.
Add some graphics; modify colors and fill patterns.
No formal solution.
c. Add a format mask to the field displaying line_total.
Open the Property Inspector for F_LINE_TOTAL. In the Format Mask
property, select one of the masks, such as $<N,NNNN.00>.
d. Run the paper layout to test. Select a customer from the list.
e. Save the report as p16q4.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-63

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 17
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Using the Graph Wizard to create a graph in an existing report
Altering the graph with the Graph Wizard
Creating graphs in an existing report that will be printed once for each record of a
group
Creating a graph for a Web report
Customizing a graph for a Web report
Introduction
In this practice session you open existing reports to add graphs using the Graph Wizard.
You reenter the Graph Wizard to change the characteristics of a graph. You will also
add and customize a graph in a Web report.

Oracle Reports Developer 10g: Build Reports A-64

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 17
1. Open report p17q1a.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Run the paper layout to become familiar with the report.
b. Rename SumCust_totalPersales_rep_id to Total_Sales (a shorter, more
meaningful name looks better in a chart).
Display the Data Model and open the Property Inspector for
SumCust_totalPersales_rep_id to change the name. Alternatively,
change the summary field name in the Object Navigator > Data Model >
Groups node.
c. Use the Graph Wizard to create a bar chart.
In the Paper Layout, select Insert > Graph from the menu and enter the
following properties on the Wizard pages:

Graph Type Bar


Graph Subtype Bar
Position at the end of the report
Category sales_rep_id
Data total_sales

In the layout page of the Graph Wizard, drag sales_rep_id from the
Groups section to the Bars section.
d. Run the paper layout to test. Resize the graph in the Paper Layout, if
necessary.
e. Save report as p17q1.jsp.
2. Reenter the Graph Wizard to change the characteristics of the graph created in the
previous exercise.
In the Paper Layout view, make sure that the graph is selected; otherwise you
will create a new graph.
Select Graph Wizard from the right-mouse menu.
a. Give the graph the following characteristics:
Enter the following properties in the Wizard pages:

Title Order Total per Sales Rep


Graph Type Horizontal Bar
Graph Subtype Bar

Click OK.
b. Run the paper layout to test.
c. Save report to p17q2.jsp.

Oracle Reports Developer 10g: Build Reports A-65

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 17 (continued)
3. Continue with report p17q2.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Run the Web layout. What do you see?
There is no graph displayed in the Web output because you have not yet
added it to the Web source.
Also, an error message displayed: Cannot find cursor containing column
"SumCust_totalPersales_rep_id" because the name of the summary
column was changed in the Data Model but not in the Web source.
b. Update the Web source with the correct column name.
Display the Web Source view. Locate the reference for <rw:field
id="F_SumCust_totalPersales_rep_id"...>. Edit the source
attribute for this field to src="Total_Sales".
c. Run the Web layout again to test.
d. Add a graph to the Web source. Position the graph at the beginning of the
report.
Display the Web Source view. Scroll down the code and position your
cursor just before the Data Area Generated by Reports Developer.
Select Insert > Graph from the menu and enter the following properties
on the Wizard pages:.

Graph Type Bar


Graph Subtype Bar
Category sales_rep_id
Data total_sales
Title Order Total per Sales Rep

On the layout page of the Graph Wizard, be sure to drag sales_rep_id


from the Groups field to the Bars field.
e. Run the Web layout to test. Save the report as p17q3.jsp.

Oracle Reports Developer 10g: Build Reports A-66

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 17 (continued)
4. Open report p9q3.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Use the Graph Wizard to create a pie chart for the data group G_PRODUCT.
Invoke the Graph Wizard with the focus on the Paper Layout.
Display the Paper Layout view of the Report Editor. Select Insert >
Graph from the menu, and enter the following properties on the Wizard
pages:

Graph Type Pie


Graph Subtype Pie
Graph Position Once per Name
Data Group G_PRODUCT
Category product_id
Data prod_total

On the layout page of the Graph Wizard, be sure to drag product_id


from the Groups field to the Slices field.
b. In the Paper Layout, ensure that the graph is positioned beneath the product
group.
If necessary, select the chart and drag it below the product group frame.
You must enable Flex Mode. Do not forget to turn it off again when you
have finished.
c. Run the paper layout and test the report.
d. Save the report as p17q4.jsp.
5. Continue with report p17q4.jsp.
a. Add a bar graph to the Web source for the data group G_PRODUCT. Use the
same data group, category, and value settings as in the previous exercise.
Hint: You want to insert the graph just before the termination of the
rw:foreach tag for the group G_NAME.
Display the Web Source view. Locate the <rw:foreach...> tag for the
G_NAME group. You can use Edit > Find and Replace from the menu to
help you locate G_NAME. Scroll down in the code until you come to the
corresponding termination tag </rw:foreach>. The indented nature of
the code will help you identify the correct tag.
With you cursor just before the tag, select Insert > Graph from the
menu.
Select a chart type of Bar. Use the table from the previous exercise to set
the other values in the Wizard.

Oracle Reports Developer 10g: Build Reports A-67

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 17 (continued)
b. Run the Web layout to test. Ensure that a graph displays for each sales

Oracle University Internal and TransAmerica Training Management Inc Partner use only
representative.
c. Resize the graph to a width of 800 and a height of 450.
Display the Web Source view. Locate the rw:graph tag. Add width and
height settings to the attribute list: <rw:graph id="graph
src="G_PRODUCT" groups="PRODUCT_ID
dataValues="PROD_TOTAL" width="800" height="450">
d. Save the report as p17q5.jsp. Run the Web layout to test.

Oracle Reports Developer 10g: Build Reports A-68

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 18
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Opening and changing an existing matrix report
Building a nested matrix report
Adding summaries to the nested matrix report
Displaying zeros for summary values and restricting the number of columns per
page
Displaying more meaningful column information and rotating the text
Introduction
In this practice session, you use an existing matrix report to investigate the different
methods of displaying the cell values and the implications. You use an existing SQL
query to create a nested matrix report. You then add row- and column-level summaries
to the report and display zeros for null values.
If you have time, include the product names instead of the product IDs and rotate the
names.

Oracle Reports Developer 10g: Build Reports A-69

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 18
1. Open report p4q6.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. How many repeating frames do you have?
There are two repeating frames, R_G_NAME and R_G_PRODUCT_ID.
b. Change the properties of the cell object to display zero for a null value.
Open the Property Inspector for F_SumTOTAL_VALUE and set Value
if Null to 0.
c. Run the paper layout to test the report.
All cells without a value now display 0.
d. Close the report without saving it.
2. Create a new report, importing the query p4q6.sql from your working
directory.
Select File > New > Report from the menu, or open a new report in the Object
Navigator. Use the Report Wizard.
a. Select the following settings:

Report Style Matrix


Query Import Query p4q6.sql
Matrix Row Fields Level 1 - month
Level 2 - name
Matrix Column Fields product_id
Matrix Cell Fields Sum of total_value
Matrix Totals Sum of (Sum of total_value)

b. Change the labels and widths for the following fields:

Field Label Width


name Customer 10

product_id Product 5

month Month 4

SumTotal_value Total 5

All Summaries Total: 5

Select a template and finish the Wizard.

Oracle Reports Developer 10g: Build Reports A-70

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 18 (continued)
c. Increase the width of the Main Section of the report to 17 inches.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Open the Property Inspector for the Main Section of the paper layout.
Set the Width property to 17.
d. Save the report as p18q2.jsp. Run the paper layout.
e. Which summaries were created?
SumTOTAL_VALUEPerName
SumTOTAL_VALUEPerPRODUCT_ID
SumTOTAL_VALUEPerReport
These are the row, the column, and the report summaries.
f. Use the Data Model view to create summaries for each month and for the
level month and product.
In the Data Model, click the Summary Column button in the tool palette
and click inside the cross product group G_SumTOTAL_VALUE.
Repeat the steps for the second summary column.

Use the following settings for the two summary columns:

Property Value
Name SumMonth
Product Order G_MONTH
Function Sum
Source SumTOTAL_VALUE
Reset At G_MONTH

Property Value
Name SumMonthProduct
Product Order G_MONTH G_PRODUCT_ID
Function Sum
Source SumTOTAL_VALUE
Reset At G_PRODUCT_ID

Oracle Reports Developer 10g: Build Reports A-71

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 18 (continued)
g. Use the Paper Layout view to create the fields. You must expand the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
appropriate repeating frame.
Select and expand R_G_MONTH. You must enable Flex Mode. Do not
forget to disable it again when you have finished.
Select the Field tool from the vertical toolbar.
Create a field below F_SumTOTAL_VALUE. Position the field in the
R_G_MONTH and the R_G_PRODUCT_ID repeating frames.
Set the following properties:

Property Value
Name F_SumMonthProduct
Source SumMonthProduct

Select the Field tool from the vertical toolbar.


Create a field below F_SumSumTOTAL_VALUEPerNAME. Position
the field in the R_G_MONTH repeating frame but outside any other
repeating frames.
Set the following properties:

Property Value
Name F_SumMonth
Source SumMonth

h. Run the paper layout to test the report.


i. Save the report as p18q2.jsp. Do not close it.
3. Continue with the report from the previous exercise.
a. Add zeros for null values in the cells.
Open the Property Inspector for F_SumTOTAL_VALUE and set Value
if Null to 0.
b. Ensure that the report shows only three product columns on each page.
Open the Property Inspector for R_G_PRODUCT_ID and set Maximum
Records per Page to 3.
c. Format all numeric data to be right aligned.
Use the style bar.
d. Add commas and two decimal places where appropriate.
Use the style bar.
e. Run the paper layout to test the report.
f. Save the report as p18q3.jsp and close it.

Oracle Reports Developer 10g: Build Reports A-72

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 18 (continued)
If You Have Time

Oracle University Internal and TransAmerica Training Management Inc Partner use only
4. Open the report as p18q3.jsp.
a. Make the necessary changes in the Data Model view to include the product
name.
Use the right mouse button and click Edit Query.
The query in the SQL Query Statement dialog box should read:
SELECT C.CUST_FIRST_NAME || ' ' || C.CUST_LAST_NAME
Name,
I.PRODUCT_ID,
SUM(I.UNIT_PRICE * QUANTITY TOTAL_VALUE),
TO_CHAR (O.ORDER_DATE, 'MM/RR') MONTH,
P.PRODUCT_NAME PRODUCT
FROM CUSTOMERS C, ORDER_ITEMS I, ORDERS O,
PRODUCT_INFORMATION P
WHERE I.PRODUCT_ID LIKE '1%
AND O.CUSTOMER_ID = C.CUSTOMER_ID
AND I.ORDER_ID = O.ORDER_ID
AND P.PRODUCT_ID = I.PRODUCT_ID
GROUP BY C.CUST_FIRST_NAME || ' ' ||
C.CUST_LAST_NAME,
I.PRODUCT_ID,
TO_CHAR (O.ORDER_DATE, 'MM/RR'),
P.PRODUCT_NAME
b. In the Paper Layout view, delete the product_id field and insert a boilerplate
object to display the product name. Rotate this object by 90 degrees.
Note: You may have to expand the R_G_PRODUCT_ID frame and the
outermost frame. Watch out for frequency errors.
Select F_PRODUCT_ID and press [Delete].
Select the Text tool from the vertical toolbar and create a text object in
the place of the F_PRODUCT_ID field.
Enter: &PRODUCT.
Select the boilerplate object.
Select the Rotate tool from the vertical toolbar.
Press [Shift] and click the boilerplate object to rotate it by 90 degrees.
Open the Property Inspector for the boilerplate object and set Vertical
and Horizontal Elasticity to Variable.
Open the Data Model view and ensure that the G_PRODUCT_ID group
contains the PRODUCT column by dragging it in there.
c. Run the paper layout. Save the report as p18q4.jsp.

Oracle Reports Developer 10g: Build Reports A-73

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 19
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating a format trigger to conditionally display different layouts
Creating and use a report-level PL/SQL function
Creating and use an external PL/SQL library
Creating a PL/SQL group filter
Introduction
In this practice session, you create a format trigger to conditionally flag one of two
paper layouts for the same data. You also conditionally flag some records in a report by
creating and referencing a report-level (local) PL/SQL function. You then move the
code into a new PL/SQL library and alter the reference to use the library function
instead.
If you have time, restrict the number of records processed in a report by creating your
own group filter.

Oracle Reports Developer 10g: Build Reports A-74

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 19 (continued)
1. Create a new report, using p19q1.sql.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Display the records in two different layouts, showing different columns in
each.
b. Create a Group Above layout using the following columns from the query:
Select Group Above as the report style in the Report Wizard.
Import the SQL Query from file p19q1.sql.
Select customer_id as the group field. Do not display order_status. Select
Labels and other properties as you wish.
Group Column
G_CUSTOMER_ID customer_id
G_ORDER_ID order_id
order_date
order_mode
order_total

c. Create a Tabular layout using the following columns from the query:
In the Paper Layout view, select the Report Block tool from the vertical
toolbar or using Insert > Report Block from the menu.
Select the G_order_id group and click the Down button. Display the
following fields. Select Labels and other properties as you wish.

Column
order_id
order_date
order_total

d. Create a user parameter, user_type, that has two possible values: Sales
Representative and Sales Clerk.
In the Object Navigator, select the User Parameters node and click the
Create icon.
Open the Property Inspector for the parameter. Enter USER_TYPE in
the Name property.
Ensure the Datatype property is set to Character.
Create a static list of values containing Sales Representative and
Sales Clerk.

Oracle Reports Developer 10g: Build Reports A-75

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 19 (continued)
e. Ensure that only the Group Above layout is displayed when the user type is

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Sales Representative, and that only the Tabular layout is displayed when the
user type is Sales Clerk.
To create a format trigger on the M_G_CUSTOMER_ID_GRPFR
group, select the frame in the first layout, open the Property Inspector
and select the Format Trigger property. An alternative way of creating a
format trigger is to select the group in the Object Navigator, right-click
and select the PL/SQL Editor menu option.
function M_G_CUSTOMER_ID_GRPFRFormatTri return
BOOLEAN is
begin
if :user_type = 'Sales Representative' then
return(true);
else
return(false);
end if;
end;
Create a format trigger on the M_G_ORDER_ID_GRPFR1 group frame
in the second layout with the reverse logic:
function M_G_ID_GRPFR1FormatTri return BOOLEAN is
begin
if :user_type = 'Sales Clerk' then
return(true);
else
return(false);
end if;
end;
Note: You can implement the same logic using the Conditional
Formatting property in the Property Inspector for both the group
frames.
To test the result, display the USER_TYPE parameter in the margin of the
report.
Display the Paper Layout view and select Edit Margin. Create a field. In
the Property Inspector, specify the source as USER_TYPE.
Make sure that you can enter a parameter value at run time.
Select Tools > Parameter Form Builder from the menu and select
USER_TYPE from the Parameter list. Click OK to create the Paper
Parameter Form.
Test the report by changing the User Type parameter on the Runtime
Parameter Form.
f. Save the report as p19q1.rdf.

Oracle Reports Developer 10g: Build Reports A-76

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 19 (continued)
2. Continue with the previous report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Modify the report so that the Tabular (Sales Clerk) layout displays an extra
column that indicates, with an asterisk, those orders that have an order status
of 5.
Create a new Program Unit, by using the Program Units node in the
Object Navigator. Create a function called ASTERISK:
function asterisk(ostatus number)
return varchar2 is
begin
if ostatus = 5 then
return('*');
else
return('');
end if;
end;
In the Data Model view, create a formula column in the detail group
G_ORDER_ID.
Open the Property Inspector and alter the following properties for the
column CF_ASTERISK:
Name Datatype Width
CF_ASTERISK Character` 1

Click PL/SQL Formula to open the PL/SQL editor, and call the
ASTERISK function from the formula.
function CF_asteriskFormula return varchar2 is
begin
return(asterisk(:order_status));
end;
In the Paper Layout view, increase the width of the R_G_ORDER_ID
repeating frame in the second layout to allow room for another field.
Create a field inside the repeating frame, rename it F_CF_ASTERISK,
and source it to CF_ASTERISK.
b. Remember to change user type to Sales Clerk during testing.

Oracle Reports Developer 10g: Build Reports A-77

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 19 (continued)
c. Move the function code into a new PL/SQL library named p19lib.pll.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
In the Object Navigator, select the PL/SQL Libraries node and click the
Create icon to create a new library.
Open the library node and click and drag the ASTERISK function into
the Program Units node below the library.
Save the PL/SQL library as a file with the name P19LIB.PLL.
Delete the report-level ASTERISK function.
To attach the library to the report, click the Attach Library node in the
Object Navigator. Click the Create button. In the Attach Library dialog
box, use the Browse button to locate the .pll file. Click the Attach button.
In the warning dialog box, click Yes to remove the path for the attached
library.
Recompile the formula column, CF_ASTERISK.
d. Run the report.
The report that was previously calling the report-level function will now
call the external function.
e. Save the report to p19q2.rdf.
3. Continue with the previous report.
a. Modify the same layout to display additional spacing between every two
records.
In the Data Model view, create a summary column in the G_ORDER_ID
group to keep a running total of records.
Name Function Source Reset At

COUNT_ORD COUNT order_id Report

In the Paper Layout view, increase the height of the repeating frame for
the second layout. Remember to switch Flex mode on, so that you can
increase the repeating frame and the group frame together.
Open the repeating frame Property Inspector and change the Vertical
Elasticity to Variable.
Select the rectangle tool and click and drag an area inside the repeating
frame, below the fields. Make sure the rectangle is transparent: no fill,
no line.
In the Object Navigator, rename the rectangle to B_space and create the
following format trigger:
function B_spaceFormatTrigger return boolean is
begin
if mod(:count_ord,2) = 0 then return(TRUE);
else return(FALSE);
end if;
end;
b. Save the report as p19q3.rdf and close it.

Oracle Reports Developer 10g: Build Reports A-78

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 19 (continued)
If You Have Time

Oracle University Internal and TransAmerica Training Management Inc Partner use only
4. Open report p19q1.rdf.
a. Write your own group filter to restrict the number of customers displayed,
depending on the value of a parameter that you enter at runtime.
Hint: You need to create two parameters, to keep track of how many records
have been processed, compared to the cutoff number of records required.
Make sure that you can enter the cutoff parameter at run time.
In the Object Navigator, open the Data Model node, and select the User
Parameters node select the Create icon to create the first parameter.
Select the Create icon to create a second parameter.
Rename the parameters P_COUNT_CUST and P_CUTOFF.
Give P_COUNT_CUST an initial value of 0.
Open the G_CUSTOMER_ID group Property Inspector.
Set Filter Type to PL/SQL
Select PL/SQL Filter to open the PL/SQL editor.
Enter the following code:
function G_CUSTOMER_IDGroupFilter return boolean
is
begin
:p_count_cust := :p_count_cust + 1;
if :p_count_cust <= :p_cutoff then
return(TRUE);
else
return(FALSE);
end if;
end;
Display the Paper Parameter Form and include a parameter form field
PF_cutoff along with descriptive text.
b. Test the report several times by changing the cutoff parameter at run time.
c. Save the report as p19q4.rdf.

Oracle Reports Developer 10g: Build Reports A-79

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 20
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Building a report containing conditional highlighting
Modifying a Web report with conditional highlighting
Executing a detail report from a master report
Writing to a temporary table from a report
Introduction
In this practice session, you highlight values based on conditional PL/SQL code.
You build a master report that enables you to call a detail report and generate a separate
PDF file for each detail report.
If you have time, you add report-level triggers to an existing report to write messages to
a temporary table at various stages of report execution.
Write PL/SQL functions as local PL/SQL (report-level), and reference the code in a
condition within the relevant object trigger in the report.

Oracle Reports Developer 10g: Build Reports A-80

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20
1. Open report p9q3.jsp.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Display the column CUST_TOTAL in the customer group as red, bold italics
if its value is 10,000 or more.
Hint: Check the Help system for the SRW.SET <attributes> or use
conditional formatting.
Mask Attribute Suggested Value
SRW.SET_TEXT_COLOR Red
SRW.SET_FONT_WEIGHT SRW.BOLD_WEIGHT
SRW.SET_FONT_STYLE SRW.ITALIC_STYLE

You can copy the code from the file p20q1a.txt.


Open the PL/SQL editor and create a function to apply the format
attributes. Click the Tools >PL/SQL Editor menu option. In the
Program Unit dialog box, click the New button, specify the name of the
function, select the Function option button and click OK.
function FIELD_MASK return boolean is
begin
srw.set_text_color('red');
srw.set_font_weight(srw.bold_weight);
srw.set_font_style(srw.italic_style);
return(TRUE);
end;
b. Alter the pattern and color of those records where the customer total is 5,000
or less.
Hint: Check the Help system for the SRW.SET <attributes> or use
conditional formatting.

Attribute Suggested Values


Fill pattern Crisscross, sandpaper
Foreground fill color Yellow
Background fill color Green

You can import the file p20q1b.txt.


Open the PL/SQL editor and create a function to apply the format
attributes.
function RECORD_MASK return boolean is
begin
srw.set_foreground_fill_color('yellow');
srw.set_background_fill_color('green');
srw.set_fill_pattern('crisscross');
return(TRUE);
end;
Oracle Reports Developer 10g: Build Reports A-81

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20 (continued)
c. Write the necessary format triggers.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Create a format trigger on the F_CUST_TOTAL field to call the
function.
function F_CUST_TOTALFormatTrigger return
boolean is
begin
if :cust_total >= 10000 then
return(field_mask);
else
return(TRUE);
end if;
end;
Create a format trigger on the R_G_CUSTOMER repeating frame to
call the function.
function R_G_CustomerFormatTrigger return
boolean is
begin
if :cust_total <= 5000 then
return(record_mask);
else
return (TRUE);
end if;
end;
d. Save the report as p20q1.jsp.
e. Run the paper layout.
2. Continue with the same report.
a. Run the Web layout for the report. Is there formatting on the CUST_TOTAL
column?
There is no formatting in the Web layout. The format triggers that you
created in the previous exercise were applied to the paper layout objects
only.
b. Modify the Web source so that the column CUST_TOTAL in the customer
group displays as red, bold italics if its value is 10,000 or more.
Display the Web Source view.
Locate the rw:field tag for F_CUST_TOTAL. Use Edit > Find and
Replace and search for F_CUST_TOTAL.
Add the formatMask attribute to the rw:field tag and set its value to
F_CUST_TOTALFORMATTRIGGER:
<rw:field id="F_Cust_total" src="Cust_total"
nullValue="&nbsp;"
formatTrigger="f_cust_totalformattrigger">
c. Save the report as p20q2.jsp.
d. Run the Web layout to test.

Oracle Reports Developer 10g: Build Reports A-82

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20 (continued)
3. Execute a detail report from a master report.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
a. Create a simple tabular report called MGR_MASTER. The report should
query last names and employee IDs for those employees who are managers.
Display all fields. You can use the query:
SELECT distinct manager.last_name Manager,
manager.employee_id
FROM employees worker, employees manager
WHERE worker.manager_id = manager.employee_id
Create a new tabular report using the Report Wizard. Enter the SQL
query above. Display all fields and select labels and template as desired.
b. Save the report as mgr_master.rdf.
c. Create another tabular report, the detail report, and name it EMP_RPT. The
report should return department number, employee name, and salary for a
specific manager. The manager_id will be passed to EMP_RPT by
MGR_MASTER.
Create a new tabular report using the Report Wizard. Define the SQL
query:
SELECT department_id,
first_name ||' '|| last_name Employee, salary
FROM employees
WHERE manager_id = :mgr_no
Display all fields and select labels and template as desired.
d. Save the report as emp_rpt.rdf and close it.
e. Write the code to execute the detail report. For each manager returned,
MGR_MASTER should invoke the detail report, EMP_RPT, pass it the
managers employee_id, and produce a report in PDF format containing
information about the employees working for that manager. Use the
managers employee_id to create an output filename for each manager:
MGR_<employee_id>.PDF.
Hint: You can write the code in the group filter.
Open the Property Inspector for the group G_MANAGER. Set the Filter
Type property to PL/SQL. Select the PL/SQL Filter property to open the
PL/SQL editor. Create the following function:

function G_ManagerGroupFilter return boolean is


begin
SRW.RUN_REPORT ('report=emp_rpt.rdf
batch=yes
destype=file
desformat=PDF
desname='||'MGR_'||:employee_id||'.pdf
mgr_no='||to_char(:employee_id));
return (TRUE);
end;
Oracle Reports Developer 10g: Build Reports A-83

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20 (continued)
f. Compile the PL/SQL code and close the window.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
g. Run the paper layout for MGR_MASTER to test. Access the file system and
locate the output for the detail reports. View two or three of the output files.
h. Save mgr_master.rdf and close it.
If You Have Time
4. Open report p10q1.rdf
In this report, you use report triggers to create a temporary table at the start of
report execution, and you insert rows into the table at various stages of the
execution.
a. Write a trigger that creates a temporary table to hold the date and userid each
time the report is run. The table should contain three columns: one date
column, one character column of width 10, and one character column of
width 80.
CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10), COMMENTS
VARCHAR2(80))
In the Object Navigator, expand the Report Triggers node, and double-
click the Before Report PL/SQL icon to open the PL/SQL editor.
Create the following function:
function BeforeReport return boolean is
begin
srw.do_sql('CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))');
return(true);
exception
when srw.do_sql_failure then null;
end;

Oracle Reports Developer 10g: Build Reports A-84

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20 (continued)
b. The same trigger should also insert the current date, userid, and Starting

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Report into this table.
INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, 'Starting Report')
Hint: Think about how you code the single quotes.
Add the following code:
function BeforeReport return boolean is
begin
srw.do_sql('CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))');
srw.do_sql('INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
''Starting Report'')');
srw.do_sql(COMMIT);
return(TRUE);
end;
c. Compile the PL/SQL code and close the window.
d. Save the report as p20q4.jsp.
e. Run the paper layout.
f. Using SQL*Plus, verify that your table exists and was populated
successfully.
g. Log on to SQL*Plus (in Microsoft Windows, select the SQL*Plus icon in the
Oracle group) using the same userid as you used for Reports.
h. Display all records in the RUNREPORT table.
SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;

Oracle Reports Developer 10g: Build Reports A-85

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20 (continued)
i. Try running the report more than once. When you run the report a second

Oracle University Internal and TransAmerica Training Management Inc Partner use only
time, the table already exists and Reports Builder raises an exception. Make
the necessary change to your code so that the report runs even when the table
exists.
You need two PL/SQL blocks so that, if the table already exists, the
record is inserted after the exception has been handled.
Add the following code:
function BeforeReport return boolean is
begin
begin
srw.do_sql('CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN
VARCHAR2(10),
COMMENTS VARCHAR2(80))');
exception
when srw.do_sql_failure then
null;
end;
begin
srw.do_sql('INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, ''Starting
Report'')');
srw.do_sql(COMMIT);
return(TRUE);
end;
end;

Oracle Reports Developer 10g: Build Reports A-86

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 20 (continued)
j. Write a trigger that inserts a record with the comment Printing another

Oracle University Internal and TransAmerica Training Management Inc Partner use only
page whenever it begins a new page.
In the Object Navigator, expand the Report Triggers node, and double-
click the Between Pages PL/SQL icon to open the PL/SQL editor.
Or, if the editor is already open, change the Name to Between Pages.
Create the following function.

function BetweenPage return boolean is


begin
srw.do_sql('INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
''Printing another page'')');
srw.do_sql(COMMIT);
return(TRUE);
end;
k. Write a trigger that inserts a record with the comment Report completed
when the report finishes.
In the Object Navigator, expand the Report Triggers node and double-
click the After Report PL/SQL icon to open the PL/SQL editor.
Or, if the editor is already open, change the Name to After Report.
Report the following function:

function AfterReport return boolean is


begin
srw.do_sql('INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, ''Report Completed'')');
srw.do_sql(COMMIT);
return(TRUE);
end;
l. Save the report as p20q4l.jsp. Generate the output to a PDF file. Verify
the results in SQL*Plus.

Oracle Reports Developer 10g: Build Reports A-87

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 21
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Constructing a URL to run a report on the Web
Creating an entry in the key map file
Introduction
You publish your reports using OracleAS Reports Services in the Oracle
Application Server. This practice session consists of paper-based questions to test your
understanding of OracleAS Reports Services.

Oracle Reports Developer 10g: Build Reports A-88

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 21
1. You created a report called SalaryByDept.jsp that displays the salary

Oracle University Internal and TransAmerica Training Management Inc Partner use only
information for a particular department value by accepting a runtime parameter
p_deptno. You need to deploy the report on the Web using a URL.
Component Description
Web server neptune
domain name world
port 8889
alias for the directory path salarydata

The report should be executed by repserver4, the output should be in


HTMLCSS format, and go directly to OracleAS Reports cache. Access the data by
connecting to the Employee database using a username of scott, a password of
tiger, and EmpDB as the database connect string. Construct the URL to run the
report using the Reports servlet.
http://Computer_Name:port_number/salarydata/
rwservlet?report=salarybydept.jsp&server=repserver4
&userid=scott/tiger@EmpDB&p_deptno=30
&destype=cache&desformat=HTMLCSS
2. So that you do not have to enter such a long URL each time you run the
SalaryByDept report, create a key entry in the cgicmd.dat key map file entry
located under <ORACLE_HOME>\reports\conf.
a. Name the key salary. Be sure to include the runtime parameter
p_deptno in the key entry.
salary: report=SalesByDept.jsp server=repserver4
destype=cache desformat=HTMLCSS userid=scott/
tiger@EmpDB p_deptno=%1
b. Reconstruct the URL to run the report using the key. Pass a value of 30 for
p_deptno.
http://neptune.world.com:8889/salarydata/
rwservlet?salary&30

Oracle Reports Developer 10g: Build Reports A-89

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 21
3. In addition to using a URL, what are the other methods for requesting a report?

Oracle University Internal and TransAmerica Training Management Inc Partner use only
RWCLIENT command, OracleAS Portal, SRW.RUN_REPORT, and the
Event-Driven Publishing API
4. What is the JSP runtime architecture used for?
The JSP runtime architecture runs the Web layout.
5. Which two facilities can be used to monitor OracleAS Reports Services?
Oracle Enterprise Manager and Reports Queue Manager

Oracle Reports Developer 10g: Build Reports A-90

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Overview: Lesson 22
This practice session contains:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Generating and interpreting report trace information
Modifying a report to make it more efficient
Introduction
Report performance is always an issue. Reports Builder offers a few tools that allow you
to measure performance. In this practice you will use them and interpret the results.

Oracle Reports Developer 10g: Build Reports A-91

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Practice Session Solutions: Lesson 22
1. Name four main areas to investigate when tuning reports.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The Data Model, the Paper Layout, Web Layout and JSP report definitions,
and run-time arguments.
2. What is the name of the font mapping file?
uifont.ali
3. Generate and interpret Reports Runtime Trace information.
a. Open report p19q4.rdf. From the menu select Program > Tracing.
b. In the Runtime Trace Settings dialog box specify p19q4.txt as the trace file
and select the All check box under Trace Settings.
c. Select OK to close the dialog box.
d. Run the paper layout. Paginate through the report in the Paper Design view.
e. Open p19q4.txt and look at the results. Where does this report spend
time?
The time is spent on the layout and formatting of the report.
f. Repeat the same steps for report p22q2b.rdf. Specify p22q2.txt as the
trace file. Compare the result. How do you explain this?
The statistics for p22q2.rdf also show that time is spend formatting
the report. The figures are a bit higher because of the dynamic
customized formatting of the F_ORDER_MODE and
F_ORDER_TOTAL fields.
There is also a group filter on G_ORDER_ID. The predefined Last
filter is inefficient as it causes all records to be retrieved from the
database.
4. Make a suggestion to improve performance.
a. Open the report p12q1.rdf and generate Reports Trace information. Look
at the time statistics.
b. Examine the Data Model. What could you possibly do to make the report run
faster?
Set the Break Order property for all columns except the NAME column
to None, thus avoiding forcing (unnecessary) extra sorting.
c. Implement your change and regenerate the time statistics. Did things
improve?

Oracle Reports Developer 10g: Build Reports A-92

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Table Descriptions

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Overall Description

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The sample company portrayed by the Oracle Database 10g Sample Schemas operates
worldwide to fill orders for several different products. The company has several divisions:
The Human Resources division tracks information on the companys employees and
facilities.
The Order Entry division tracks product inventories and sales of the companys products
through various channels.
The Product Media division maintains descriptions and detailed information on each
product sold by the company.
The Shipping division manages the shipping of products to customer.
Each of these divisions is represented by a schema. In this course, the user has access to the
objects in all of these schemas.

Oracle Reports Developer 10g: Build Reports B-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Overall Description (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
HR Human Resources

OE Order Entry

QS PM

Queued Product
Shipping Media

The Oracle Database Sample Schemas are a set of interlinked schemas. This set of schemas is
aimed at providing a layered approach to complexity:
A simple schema (Human Resources, HR) for introducing basic topics.
A second schema (Order Entry, OE) for dealing with matters of intermediate complexity. A
multitude of data types is available in this schema.
The Online Catalog (OC) subschema is a collection of object-relational database objects
built inside the OE schema.
A schema dedicated to multimedia data types (Product Media, PM)
A set of schemas gathered under the main schema name QS (Queued Shipping) to
demonstrate Oracle Advanced Queuing capabilities.

Oracle Reports Developer 10g: Build Reports B-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Human Resources (HR)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
In the companys human resource records, each employee has a unique identification number,
e-mail address, job identification number, salary, and manager. Some employees earn a
commission in addition to their salary, which is also tracked. When an employee switches jobs,
the company records the start date and end date of the former job, the job identification number,
and department.
The company also tracks information about jobs within the organization. Each job has an
identification number, job title, and a minimum and maximum salary range for the job. Some
employees have been with the company for a long time and have held different jobs within the
company. When an employee switches jobs, the company records the start date and end date of
the former job, the job identification number, and the department.
The sample company is regionally diverse, so it tracks the locations of not only its warehouses
but also of its departments. Each of the companys employees is assigned to a department. Each
department is identified by a unique department code and a short name. Each department is
associated with one location. Each location has a full address that includes the street address,
postal code, city, state or province, and country code.
For each country where it has facilities, the company records the country name, currency
symbol, currency name and the region in which the county resides geographically.

Oracle Reports Developer 10g: Build Reports B-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Human Resources (HR) (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only

Oracle Reports Developer 10g: Build Reports B-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Human Resources (HR) Row Counts

Oracle University Internal and TransAmerica Training Management Inc Partner use only
SQL> select count(*) from countries;
COUNT(*)
----------
25

SQL> select count(*) from departments;


COUNT(*)
----------
27

SQL> select count(*) from employees;


COUNT(*)
----------
107

SQL> select count(*) from jobs;


COUNT(*)
----------
19

SQL> select count(*) from job_history;


COUNT(*)
----------
10

SQL> select count(*) from locations;


COUNT(*)
----------
23

SQL> select count(*) from regions;


COUNT(*)
----------
4

Oracle Reports Developer 10g: Build Reports B-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Order Entry (OE)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The company sells several categories of products, including computer hardware and software,
music, clothing, and tools. The company maintains product information that includes product
identification numbers, the category into which the product falls, the weight group (for shipping
purposes), the warranty period if applicable, the supplier, the status of the product, a list price, a
minimum price at which a product will be sold, and a URL address for manufacturer
information.
Inventory information is also recorded for all products, including the warehouse where the
product is available and the quantity on hand. Because products are sold worldwide, the
company maintains the names of the products and their descriptions in several different
languages.
The company maintains warehouses in several locations to facilitate filling customer orders.
Each warehouse has a warehouse identification number, name, and location identification
number.
Customer information is tracked in some detail. Each customer is assigned an identification
number. Customer records include name, street address, city or province, country, phone
numbers (up to five phone numbers for each customer), and postal code. Some customers order
through the Internet, so e-mail addresses are also recorded. Because of language differences
among customers, the company records the NLS language and territory of each customer. The
company places a credit limit on its customers to limit the amount they can purchase at one
time. Some customers have account managers, whom we monitor. We keep track of a
customer's phone numbers. In this day, we never know how many phone numbers a customer
might have, but we try to keep track of all of them. Because of the language differences of our
customers, we identify the language and territory of each customer.
When a customer places an order, the company tracks the date of the order, the mode of the
order, status, shipping mode, total amount of the order, and the sales representative who helped
place the order. This may be the same individual as the account manager for a customer, it may
be different, or, in the case of an order over the Internet, the sales representative is not recorded.
In addition to the order information, we also track the number of items ordered, the unit price,
and the products ordered.
For each country in which it does business, the company records the country name, currency
symbol, currency name, and the region in which the county resides geographically. This data is
useful for tracking customers living in different geographic regions around the world.
Product Media (PM)
The company stores multimedia and print information about its products in the database.
Examples of such information are:
Promotional audio and video clips
Product images and thumbnails for web publishing
Press release texts
Print media ads
Other promotion texts and translations

Oracle Reports Developer 10g: Build Reports B-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Order Entry (OE) and Product Media (PM)

Oracle University Internal and TransAmerica Training Management Inc Partner use only

Oracle Reports Developer 10g: Build Reports B-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Order Entry (OE) and Product Media (PMP Row Counts
SQL> select count(*) from customers;

Oracle University Internal and TransAmerica Training Management Inc Partner use only
COUNT(*)
----------
319

SQL> select count(*) from inventories;


COUNT(*)
----------
1112

SQL> select count(*) from orders;


COUNT(*)
----------
105

SQL> select count(*) from order_items;


COUNT(*)
----------
665

SQL> select count(*) from product_descriptions;


COUNT(*)
----------
8640

SQL> select count(*) from product_information;


COUNT(*)
----------
288

SQL> select count(*) from warehouses;


COUNT(*)
----------
9

SQL> select count(*) from online_media;


COUNT(*)
----------
9

SQL> select count(*) from print_media;


COUNT(*)
----------
4

Oracle Reports Developer 10g: Build Reports B-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions

Oracle University Internal and TransAmerica Training Management Inc Partner use only

Oracle Reports Developer 10g: Build Reports B-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions
Queued Shipping (QS)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
The sample company has decided to test the use of messaging to manage its proposed B2B
applications. The plan calls for a small test that will allow a user from outside the firewall to
place an order and track its status. The order must be booked into the main system. Then,
depending on the location of the customer, the order is routed to the nearest region for shipping.
Eventually, the company intends to expand beyond its current in-house distribution system to a
system that will allow other businesses to provide the shipping. Therefore, the messages sent
between the businesses must also travel over HTTP and be in a self-contained format. XML is
the perfect format for the message, and both the Advanced Queuing Servlet and Oracle Internet
Directory provide the appropriate routing between the queues.
After the orders are either shipped or back ordered, a message needs to be sent back to
appropriate employees to inform them of the order's status and to initiate the billing cycle. It is
critical that the message be delivered only once and that there be a system for tracking and
reviewing messages to facilitate resolution of any discrepancies with the order.
For the purpose of this test application, the company utilizes a single database server and a
single application server. The application provides a mechanism for examining the XML
messages as well as looking at the queues. To demonstrate connectivity from outside the
firewall, both the generation of a new order and customer service reporting are performed using
queues. The new order application directly enqueues a queue, while the customer service
queries require XML messaging to dequeue a queue.
The users associated with this application are:
QS (Queue Shipping)
QS_ES (Eastern Shipping)
QS_WS (Western Shipping)
QS_OS (Overseas Shipping)
QS_CB (Customer Billing)
QS_CS (Customer Service)
QS_ADM (Administration), and
QS_CBADM (Customer Billing Administration)

Oracle Reports Developer 10g: Build Reports B-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Table Descriptions

Oracle University Internal and TransAmerica Training Management Inc Partner use only

Oracle Reports Developer 10g: Build Reports B-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only
Creating Web
Layout Templates

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating Web Layout Templates
This appendix explains how to create a Web layout template for Oracle Reports Builder.

Oracle University Internal and TransAmerica Training Management Inc Partner use only
You can use templates to define common characteristics and objects that you want to apply to
multiple reports. For example, you can define a template that includes the company logo and
sets fonts and colors for selected areas of a report.
To create an Oracle Reports Web Layout template:
1. Create a template file (.tdf file).
2. Create an HTML file that describes the layout.
3. Update the Web Template description file (rwTemplates.xml).
4. Test the new template.
5. Deploy the template in Oracle Reports and Oracle Application Server.
6. Add the template to the template library.

Oracle Reports Developer 10g: Build Reports C-2

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
To create a Web layout template in Oracle Reports, you need three files:

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. A paper layout template (.tdf file) that is used to register the template in reports and
to make the relationship between the HTML and the CSS file in the
rwTemplates.xml file. It can also be used as a paper template.
2. A Web layout template (.html file) that is used to create the layout of the template
(default header and footer, position of the data area)
3. A Cascading Style Sheet (CSS) file that is used to define the HTML font of the different
parts of a report.

TDF file HTML CSS


file HTML file

Oracle Reports Developer 10g: Build Reports C-3

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 1: Create a template file (.tdf)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
First, create a Reports template file:
1. In Oracle Reports Builder, choose File > New > Template.
2. In the Object Navigator, under Templates, your new template name is displayed.
3. Specify a name for your template in the Property Inspector, for example MyCompany.
Note: This name is used by Oracle Reports to create the relationship between the HTML
and CSS files.
4. Save the file as MYCOMPANY.tdf in the $ORACLE_HOME/reports/templates/
directory.
You have now created a template. You can edit this template for paper reports by using the
Report Wizard.

Oracle Reports Developer 10g: Build Reports C-4

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 2: Create an HTML file that describes the layout
In an HTML editor, such as Macromedia Dreamweaver, create an HTML page that will define

Oracle University Internal and TransAmerica Training Management Inc Partner use only
the areas of your Web layout template.
1. Add the JSP header and taglib, then add the rw:report tag to reference the report
environment:

2. Put all your generic HTML below the following HTML tags:

3. The <rw:style> tag is used to create the link between the template and the CSS that we
created and references into the rwTemplates.xml file:

4. Put all your generic HTML, such as the company logo in the <BODY> tag:

5. Specify the <rw:dataArea> tag, where the Wizard will insert the report block:

Oracle Reports Developer 10g: Build Reports C-5

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 2: Create an HTML file that describes the layout (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
6. Specify all your generic HTML, such as copyright and contact information before the
</BODY> tag

7. Close the report reference tag

8. Save this document in the $ORACLE_HOME/reports/templates/ directory.

Oracle Reports Developer 10g: Build Reports C-6

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 3: Update the Web layout template description file
The Web layout template description file rwTemplates.xml is located under

Oracle University Internal and TransAmerica Training Management Inc Partner use only
$ORACLE_HOME/reports/templates. This file references Oracle Reports templates with
their associated styles.

Oracle Reports Developer 10g: Build Reports C-7

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 3: Update the Web layout template description file (continued)
1. In the rwTemplates.xml file, add a new <webTemplate> tag entry file to register your

Oracle University Internal and TransAmerica Training Management Inc Partner use only
new template.
You add the <webTemplate> tag between the <webTemplates> </webTemplates> tags.
This tag associates the paper layout template, Web layout template and CSS files. The
code displays a sample <webTemplate> tag for the MyCompany template.

Attribute Value
id references the name of the module in the Reports template file, for
example, mycompany.tdf. This is not the name of the file, but
the name that you see in the Object Navigator.
cssFile references the name of the CSS file that Report Wizard will place in
the <LINK> tag.
classSet references the classSet id into the current XML file. The classSet
makes the relationship between each field type and the CSS Class.
htmlFile references the file name of the HTML template, for example
myCompany.html.

Oracle Reports Developer 10g: Build Reports C-8

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 3: Update the Web Layout Template Description File (continued)

Oracle University Internal and TransAmerica Training Management Inc Partner use only
2. If you have a specific CSS file with new class names, you need to add a new classSet
entry in the rwTemplates.xml file. The classSet tag contains all the class name (css)
for each field type. You add the <classSet> tag between the <classSets> </classSets> tags.

Name Value
TableStyle specifies the class name of the <table> tag
ColumnHeader specifies the class name of the <th> tag used for the column header
RowHeader specifies the class name of the <th> tag used at the row header in
matrix reports
CellText specifies the class name of the <td> tag used for alphanumeric data
CellNumber specifies the class name of the <td> tag used for numeric data.
CellDate specifies the class name of the <td> tag used for date data
TotalText specifies the class name of the <th> tag used for the summary empty
cells
TotalNumber specifies the class name of the <td> tag used for the summary non
empty cells
GroupAboveHeader specifies the class name of the <th> and <caption> tags used for the
group above section

3. After adding the <webTemplate> and <classSet> entries, save the rwTemplates.xml
file and restart Reports Builder.

Oracle Reports Developer 10g: Build Reports C-9

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 4: Test the new Web layout template

Oracle University Internal and TransAmerica Training Management Inc Partner use only
1. Create a new report using the Report Wizard, and choose the TDF file you created, for
example, MyCompany.tdf template.

2. When you click Finish, you see the new report with your template code. The Report
Wizard replaces the empty <rw:style> and <rw:dataArea > tags with the generated code.

Oracle Reports Developer 10g: Build Reports C-10

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 5: Deploying the new Web layout template
You should configure Reports Builder to make sure that all associated elements such as images

Oracle University Internal and TransAmerica Training Management Inc Partner use only
and CSS files are in the correct place on the file system

Location Description
$ORACLE_HOME/reports/docroot/ Default root directory of Oracle
Reports Builder
$ORACLE_HOME/reports/docroot/images Default image directory of Oracle
Reports Builder
$ORACLE_HOME/reports/docroot/css Default CSS directory of Oracle
Reports Builder
While deploying a Web report on the Oracle Application Server, you need to make sure that all
the associated elements such as images and CSS files are in the correct location on the server.

Oracle Reports Developer 10g: Build Reports C-11

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Creating a Web Layout Template
Step 6: Add the Web Layout Template to the Oracle Reports Template Library
If you want your new template to always display in the Predefined Templates list on the

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Template page of the Report Wizard, you can add it Oracle Reports Template Library.
You can register your template file as a predefined template by inserting an entry in the
Oracle Reports preferences file and storing the template and (optional) image in the correct
template directory.
Note: This is an optional step.

Oracle Reports Developer 10g: Build Reports C-12

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Glossary

Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
A

Oracle University Internal and TransAmerica Training Management Inc Partner use only
API (Application Program Interface) Data Model view Displays a structural
A language and message format used by representation of the data in a report.
an application program to communicate The objects do not appear in the report
with the operating system or some other output, but the structure determines the
control program such as a database layout style, and the data objects provide
management system or communications the values that appear in the layout
protocol. objects.

C database (1} A set of dictionary tables


check box An interface element, and user tables that are treated as a unit.
appearing as a small square, that a user (2) (Oracle Express) A single file
can toggle on or off. (possibly accompanied by extension
files) that contains objects that organize,
column (1) A vertical space in a store, and manipulate data. In Express,
database table that represents a particular examples of such objects are variables,
domain of data. A column has a column dimensions, formulas, models, and
name (e.g., ENAME) and a specific data programs.
type (e.g., CHAR). For example, in a
table of employee information, all of the data source A source for data returned
employees' names would constitute one by a query, including database objects
column. A record group column such as tables, views, synonyms,
represents a database column. snapshots, and queries stored as views.
(2} A data model object created
automatically for each column dialog box A partial screen or window
expression in a query's SELECT list, or that prompts you to enter information
created manually to perform summaries, necessary to complete an operation.
formulas, or act as a placeholder.
E
CORBA (Common Object Request editor A work area in which you
Broker Architecture) A language- perform a specific set of tasks, such as
independent distributed object model creating a program unit or designing an
specified by the Object Management application.
Group.
EJB (Enterprise Java Beans) In Java,
D a component architecture for the
data model A relational model that development and deployment of object
defines what data should be fetched from oriented, distributed, enterprise-level
the database, what values should be applications.
computed, and how data should be
ordered in a report. Reports Builder enabled An interface element state that
objects that define the data model are means that a menu item, button, and so
queries, groups, columns, parameters, on, can be used in the current context.
and links.

Oracle Reports Developer 10g: Build Reports Glossary-2


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
F Markup Language. A tag-based ASCII
language used to specify the content and
field (1) An interface element in which

Oracle University Internal and TransAmerica Training Management Inc Partner use only
links to other documents on Web servers
you enter, edit, or delete data. (2) A
on the Internet. End users with Web
layout object that defines how the data
browsers view HTML documents and
for a specific query column appears.
follow links to display other documents.
foreign key A value or column in one
table that refers to a primary key in HTTP (HyperText Transfer Protocol)
another table. Acronym for HyperText Transfer
Protocol. The protocol used to carry
format mask A setting that defines the Web traffic between a Web browser
computer and the Web server being
appearance of the value of a field. For
accessed.
example, a format mask is used to
specify the display of currency amounts
and dates. Hyperlink A reference/link from one
document to another document or
format trigger A PL/SQL function that another place in the same document. A
allows you to dynamically change the Web browser usually displays a
formatting attributes of an object. hyperlink in some distinguishing way,
such as different color, font, or style.
formula column A user-created column When users activate hyperlinks by
that gets its data from a PL/SQL clicking on them with a mouse, the
function or expression, a SQL statement, browser displays the target of the link.
or a combination of these.
I
frame A layout object used to enclose icon A graphic representation of a
other layout objects and control the window or tool.
formatting, frequency, and positioning of
several objects simultaneously. image A bitmapped object that can be
stored and loaded into an application.
G The client cannot modify an imported
image.
group (1) In Reports Builder, a data
model object that is created intranet An internal TCP/IP network,
automatically to contain all the columns access to which is restricted (via a
selected by a query, or created by the firewall) to individuals inside the
user to modify the hierarchy of the data company or organization. An intranet
appearing in a report; it is used primarily provides similar services within an
for creating breaks in a report, as well as organization to those provided by the
for resetting computations. (2) An object Internet, but is not necessarily connected
that is composed of several other to the Internet. A common example of an
objects. intranet is when a company sets up one
or more Web servers on an internal
H
network for distribution of information
HTML (Hypertext Markup or applications within the company.
Language) Acronym for Hypertext

Oracle Reports Developer 10g: Build Reports Glossary-3


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
J M
Java A computer language that margin An optional report region that

Oracle University Internal and TransAmerica Training Management Inc Partner use only
supports programming for the Internet in appears at the top and bottom of each
the form of platform-independent logical page in a report section: Header,
"applets." Main, and Trailer. The margin may
include any layout object, but typically
JAR Acronym for Java ARchive. A file contains boilerplate and fields for page
used for aggregating many files, such as numbers, page totals, grand totals, and
Java class files, images, and other files current date and time.
into one file.
O
J2EE (Java 2 Platform, Enterprise
Edition) An environment for object (1) An item that can be placed on
developing and deploying enterprise the layout. The following are examples
applications in Java consisting of a set of of objects: rectangle, line, ellipse, arc,
services, application programming polygon, polyline, rounded rectangle,
interfaces, and protocols that provide for freehand, graph, text, symbol, and text
developing multitiered, Web-based field. (2) In an Oracle database, an
applications. instance of an object type. An object can
be a row in an object table, or the portion
JDBC (Java Database Connectivity)An of a row contained in a column object in
industry standard for database and a relational table.
Java platform connectivity providing a
call-level API for SQL-based database Object Navigator A hierarchical
access. browsing and editing interface that
enables you to locate and manipulate
JSP (JavaServer Page) An extension application objects quickly and easily.
to the servlet functionality that enables a Features include:
simple programmatic interface to Web A hierarchy represented by
pages. JSPs are HTML pages with indentation and expandable nodes.
special tags and embedded Java code The top-level nodes show module
that is executed on the Web or types, database objects, and built-in
application server providing dynamic packages, enabling tasks such as
functionality to HTML pages. JSPs are creating, editing, renaming, and
actually compiled into servlets when deleting objects.
first requested and run in the server's A find field and icons, enabling
JVM. forward and backward searches for
any level of node or for an individual
L item in a node
layout The area of an editor in which
you can create, modify, position, or
delete objects.

Oracle Reports Developer 10g: Build Reports Glossary-4


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
report requests, the secured server, and
Icons in the horizontal toolbar any OracleAS Reports Services printer
replicating common File menu

Oracle University Internal and TransAmerica Training Management Inc Partner use only
used to print report output.
functions
OracleAS Reports Services The runtime
Oracle Application Server A strategic environment for Reports Developer
platform for network application applications. OracleAS Reports
deployment. By moving application Services executes, distributes, and
logic to application servers and publishes your reports for enterprise
deploying network clients, organizations wide reporting. Using OracleAS Reports
can realize substantial savings through Services to deploy your reports results in
reduced complexity, better gains of flexibility, time savings, and
manageability, and simplified processing capacity.
development and deployment. Oracle
Application Server provides the only P
business-critical platform that offers
Paper Design view Displays output for
easy database Web publishing and
paper reports and allows you to make
complete legacy integration while
many commonly required, simple
transitioning from traditional client-
modifications to the layout, such as
server to network application
spacing, formatting fields,color, and
architectures.
editing text, without having to open the
Paper Layout view.
Oracle Developer Suite Combines
leading Oracle application development Paper Layout view Displays the layout
and business intelligence tools into a objects in a paper report and allows you
single, integrated product. Built on to make many modifications to any
Internet standards such as Java and layout object. All layout objects have
XML, the suite provides a complete and properties that you can modify using the
highly productive development Property Inspector. The hierarchy of the
environment for building applications layout objects is determined by the data
for Oracle Application Server and the model.
Oracle database.
Paper Parameter Form view Displays
<Oracle_Home> An alternate name for the layout of the Parameter Form that, at
the top directory in the Oracle directory runtime, allows user input of parameter
hierarchy on some directory-based values in the Runtime Parameter Form.
operating systems. An environment
variable that indicates the root directory
PDF (Portable Document Format) A
of Oracle products.
file format (native for Adobe Acrobat)
for representing documents in a manner
Oracle AS Portal An HTML-based
that is independent of the original
development tool for building scalable,
application software, hardware, and
secure, extensible HTML applications
operating system used to create the
and Web sites. OracleAS Reports
documents. A PDF file can describe
Services uses OracleAS Portal to control
documents containing any combination
end user access to reports published on
the Web by storing information about

Oracle Reports Developer 10g: Build Reports Glossary-5


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
of text, graphics, and images in a device- reports cache A component of OracleAS
independent and resolution independent Reports Services that stores completed

Oracle University Internal and TransAmerica Training Management Inc Partner use only
format. jobs

PL/SQL Oracle's proprietary extension REP file A file that contains a single
to the SQL language. Adds procedural report definition in binary format. .REP
and other constructs to SQL that make it files are used solely to run reports; you
suitable for writing applications. cannot edit a .REP file.

Property Inspector Reports Builder (rwbuilder) An Oracle


A window that enables you to view, Reports executable that starts Reports
locate, and set the properties of the Builder to enable report developers to
currently selected object(s) in the Object create and maintain report definitions.
Navigator, Report Editor, and Template
Reports CGI (rwcgi) An Oracle Reports
Editor.
executable, also known as the Common
Every Reports Builder object such as
Gateway Interface (CGI) or Reports
query, group, frame, parameter, etc. has
Web Cartridge, that translates and
associated properties that can be viewed
delivers information between either a
using the Property Inspector. The
Web Server or a J2EE Container for
Property Inspector features are:
example, OC4J, and the Reports Server,
expandable and collapsible nodes, in-
enabling you to run a report dynamically
place property editing, search features,
from your Web browser.
multi-selection, and complex property
dialogs.
Reports Client (rwclient) An Oracle
Q Reports executable that provides a
command line interface to send a
query A SQL SELECT statement that report to a remote Reports Server.
specifies the data you want to retrieve
from one or more tables or views of a Report Editor The Reports Builder
database. window that provides different views to
help you handle the data objects and
R layout objects for Web and paper
RDF file A file that contains a single reports. The views are: Data Model
report definition in binary format. RDF view, Paper Layout view, Paper Design
files are used to both run and edit view, Paper Parameter Form view, and
reports. Web source view.

record One row fetched by a SQL Reports Engine A component of


SELECT statement. OracleAS Reports Services that fetches
data from the data source, formats the
repeating frame A layout object used to report, send output to cache, and notifies
display rows of data that are fetched for the Reports Server that the job is ready.
a group.
Reports Queue Manager (rwrqm)A
Windows utility that maintains
timestamp and status information about

Oracle Reports Developer 10g: Build Reports Glossary-6


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
reports jobs that are managed by the typically to access a database or perform
Reports Server. e-commerce processing. Servlets provide

Oracle University Internal and TransAmerica Training Management Inc Partner use only
an alternative to CGI (Common
Reports Runtime (rwrun) An Oracle Gateway Interface) scripts. Because they
Reports executable that runs a report are written in Java, servlets are portable
using the OracleAS Reports Services in- between servers and operating systems.
process server. The Reports Servlet and JSP are
components of OracleAS Reports
Reports Server (rwserver) An Oracle Services that process custom (JSP)
Reports executable that enables running report tags and deliver information
reports on a remote server. A component between the Oracle HTTP Server and the
of OracleAS Reports Services that Reports Server.
processes client requests, including user
authentication, scheduling, caching, and SQL A standard interface for storing
report distribution. Use rwclient to and retrieving information in a relational
send a report to the Reports Server. database. SQL is an acronym for
Structured Query Language.
Reports Servlet (rwservlet) An Oracle SQL file A file that contains a query
Reports executable that translates and stored in text (e.g., ASCII or EBCDIC)
delivers information between either a format.
Web Server or a J2EE Container for
example, OC4J, and the Reports Server, SQL script A file containing SQL
enabling you to run a report dynamically statements that you can run to perform
from your Web browser. database administration quickly and
easily. Several SQL scripts are shipped
row One set of field values in a table; for with Oracle products.
example, the fields representing one
employee in the example table EMP. SQL statement A SQL instruction to
Oracle. A SELECT statement is one type
Runtime Parameter Form A screen or of SQL statement.
window appearing optionally at runtime
in which a user can modify print options style sheet HTML extensions that
and parameters prior to report execution. provide powerful formatting flexibility
in HTML documents. To view an
RTF (Rich Text Format) A Microsoft HTML document that takes advantage of
standard for encoding formatted text and style sheets, display it in a browser that
graphics. supports style sheets.

S syntax The orderly system by which


commands, qualifiers, and parameters
SELECT statement A SQL statement are combined to form valid command
that specifies which rows and columns to strings.
fetch from one or more tables or views.
T
servlet A Java application that runs in a
Web server or application server and table A named collection of related
provides server-side processing, information, stored in a relational

Oracle Reports Developer 10g: Build Reports Glossary-7


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
database or server, in a two-dimensional V
grid that is made up of rows and
view (1) In Reports Builder, a work area

Oracle University Internal and TransAmerica Training Management Inc Partner use only
columns.
in which you perform a specific set of
tabular A default layout displaying tasks, such as defining a report data
labels at the top of the page and rows of model, layout, or Parameter Form. (2) A
data underneath the labels. virtual table whose rows do not actually
exist in the database, but which is based
template A skeleton definition on a table that is physically stored in the
containing common style and standards, database.
and can include graphics. A template
provides a standard format to enable W
quick and easy development of Web browser A program that end users
professional standard look-and-feel utilize to read HTML documents and
reports. programs stored on a computer (serviced
by a Web server).
Template Editor A work area in which
you can define objects and formatting Web server A server process (HTTP
properties for your templates. It is daemon) running at a Web site that
similar to the Paper Layout view of the sends out Web pages in response to
Report Editor. You can create, delete, HTTP requests from remote Web
and modify objects (e.g., page numbers, browsers.
text, and graphics) in the margin area.
You cannot create and delete objects in Web source view Displays the HTML /
the body area, but you can modify the JSP source for a report. You can use this
properties of body objects in the view to add dynamic content to a Web
Property Inspector. page using the Report Block Wizard and
the Graph Wizard. Experienced Java
tool An iconic button used to create and developers can edit the Web source
manipulate objects in an application. directly in this view.
tool palette A collection of tools. window A rectangular area of the
desktop that contains an application.
toolbar A collection of iconic buttons Each window has an area where you can
that perform product commands. Usually interact with the application. Windows
aligned horizontally along the top, or can be opened, resized, moved, reduced
vertically down the side of a window. to an icon, or enlarged to fill the entire
desktop.
U
wizards Provide an easy step-by-step
URL (Uniform Resource Locator) A interface for commonly performed tasks.
URL, a form of URI, is a compact string The wizards in Reports Builder are:
representation of the location for a
Report Wizard: Guides you through
resource that is available through the
the steps to create a basic paper or
Internet. It is also the text string format
Web report. Each page of the wizard
clients use to encode requests to
Oracle Application Server.

Oracle Reports Developer 10g: Build Reports Glossary-8


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
asks you for information to help you X
create your initial report. XML Extensible Markup Language: A

Oracle University Internal and TransAmerica Training Management Inc Partner use only
Data Wizard: Helps you quickly metalanguage using SGML to define and
define or modify a query for a structure data. Reports Builder supports
multiquery data models. XML output to enable Web publishing
Graph Wizard: Adds a variety of as well as electronic data exchange with
charts and graphs, including true 3- third-party applications. You can also
dimensional graphs. Implemented in use XML to build report definitions that
Reports Builder with the Oracle BI can be merged with other report
graph bean. definitions at run time or can be run
Report Block Wizard: Enables you to separately.
add data to a static HTML page.

Oracle Reports Developer 10g: Build Reports Glossary-9


THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.
Oracle University Internal and TransAmerica Training Management Inc Partner use only

THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED.

Вам также может понравиться