You are on page 1of 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.