You are on page 1of 760

SQL Star International Limited

a ble
f e r
ans
n - t r
a no
Oracle Reports Developer a s 10g:
Build Reports
h
) eฺ
o m
a ilฺc Guid
Student g m • Volume
Guide
e n t1
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

D17075GC10
Production 1.0
June 2004
D39520

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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.
If this documentation is delivered to a U.S. Government Agency of the Department of
Technical Contributors
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
a ble
Darren McBurney Department of Defense, then it is delivered with “Restricted Rights,” as defined in
f e r
Paul Narth FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
an s
Daphne Nougier
n - t r
The information in this document is subject to change without notice. If you find any
o
an
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
ha s
Oracle Corporation does not warrant that this document is error-free.
Jim Safcik )
m ideฺ
o
All references to Oracle and Oracle products are trademarks or registered trademarks
c
ailฺ t Gu
Rie Saitoh of Oracle Corporation.
Navneet Singh m
g den
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 n i t31 is Stu


Vanessa Wang
r n av e th
Philipp Weckerle
u m a
t o us
Ted Witiuk
R (k se
M
Publisher
A licen
K U Nagendra
Sujatha
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Contents

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 a ble
Oracle Reports Developer 1-11 f e r
Benefits 1-12 ans
Oracle 10g Products 1-13 n - t r
o
Oracle Database 10g 1-14
Oracle Developer Suite 10g 1-15 s an
Oracle Application Server 10g 1-18 ) ha
Oracle Reports Developer 1-20
c o m ideฺ
OracleAS Reports Services 1-22
m ailฺ t Gu
g den
OracleAS Reports Services Architecture for the Web 1-23
@
t31 is Stu
Summary 1-25
n i
2 Designing and Running Reports
r n av e th
Objectives 2-2
Understanding User u m a
o us 2-3
Requirements
t
(k 2-5se
Designing Reports
R
Tabular A
M 2-7
l i c en
K U
Master-Detail 2-8

N I T Master with Two Details 2-9


V Matrix 2-10
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 a ble
f e r
Practice 3 Overview 3-29
ans
4 Creating a Paper Report n - t r
o
Objectives 4-2
Report Module Components 4-3 s an
Building a Paper Report 4-4 ) ha
Invoking the Report Wizard 4-5 c o m ideฺ
Choosing the Layout Type 4-6
m ailฺ t Gu
Creating a Tabular Report 4-7
@ g den
Using Query Builder 4-10n i t31 is Stu
Selecting the Data Source Type 4-9

r n
Building a Query 4-11av e th
m a us
Query Builder Functions 4-12
u t o
(k se
Selecting Displayed Fields 4-14
R
A licen
Totals and Labels 4-15
M
U
Selecting a Report Template 4-16
K
N I T Viewing the Paper Report Output 4-17
V Saving the Report Definition 4-18
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
a ble
Customizing the Template Margin 6-6 f e r
Customizing the Template Body 6-7 ans
Adding Web Links to a Template for Report HTML Output 6-8 n - t r
o
Predefining Your Own Templates 6-10
Adding a Template Preview Image 6-12 s an
Summary 6-13 ) ha
Practice 6 Overview 6-14 c o m ideฺ
m ailฺ t Gu
7 Creating a Web Report
@ g den
Objectives 7-2
What Is JSP Technology? 7-3 nit3
1 Stu
JSP Advantages 7-4 a v t h is
Simple JSP Example 7-6
m arn use
ku s7-7
Building a Web Report
( e to
R Wizard
Using the Report
A e n 7-8
ReportM c
li Source View 7-9
Editor: Web
UTags
K
JSP 7-11
IT Web Source Example 7-13
V N
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
a ble
Example: XML Data Stream 9-9 f e r
Document Type Definition File 9-10 ans
XML Report 9-11 n - t r
o
OLAP Data Source 9-12
s an
Defining an OLAP Query 9-13
) ha
Example: OLAP Report 9-14
c o m ideฺ
Using Text as a Data Source 9-15
m ailฺ t Gu
g den
Setting Up the textpds.conf File 9-16
@
Defining a Text Query 9-18
n
Sample Text PDS Report 9-19i t31 is Stu
r n av e th
Using JDBC as a Data Source 9-20
m a us
Configuring the jdbcpds.conf File 9-21
u t o
(k se
Defining a JDBC Query 9-23
R
M A licen
Adding New Data 9-25
K U
Using REF Cursor Queries 9-28
N I T Viewing Output from Multiple Query Reports 9-30
V
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
a ble
Designing Multipanel Reports 11-6 f e r
Printing Multipanel Reports 11-8 ans
Different Objects in the Paper Layout 11-9 n - t r
o
The Paper Layout Layers 11-11
Avoiding Layout Errors 11-13 s an
Report Processing 11-15 ) ha
Creating Layout Objects 11-17 c o m ideฺ
Paper Layout Tools 11-19
m ailฺ t Gu
Report Bursting 11-20
@ g den
n i t31 is Stu
Bursting on a Repeating Group 11-22
Creating an Additional Layout 11-24
r n av e th
Distributing a Report 11-26
m a us
Tracing the Report Distribution 11-28
u t o
(k se
Creating Variable Length Lines 11-30
R
A licen
Summary 11-32
M
U
Practice 11 Overview 11-33
K
N I
12
T Controlling the Paper Layout: Common Properties
V
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 a ble
f e r
Valid Source Columns 13-15
ans
Displaying File Contents 13-17
n - t r
When Are the Contents Updated? 13-19 o
Linking and Importing Files 13-20
s an
Comparing a File Link and a File Column 13-21
) ha
Specifying the Format Order 13-22
c o m ideฺ
ailฺ t Gu
PDF Document Taxonomy Properties 13-24
Summary 13-25 m
g den
Practice 13 Overview 13-26 @
14 Web Reporting n i t31 is Stu
Objectives 14-2 r n av e th
m a 14-3
High Quality Web Publishing
u t o us
(kand Dynamic
Comparing Static
R s e Reporting 14-5
A lice 14-7
Adding Dynamic n
Content
M
U a Report Block 14-9
Creating
I T K
Invoking the Report Block Wizard 14-11
V N Examining the Web Source Code 14-12
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
a ble
Using Lexical References 16-10 f e r
Hints and Tips When Referencing Parameters 16-12 ans
Creating a List of Values 16-14 n - t r
o
Referencing System Parameters 16-18
Building a Paper Parameter Form 16-20 s an
Customizing a Paper Parameter Form 16-22 ) ha
Using Parameter Form HTML Extensions 16-24 c o m ideฺ
Parameter Form Header and Footer 16-26
m ailฺ t Gu
Summary 16-27
@ g den
Practice 16 Overview 16-28
n i t31 is Stu
17 Embedding a Graph in a Report
r n av e th
Objectives 17-2
Adding a Graph k tou
ma to us 17-3
a Paper Report
R (to a WebseReport 17-5
Adding a Graph
Athe Graph c n
eType
M
Selecting l i
U the Graph Data 17-7 17-6
IT K
Selecting
V N Adding Options to the Graph 17-8
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
a ble
Using Data Model Triggers: Parameter Validation 19-12 f e r
Using Layout Triggers 19-14 ans
Using a Format Trigger on a Frame 19-16 n - t r
o
Using a Format Trigger on a Repeating Frame 19-18
Using a Format Trigger on a Field 19-20 s an
Using a Format Trigger in a Web Layout 19-21 ) ha
c o m ideฺ
Using a Format Trigger on a Boilerplate Object 19-22
Writing Common Code 19-24
m ailฺ t Gu
Event-Based Reporting 19-26
@ g den
Event-Driven Publishing API 19-27
n i t31 is Stu
Invoking a Report from a Database Event 19-29
Summary 19-31 r n av e th
m a
Practice 19 Overview 19-33
u t o us
20 Extending R
(k seUsing the SRW Package
M A 20-2licen
Objectives
Functionality

K U of the SRW Package 20-3


Contents
N I T Outputting Messages 20-5
V
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 a ble
f e r
Queue Manager 21-23
ans
Using the Queue Manager 21-25
n - t r
o
an
Summary 21-26
Practice 21 Overview 21-27
ha s
22 Building Reports: Efficiency Guidelines )
m ideฺ
c o
Objectives 22-2
a ilฺ Gu
Tuning Reports 22-3 g m e n t
Performance Measurement 22-5
i t 3 1@ Stud
Non SQL Data Sources 22-6 n is
a v t h
Investigating the Data Modelrn 22-8
aLayout u se
Investigating the Paperm
ku 22-14 to 22-12
(
Running the Report
R enand s e
M
Different A i
Development
l c Run-Time Environments 22-16
U
IT K
Developing Reports to Run in Different GUIs 22-18

V N Setting NLS Language Environment Variables 22-20


NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Preface

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Profile
Before You Begin This Course
Before you begin this course, you should have:
• Thorough knowledge of creating SQL query statements
• Working experience of:
– Creating PL/SQL constructs, including conditional statements, procedures and
functions
– Creating PL/SQL stored (server) procedures and functions
– Using a graphical user interface (GUI)
Prerequisites
• The following instructor-led training (inClass) courses:
– Oracle Database 10g: SQL Fundamentals I
a ble
– Oracle Database 10g: PL/SQL Fundamentals
f e r
– Oracle Database 10g: Develop PL/SQL Program Units
ans
• Or the following Self-Study CD courses:
n - t r
o
Introduction to Oracle9i: SQL
– Oracle SQL: Basic SELECT Statements s an
– Oracle SQL: Data Retrieval Techniques ) ha
– Oracle SQL: DDL and DML c o m ideฺ
Oracle9i PL/SQL Fundamentals
m ailฺ t Gu
– PL/SQL: Basics @ g den
n i t31 is Stu
Oracle9i: Develop PL/SQL Program Units

r n av e th
– PL/SQL: Database Programming

u m a
t o us
– PL/SQL: Procedures, Functions and Packages
(k se
Note: Use the Oracle9i Self-Study CD courses until the equivalent Oracle Database
R
M A licen
10g courses become available.
K U
Suggested
N I T • Oracle Database 10g: SQL Fundamentals II (inClass)
N AV 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
concepts and skills introduced.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Preface - 4

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
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 a ble
f e r
$ORACLE_HOME\reports\j2ee\reports_ids\web\test\css
ans
b. Copy $ORACLE_HOME\reports\docroot\images to
n - t r
o
an
$ORACLE_HOME\reports\j2ee\reports_ids\web\test\images
3. Add the $ORACLE_HOME\reports\j2ee\reports_ids\web\test directory
s
ha
to the "REPORTS_PATH" environment variable using Start > Run > regedit
)
o m ideฺ
4. Start OC4J using Start > Programs > Oracle Developer Suite – oracle_home >
c
ailฺ t Gu
Reports Developer > Start OC4J instance
m
g den
Note: Do not close the DOS window since it is being used by the running OC4J
@
instance.
n i t31 is Stu
r n av e th
5. Copy your reports to $ORACLE_HOME\reports\j2ee\reports_ids\web\test
6. Locate your computer name using Start > Settings > Control Panel > System >
u m a
o us
Network Identification Tab
t
(k se
7. Locate the Web site port number by inspecting the file $ORACLE_HOME
R
M A licen
\j2ee\DevSuite\config\default-web-site.xml (e.g. 8889)
K U
8. Test your paper reports using the reports servlet, for example,
N I T http://Computer_Name:port_number/reports/rwservlet?report=
V
NA 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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Resources
Oracle Publications

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
a ble
f e r
ans
Additional Publications
n - t r
• System release bulletins a no
• Installation and user’s guides h a s
m ) eฺ
• read.me files
l o
ฺc Guid
a i
• International Oracle User’s Group (IOUG)
g marticlesent
• Oracle Magazine
i t 3 1@ Stud
Web Sites
a v n this
• Oracle Technology rn ushttp://otn.oracle.com
aNetwork: e
m to Asked Questions (FAQ):
ku Frequently
(
• Oracle Reports
R ens e
A ic
http://otn.oracle.com/products/reports/htdocs/faq.htm
M l
U
N IT K• Oracle Reports whitepapers, presentations, and viewlets:
http://otn.oracle.com/products/reports/content.html
V
NA • Getting Started with Oracle Reports:
http://otn.oracle.com/products/reports/htdocs/getstart/
GettingStarted/index/index.html

Preface - 6

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Typographic Conventions
Typographic Conventions In Text

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

a ble
Caps and Buttons, Click the Executable button. f e r
lowercase check boxes, ans
triggers,
Select the Registration Required check
n - t r
windows
box.
a no
Assign a When-Validate-Item trigger.
h a s
Open the Master Schedule
m ) ewindow.ฺ
c o i d
Carets Menu paths m
Select aFileilฺ> Save.
t G u
@ g den
t31 isPress
Standu
Commas Key sequences vni release these keys one at a
a t h
m arn use time: [Alt], [F], [D]
( ku se to
A R en
U M l ic
N IT K
V
NA

Preface - 7

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Typographic Conventions (continued)


Typographic Conventions In Text (continued)

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,
Filenames: Locate the init.ora file.
a ble
usernames
f e r
Passwords: Use tiger as your password.
an s
Pathnames: Open c:\my_docs\projects. - t r
n on
URLs: Go to http://www.oracle.com.
s a
User input: Enter 300. a
) h eฺ
m
oscott.
Usernames: Log oncas
a i l ฺ G uid
Initial cap Graphics labels Customerm address (but tOracle Payables)
(unless the term is a @ g d e n
proper noun)
n i t31 is Stu
Italic Emphasized
r n av eDothnot save changes to the database.
words
andm a in printus For further information, see Oracle7 Server SQL
phrases
( u
kpublications,
e o of Language Reference Manual.
ttitles
A R bookse s courses,
nand
U M l c
ivariables Enter user_id@us.oracle.com, where user_id is

N IT K the name of the user.


V Plus signs Key combinations Press and hold these keys simultaneously:
NA [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

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Typographic Conventions (continued)


Typographic Conventions in Navigation Paths
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.
a ble
3. (B) Click the Approve button.
f e r
Notation: ans
n - t r
(N) = Navigator (I) = Icon o
(M) = Menu (H) = Hyperlink s an
(T) = Tab (B) = Button ) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Preface - 9

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Introduction

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
r a ble
• Lay out and format data to meet user reporting s fe
requirements t r a n
on -
n
• Incorporate text, images, and graphics in reports
a
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
CourseUObjectives l ic
I T K
This course enables you to design and build a variety of standard and custom Web and
VN
NA 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.

Unauthorized reproductionOracle Reportsprohibited.


or distribution Developer Copyright©
10g: Build Reports I-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Course Content

Day 1:
• Introducing Oracle Reports Developer
• Designing and running reports
• Working in Oracle Reports Builder
• Creating and modifying paper reports using the
r a ble
Wizard
n s fe
• Enhancing a paper report in the Paper Designoview - t r a
n n
Day 2: s a
a
) h eฺ
• Managing templates m
i l ฺ co uid
• Creating a Web report
g ma ent G
31@ tud
• Enhancing report structure
n it is S
n v
a e th
r us© 2004, Oracle. All rights reserved.
a Copyright
u m t o
R (k se
n
MA lice
CourseUContent
I T
The
Klesson titles show the topics covered in this course and the usual sequence of lessons.
VN However, the daily schedule is an estimate, and may vary for each individual class.
NA 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

Unauthorized reproductionOracle Reportsprohibited.


or distribution Developer Copyright©
10g: Build Reports I-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Course Content

Day 3:
• Using the paper layout
• Modifying properties
• Using Web reporting
• Extending functionality using XML
a ble
f e r
Day 4:
ans
n - t r
• Customizing reports with parameters
a no
• Embedding graphs a s
• Enhancing matrix reports m ) h eฺ
i l ฺ co uid
a
• Adding PL/SQL code gm
@ tude nt G
3 1
it is S
v n
a e th
r n
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
MA l(continued)
CourseUContent ice
I T K
Day 3
VN
NA •

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

Unauthorized reproductionOracle Reportsprohibited.


or distribution Developer Copyright©
10g: Build Reports I-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Course Content

Day 5:
• Extending functionality using the SRW package
• Using OracleAS Reports Services
• Efficiency and performance guidelines
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
MA l(continued)
CourseUContent ice
I T K
VN 5
Day
NA Extending Functionality Using the SRW Package
Maximizing Performance Using OracleAS Reports Services
Building Reports: Efficiency Guidelines

Unauthorized reproductionOracle Reportsprohibited.


or distribution Developer Copyright©
10g: Build Reports I-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Introduction to Oracle Reports Developer

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
and paper publishing fe r a
n s
• Describe the key features of Oracle Reports n-tra
Developer a no
h a s
• Describe the architecture of Oracle Application
) eฺ
o m
Server
a ilฺc Guid
• Describe OracleAS Reports gmServices
e n t
3d1@ Stu
i t
n this
a v
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OverviewU M l ic
I T K
Oracle Reports Developer is a powerful enterprise reporting tool that allows developers to
VN
NA 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 Oracle’s end-to-end business intelligence solution.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Business Intelligence
Discoverer Server Reports Server

XML

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
What IsUBusiness l icIntelligence?
I T K
Reporting is the delivery of information to information consumers. These consumers must
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

What Is Business Intelligence? (continued)


Oracle’s set of integrated BI tools allow you to seamlessly move between the roles of
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 ble
delivers high-quality information to users with only an Internet browser in open fer
a
Internet document standards. Authentication is handled through single sign-on,
s
anand
- t r
scalability is guaranteed through OracleAS Reports Services.
n on
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enterprise Reporting

• Provides access for more users to vital customized


information
• Lowers cost of ownership
• Uses integrated business intelligence

a ble
Any Web f e r
Client Application
Data Server
ans
Server n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Enterprise
U MReporting
l ic
I T K
For as long as there has been electronic data storage, there has been reporting. In the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enterprise Reporting (continued)


Enterprise reporting offers a number of important benefits. These include:
• Widening the reach of information access:
The ability to provide information electronically to a large and often geographically
distributed user base, in a timely manner, picking up live data on-demand, means that
everybody is kept informed at all times.
• Lowering the cost of computing:
Costs are minimized through a centrally managed architecture. This approach takes
the labor out of the computing infrastructure, and lowers the maintenance needs and
associated costs.
• Allowing for extensible business intelligence:
Reporting is the delivery of information. Delivery alone however is not enough. If, for
example, a possible trend is identified, such as a drop or rise in sales, you must find
r a ble
out why and be able to move seamlessly from mere consumer to investigator.
s fe
- t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enterprise Reporting

Reporting

Ad hoc query a ble


f e r
ans
n - t r
Advanced a no
analysis h a s
Web Client ) eฺ
o m
a ilฺc Guid Data Server
g
Applicationm Server e n t
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Enterprise
U MReportingl ic (continued)
I T K
Enterprise reporting provides an organization with significant benefits. In order to obtain
VN
NA those benefits however, a number of challenges need to be met, including:
• High performance and scalability:
Timely information delivery is essential. The powerhouse of Oracle’s reporting
architecture is 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enterprise Reporting (continued)


• Reduced time to market:
In Internet-based environments, information consumers have a low tolerance for
delays in information delivery. The key to reducing development time is to take the
hard labor out of report development. 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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Web Publishing

GIF89a

a ble
f e r
t rns
hyperlinks
a
on -
s a n JavaScript
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Web Publishing
U and Paper Publishing
K
T many people turn to the Web first to find information. However, publishing
IToday,
V N
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 1-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Paper Publishing

8.5”

GIF89a

a ble
hyperlinks f e r
ans
11” n - t r
o
s an
ha
JavaScript
)
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A land
Web Publishing i c enPaper Publishing (continued)
K U
T
IPaper Publishing
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Reports Developer

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


destination with high fidelity.

a ble
JDBC f e r
ans
OLAP n - t r
a no
XML h a s
m ) eฺ
o
TEXT
a ilฺc Guid
g m ent
<Your Data Source>
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleU M Developer
Reports l ic
I T K
Oracle Reports Developer provides an enterprise-wide publishing solution that delivers
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Benefits

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


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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BenefitsU M l ic
I T•K
Oracle Reports enables you to publish data from any source in any format with high
V N fidelity.
NA 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.
Unauthorized reproduction Oracle Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle 10g Products

Oracle 10g provides the complete solution:


• Oracle Database 10g
• Oracle Developer Suite 10g
• Oracle Application Server 10g
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleU M Products
10g l ic
I T K
Oracle 10g provides the complete Internet infrastructure that makes it easy for companies
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Database 10g

Oracle Database 10g manages all of your data:


Relational Data

a ble
Documents
f e r
ans
n - t r
a no
h a s
Multimedia ) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleU M
Database l c
i10g
I T K
The Oracle Database manages all of your structured and unstructured data, including
VN
NA Word documents, Excel spreadsheets, XML, images, and more. It provides a scalable,
secure, and reliable architecture.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Developer Suite 10g

Application Development

a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleU M
Developer l icSuite 10g
I T K
The Oracle Developer Suite offers a complete set of integrated development tools,
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Developer Suite 10g (continued)


For application development, Oracle Developer Suite 10g provides capabilities in:
• 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
r a ble
development. Oracle Jdeveloper’s “productivity with choice” offers a choice of: fe
development approach, technology scope, and deployment platform. a n s
n r
-t application
• J2EE and Web Services: Oracle Developer Suite supports the latestoJ2EE
programming interfaces (APIs) including Enterprise Java Beans
n JavaServer
a(EJB),
s
ha Access Protocol
Pages (JSP), and servlets. Web services support Simple )Object
(SOAP), Web Service Definition Language (WSDL), o d ฺ Description,
mand Universal
e
c i
Discovery, and Integration (UDDI). m ailฺ t Gu
• Team Support: Oracle Software Configuration
@ n
g dManagement
e provides versioning,
3 1
it analysis t u
dependency management, andnimpact
av e thi s S for all objects and file types.
r n
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Developer Suite 10g

Business Intelligence

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleU M
Developer l icSuite 10g (continued)
I T K
For business intelligence, Oracle Developer Suite provides the capabilities for:
VN
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Application Server 10g

Oracle DB
Browser Non-Oracle

a ble
e r
Wireless
a sf
Packaged
n
Apps
n-tr
no
s a
h
) eฺ a
Web
c o m i d
B2B Apps
Services
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
OracleU MA liceServer 10g
Application
I T K
Oracle Application Server 10g is a comprehensive and integrated application server that
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Application Server 10g (continued)


• Business Logic Services: Oracle Application Server provides several ways to develop
business logic, utilizing both Java development approaches and high level, model-
driven techniques. These approaches include Java 2 Platform Enterprise Edition
(J2EE), Enterprise JavaBeans (EJB), and Oracle Business Components for Java
(BC4J), as well as rich GUI oriented approaches such as 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 ble
your entire Oracle environment and network security using Secure Sockets Layer fera
s
(SSL)-based encryption and authentication facilities.
n -t ran
Technical Note n o
s a
For more information on Oracle Application Server, refer to the
) h aOracle Technology
Network: http://otn.oracle.com. om e ฺ
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Reports Developer

• User-friendly wizards
• Pluggable data sources
• Customizable report templates
• WYSIWYG live editor for paper reports
• Dynamic Web publishing using JSP/HTML
a ble
f e r
• Run-time customization
ans
n - t r
• Dynamic SQL execution
a no
• Portal integration a s
• Event-based reporting m ) h eฺ
co id
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
MA Reports
What IsUOracle l ice Developer?
I T K
Oracle Reports Developer is a component of the Oracle Developer Suite. Oracle Reports
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

What Is Oracle Reports Developer? (continued)


• Web publishing tools that dynamically generate Web pages based on your data
• Standard report output formats such as HTML, HTMLCSS, XML, PDF, PCL (Printer
Control Language), Postscript, and ASCII
• The ability to apply run-time customization
• The ability to execute dynamic SQL statements within PL/SQL procedures
• Support for Oracle objects
• Seamless integration of Oracle Reports with OracleAS Portal for administering report
security
• The ability to publish report output to portlets
• Report execution based on database events

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

OracleAS Reports Services

• Flexible reporting
• Reduced overhead
• Fast distribution
• Real time publishing
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleASU MReportsl icServices
I T K
OracleAS Reports Services, a component of Oracle Application Server, provides the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

OracleAS Reports Services Architecture


for the Web

HTTP

Oracle HTTP Listener


mod_OC4J
JSP Engine a ble
Oracle Internet Directory f e r
ans
CORBA/IIOP - t r
CORBA/IIOP
n on
a
Reports
s
OracleAS a
h Engine
Reports Services m) ฺ
c o i d e
PDS
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OracleAS U Reports Services Architecture
K
IInT a Web environment, OracleAS Reports Services can consist of four tiers:
V N
NA •

The client tier (a Web browser)
The Web server tier
• The OracleAS Reports Services tier
• The data tier (databases and pluggable data sources)

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

OracleAS Reports Services Architecture (continued)


The major components of OracleAS Reports Services include:
• 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.
r a ble
Note: OracleAS Reports Services and report deployment will be covered in more detail
n s fe in
a later lesson.
on -tra
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
fe r a
• List the Oracle 10g products s
t r a n
• List the key features and benefits of Oracle Reports
on -
Developer a n
h a s
• Describe OracleAS Reports Services m) ฺ
co uide
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
• A business intelligence solution provides a set of integrated tools that enable you to
VN move seamlessly between the roles of information consumer and information
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 1-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Designing and Running Reports

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Run prebuilt reports as an end user s
t r a n
• Identify supported report file types on -
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
IYour reports need to satisfy the requirements of your business. To help you begin the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Understanding User Requirements

What data Web features


Parameters Security

a ble
f e r
ans
n - t r
Web or Charts a no
Paper Drillh as
down
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M User
Understanding
U l ic Requirements
I T K
In the first stage of the development, you determine what the user needs and expects.
VN
NA 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

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Understanding User Requirements (continued)


Helpful questions to help you determine the user requirements:
• What data will people want, and in what priority?
• How is the data stored?
• Is there a corporate standard that must be met? If so, define standard templates.
• Will users want Web reports, paper reports, or both?
• For Web reports, will the reports be static or dynamic?
• Will users want charts in the report? If so, what data will be used in the graph?
• Will users want to drill down on data? If so, plan on using hyperlinks.
• Will users want to specify input parameters? If so, you need to create the necessary
parameters and establish the validation rules.
• Will users want a report to be embedded in a form? If so, you will have to call the
report from a form and have the form pass the data to the report.
r a ble
• Will the same report serve different types of users? If so, you need to think about fe
report sectioning and report distribution. a n s
n r
t necessary
-the
• Are there any administration or security issues? If so, you need to setoup
specifications in the OracleAS Portal Reports Security option.s a
n
• Will the users want run-time customizations? If so, plan)on hausing XML files.
om uide ฺ
l ฺ c
m ai t G
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Designing Reports

Before you start development, consider:

Specification
Data retrieval
Common features
Structure a ble
f e r
ans
n - t r
Style a no
h a s
m ) eฺ
o uid
a ilฺc GPublishing
g m ent Medium
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Designing
U MReports l ic
I T K
Before you create a report using any report-writing software, you must first consider the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Designing Reports (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Tabular
List of Products

Product
Number Description Price

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Tabular U M Style
Report l ic
I T K
You define the report structure by identifying the number of times each piece of data is
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Master-Detail
Outstanding Customer Items

Customer Name
Product
Number Price

a ble
f e r
ans
n - t r
Customer Name
a no
Product h a s
Number Price m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Report
Master-Detail
U l ic Style
I T K
The Outstanding Customer Items report displays one customer name, followed by several
VN
NA 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).

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Master with Two Details


Customer Statistics

Customer

Outstanding Orders in Last


Items Six Months
Product Order Total
a ble
Number Price No. Date Value f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
MasterU with cen Report Style
MATwoliDetails
I T K
More than one group may appear at the same level in a hierarchy.
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 2-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Matrix

Customer Matrix

Product ID
Customer

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Matrix U M Style
Report l ic
I T K
The Customer Matrix report displays a group of master customer records down the page, a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Retrieving
U l ic Data
Mand Sharing
I T K
One of the primary considerations of any report is to ensure that it runs efficiently. The
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Retrieving and Sharing Data (continued)


Report Structures
The report style also affects the number of queries required. A master with multiple detail
groups requires an additional query for each extra “sibling” group. Matrix reports can
contain one or several queries.
The following table shows the number of queries you can use to create the reports in this
lesson.
Report Name Number of Queries
List of Products 1
Outstanding Customer Items 1 or 2
Customer Statistics 2 or 3
a ble
Customer Matrix 1, 2, or 3
f e r
ans
Using Common Code n - t r
no
a program units that
In Oracle Reports, you can create queries, PL/SQL libraries, and stored
a s
are accessible to more than one report. Consider which code) ishcommon and ensure that

all developers have access to it. com ide
ilฺ u
Using Common Objects
g ma ent G
Many reports have a standard layout 3 1@
for featurestu d as company logo image, font size,
such
and style. Paper reports often have i t
n a standard S
is page size and margin widths. For paper
a v t h
reports, consider creatingaone rn template
u se containing these common features that can be the
basis of all reports.ku m to enhance individual reports with specific changes. For
You can also
R ( e
s an HTML template for your reports. Good template design
Web reports,A consider
c e nusing
UM the appearance
standardizes
K li of your reports and helps to ensure that, as a developer, you
N T
Imaintain documented standards.
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running a Report

• Your browser
• OracleAS Portal application
• Command line (Start > Run)
• OracleAS Reports Queue Manager
• Java application
a ble
f e r
• Database trigger
ans
n - t r
• Menu integrated with a Forms application
a no
• Button in a Forms application as ) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Running U M l
a Report ic
I T K
There are many ways of running a report, depending on the application design. You can
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running a Report (continued)


• A Java application
• A database trigger
• A customized menu in a Forms application
• A button in a Forms application

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Previewing Reports

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Previewing
U M Reports l ic
I T K
In Reports Builder, there are a number of ways in which you can preview your report.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Print Preview

1
2

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
1 M
Print, en and Mail options
APageliSetup,
c
U
K Page options: First, Previous, Next, Last
N I2T
N AV 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Print Preview

1 2 3

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu 4

@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K UNew Previewer, Close Previewer options
N I T
2 Zoom in, zoom out tools
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Previewing Reports (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Supported File Types

• RDF
• REP
• JSP
• HTML
• XML
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Supported
U M File Types
l ic
I T K
As you will learn in later lessons, report definitions created with Oracle Reports can be
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Supported File Types (continued)


Reports defintions RDF and REP are “owned” by Oracle Reports. In other words, you will
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 le
r a b
• Identify key design considerations: s f e
– Report style - t r an
o n
– Database access
s an
– Common code ) ha
– Common objects c o m ideฺ
m ailฺ t Gu
• List the various options for
@ g running d e n a report
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Summary U
T K
IDesigning Reports
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 2 Overview

Executing existing reports

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 2
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 2


1. Invoke the Reports Builder executable.
2. Open the report called p2q2.jsp. Run the Web layout.
a. Examine the report in your browser. Among the styles discussed in this lesson as
a reference, what style of report is it?
b. How many groups of data are there in this report?
c. In the browser, use the scroll bars to move up and down the report to see all of
the data.
d. Close the browser window. You are now back in Reports Builder.
3. Open report p2q3.rdf and run the paper layout.
a. In the Paper Design view, move to the next page. Notice that this report has a
header page with text.
b. What style of report is this?
c. Close the Paper Design view. From the File menu, select Print Preview. In the r a ble
Previewer window, experiment with the horizontal and vertical split screen n s fe
- t r a
features.
n on
d. Close the Previewer window.
s a
4. Open report p2q4.jsp and run the Web layout. a
) h eฺ
a. What style of report is this? m
co uid
i l ฺ
g
c. How many pages are there in this report?ma ent G
b. How many groups of data are in this report?

d. Close the browser. i t 3 1@ Stud


5. Open report p2q5.jsp a v n andtrun
h isthe Web layout.
a. What style of m arn is this?
report u se
b. How many ( kugroupse todata are in this report?
of
A
c. Close c e ns window.
Rthe browser
UM reportli p2q6.rdf and run the paper layout.
6.KOpen
N IT a. Notice the Parameter Form. You are requested to enter a customer ID. The report
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 2 (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 2-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Working in Oracle Reports Developer

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
f e r a
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Overview U M l ic
I T K
This lesson describes the Oracle Reports executables and gives an overview of Reports
VN
NA Builder, including a high-level description of its components and object hierarchy.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reports Developer Executables

Developer
Reports Builder Reports Runtime Reports Converter
rwbuilder rwrun rwconverter

Reports Services
a ble
f e r
s
Reports Server Reports Client Queue Manager tran
rwserver rwclient rwrqm o n -
n a
a s
m ) h eฺ
Reports Servlet Reports
i l ฺ co CGIuid
rwservlet
g ma erwcgi n tG
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Reports U M l
Developer ic Executables
I T K
Reports Developer executable filenames are lower case.
VN
NA In Windows, all Oracle Reports executables follow a similar pattern: rw<>.exe.
In UNIX, the executables follow a pattern of rw<>.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reports Developer Executables (continued)


The main Reports Developer executables are:

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 specifiedble
(or default) Reports Server.
s f era
rwrqm Reports Queue
ntran
View/schedule reports on a remote server.
-
Manager n o
Reports Servlet Runs a report as a servlet, s a
translating and delivering
rwservlet
h a
m)HTTP and
information between
co uide
ฺ the Reports Server.
rwcgi Reports CGI i l ฺ
Provides aaconnection G between a Web server and
g m n t
3
Reports
1 t u de enabling you to run reports
@ Services,
v n it is S from your browser.
dynamically
r n th CGI is maintained only for
a e Reports
u m a
t o us backward compatibility.
R (k se
Technical M A licen
Note
K U
N IATservlet is a Java application that runs in a Web server or application server and provides
V server-side processing, typically to access a database or perform e-commerce processing.
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Invoking Reports Builder

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Invoking U Reportslic
M Builder
K
IInT this lesson, you invoke Reports Builder, the rwbuilder executable, and look at the
N
V definitions of some reports to describe the components and objects in the builder.
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reports Builder Modules

a ble
f e r
Report Template PL/SQL Library ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ReportsU Builder lic
M
I T
The
KReports Builder interface enables you to create a number of different types of
VN modules, and it provides a Report Editor in which you can view the structure and objects
NA 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 units—procedures,
Library functions, packages—that can be called from multiple reports

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Data and Layout

Paper

a ble
f e r
ans
n - t r
a no
Web a s
h
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ReportU Data ic
M andlLayout
I T K
A report definition defines two main parts of a report and brings them together in the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reports Builder Components

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
ReportsU Builder Components
K
T Navigator
IObject
V N
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reports Builder Components (continued)


Property Inspector
All objects in a module, including the module itself, have properties that you can see and
modify in the Property Inspector. Features include:
• 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,rabl
e
functions, and packages within the current report. sfean
- t r
n on
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 3-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Main Menu Structure

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Navigating
U M Aroundl ic the Oracle Reports Main Menu
I T K
The main menu contains options to enable you to create, modify, and manage your
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Navigating Around the Oracle Reports Main Menu (continued)


The main menu options in Reports Builder are:
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
a ble
Program Includes compilation, run options for Web and paper, and the Java s f e r
Importer
- t r an
Tools Includes wizards and access to PL/SQL editors non
a
a s
Note: Some menu items are selectable depending on the m ) h context.
current
e ฺ For example, the
o uiisdthe Paper Layout view.
ฺc context
items in the Layout menu are selectable only whenilthe
a
m ent G
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
U M l ic
I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Wizards

• Report Wizard
• Data Wizard
• Graph Wizard
• Report Block Wizard
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Wizards U M l
in Reports ic Builder
I T K
Wizards provide an easy step-by-step interface for commonly performed tasks. The
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Editor

• Data Model
• Web Source
• Paper Layout
• Paper Design
• Paper Parameter Form
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
The Report
U M Editorlic
I T K
The Report Editor contains views to handle the data objects and layout objects separately:
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Report Editor (continued)

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 le
you can create more complex paper reports. You will also learn how to use the Web era
b
f
ans
Source view to add dynamic content to HTML pages to create reports for Web publishing.
- tr
no n
Technical Note a
Oracle Reports is integrated with Oracle JDeveloper to enablehJavaa s developers to leverage
the powerful publishing capabilities of Oracle Reports o
)
m their
within ฺ
eJava applications. You
l ฺ c u i d
m ai Destination
can create a new JSP-based Web report or a Pluggable
t G from within Oracle
JDeveloper. You can also debug a Reports JSP
@ n
g fromdewithin JDeveloper. For more
1
it3 Network
information, see the Oracle Technology
n this Stu(http://otn.oracle.com).
a v
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

PL/SQL Development Environment:


Syntax Palette

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
PL/SQL U M l ic Environment
Development
I T K
The PL/SQL development environment is the integrated functionality of Procedure
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Object Navigator

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ObjectU M
Categoriesl ic
I T K
The Report Module consists of many objects that fall into the following four categories:
VN
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report-Level Objects

• Properties
• Triggers
• PL/SQL Program Units
• Attached Libraries
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
ObjectU Categories
en
MA lic(continued)
I T K
Report-Level Objects
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Data Model Objects

• Parameters
• Queries
• Groups
• Columns
• Data Links
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ObjectU M
Categories l ic(continued)
I T KModel Objects
Data
VN The Data Model objects for a report define the data used in the report and the data
NA 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.
Unauthorized reproductionOracle Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Paper Layout Objects

• Frames
• Repeating frames
• Fields
• Boilerplate
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ObjectU M
Categoriesl ic(continued)
I T K Layout Objects
Paper
VN The Paper Layout objects define the format of the report including the positioning and
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Paper Parameter Form Objects

• Fields
• Boilerplate

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
ObjectU Categories
en
MA lic(continued)
I T K
Paper Parameter Form Objects
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Object Interrelationship
1
Select
...

2
3

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1T K
U Each query fetches data records and structures them in the group hierarchy.
N I
V 2 Each group is the source of a repeating frame.
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Your Oracle Reports


Developer Session

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U M Your l icOracle Reports Session
I T K
Reports Builder Preferences allow you to customize some aspects of your Reports Builder
VN
NA session.
To access the Reports Preferences dialog box, select Edit > Preferences from the menu.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Saving Preferences

1 2

a ble
f e r
ans
n - t r
n o
3
sa
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
SavingU MA lice
Preferences
I T K are four tab pages in the Reports Preferences dialog box. Press the Help key ([F1]
There
VN in Windows) in the Preferences dialog box to see a description of each preference.
NA 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.
Unauthorized reproductionOracle Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Reports Environment Variables

• REPORTS_PATH
• REPORTS_TMP
• REPORTS_RESOURCE
• ORACLE_PATH
• REPORTS_CLASSPATH
a ble
f e r
Windows: Modify in Registry
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OracleU Reports ic
M Environment
l Variables
K
T Reports Developer uses many environment variables. All necessary environment
IOracle
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Reports Environment Variables (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using the Online Help System

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
A licen
MOnline
Using U the Help System
K
T table describes the Help menu options in Reports Builder.
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Technical Note
In Oracle Reports Builder Developer 10g, the ‘Quick Tour’ option in the Help menu that
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).

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
fe r a
• Describe the main object categories in a report s
t r a n
module n -
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Oracle Reports Developer provides a number of executables for developing and deploying
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 3 Overview

• Invoking Reports Builder


• Opening an existing report
• Switching views in the Report Editor
• Accessing the Help system
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 3
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 3


1. Start Reports Builder and open the existing report: p3q1.jsp. Run the paper layout.
2. Using the same report, display the Data Model view of the Report Editor.
In the Object Navigator, select Q_1.
Hint: Move the Data Model window to the right so that you can also see the Object
Navigator. Use the Find field at the top of the Object Navigator to locate Q_1.
Notice the object that is selected in the Data Model view.
3. Using the same report, switch to the Paper Layout view of the Report Editor.
In the Object Navigator, select F_CUSTOMER_ID.
Hint: Use the Find field at the top of the Object Navigator.
Notice the object that is selected in the Paper Layout view.
Fully expand the Paper Layout node and select R_G_ORD_ID.
Notice the object that is selected in the Paper Layout view.
r a ble
4. Using the same report, run the Web layout.
n s fe
5. Use Help Contents to answer the following questions: - t r a
a. What is RWSERVLET?
a non
a s
m ) h eฺ
i l ฺ co uid
b. What is RWCLIENT?
g ma ent G
i t 3 1@ Stud
a v n this
a rn use
c. What is the m
ku Web Source
to view?
(
R ens e
M A l ic
K U
N IT
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 3-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Paper Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
r a ble
• Summarize report values s fe
t r a n
• Modify the style and content of a report -
n on
• Create other report styles available in the s aReport
Wizard a
) h eฺ
m
co uid
• Preview a paper report on thea i l ฺ
Web G
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Overview U M l ic
I T K
In this lesson, you learn how to create a simple tabular paper report and modify the report
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Module Components

• Data Model
• Web Source
• Paper Layout
• Paper Parameter Form
• Program Units
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ReportU M Components
Module l ic
I T K
Each report definition consists of a data model, Web source, paper layout, program units,
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building a Paper Report

You have two options:


• Use Reports Builder
– Wizards
– Paper Layout
– Paper Design le
r a b
• Define the report in XML s f e
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU M c
a PaperliReport
I T K
In Oracle Reports, you have two options for building a paper report. The simplest method
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Invoking the Report Wizard

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Invoking
U Reportslic
M Builder and the Report Wizard
K
T you invoke Reports Builder, the Welcome dialog box gives you the option of using
IWhen
V N
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Choosing the Layout Type

Wizard Pages
• Report Style
• Data Source
Type
• Data Source ble
Definition f e r a
ans
• Fields n - t r
• Totals a no
h a s
• Labels m ) eฺ
o
• Template a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU Ma Tabularl icReport Using the Wizard
I T K
You can use the Report Wizard to build eight styles of reports. In this section, you step
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Tabular Report

Wizard Pages
• Report Style
• Data Source
Type
• Data Source ble
Definition f e r a
ans
• Fields n - t r
o
• Totals s an
• Labels ) ha
c o m ideฺ
• Template
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Creating
U a Tabular Report Using the Wizard (continued)
K
T Styles
IReport
V N
NA The second page of the Report Wizard shows the various styles of reports. Select Tabular
and then click Next.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Tabular Report Using the Wizard (continued)


Wizard Pages
When you choose the Tabular style of report, the Wizard takes you through the following
pages.
Page Name Description
Data Source Select the data source type on which you want to base your
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.
a ble
Labels Alter the labels that appear for each field and the width of eachsf e r
field. - t r an
Template n
Select the template that you want to use for this paperonreport. A
template contains formatting information and s a
can also contain
a
h date, and so on.
)logo,
standard information such as company
o m d e ฺ
c i
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
NI T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Selecting the Data Source Type

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
SelectingU Mthe Datal icSource Type
I T K
Next, you define the data source type for your report. Through the implementation of the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 4-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Query Builder

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Query
U M Builderl ic
I T K
Building your query with the Query Builder GUI saves you time and increases the ease of
VN
NA use for developers not familiar with building SQL statements or with the application
tables.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building a Query

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
BuildingU a Query
T K
ITo build a query using Query Builder:
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Query Builder Functions

User-friendly interface: Alternative to writing SQL


syntax

1 2 3 4

a ble
f e r
ans
n - t r
6 o
s an
) ha
5
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K
U Column sequence
N I T
V 2 Define column
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Query Builder Functions (continued)


You can select from a table, view, or synonym. The letter T, V, or S appears in the object
title bar to indicate which it is. If you define the same table more than once, Query
Builder creates an alias (A).
The following is a brief description of some Query Builder toolbar buttons and functions.

Function Description
Column sequence Defines the sequence of column names in the SELECT clause
Define column Defines a new, derived, or calculated column to be included in the
SELECT clause; use this definition to calculate and retrieve
derived values from the server
Sort Defines the ORDER BY clause; select the columns that you want le
to be sorted, and choose ascending or descending sorting order erab
WHERE and Place the cursor in the Conditions box on the left side of rthe
a n sf
Query
HAVING clauses Builder window. Type a condition. Use the AND, OR, n t NOT
-and
o
buttons to create compound conditions.
s an
h a
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Selecting Displayed Fields

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Selecting U MDisplayed
l ic Fields
I T K
In the Field page, select each field from the Available Fields list and click >. The selected
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Totals and Labels

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Totals U M Labelslic
and
I T K
In the next two pages of the Report Wizard, you can create totals based on any of the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Selecting a Report Template

• Enforce corporate standards


• Create professional-looking paper reports easily

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
SelectingU Report Template
a
K
T a template from the list of predefined template names.
ISelect
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Viewing the Paper Report Output

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K U Magnify tool
N I T2 Page buttons
V
NA
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Saving the Report Definition

Save changes frequently.

File > Save

a ble
f e r
ans
File > Save As...
n - t r
a no
h a s
m ) eฺ
o
xxx.rdf
a ilฺc Guid yyy.rdf
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Report
SavingUthe l icDefinition
I T K
Remember to save the report frequently by selecting Save in the toolbar, or by using the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reentering the Wizard

• Select Tools > Report Wizard.


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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Creating U M l ic Styles
Other Report
I T K
In this section, you discover the other report styles available in the Wizard and the pages
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Other Report Styles (continued)


When you reenter the Report Wizard, you see a tab for each page. You can navigate
directly to the page you want to modify instead of clicking Next to move through each
page in turn.
Click Finish at any time to apply the changes.
Creating a Form Report
There are three significant features in the Form style that differ from the Tabular style.
• Labels appear to the left of each field.
• Each field appears to the right of the previous field, across the page.
• Each record appears on a new page.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a New Report

2 1

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K UReports node
N I2T Create object button
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Break Reports

• Break report styles:


Group Left, Group Above
• Additional
wizard page:
Groups le
r a b
s f e
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Creating
U M l ic
Break Reports
I T K you select one of the break (or master-detail) styles—Group Left or Group
When
VN Above—the Wizard displays an extra page, called the Groups page, in which you choose
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Break Report Labels

Group Left

Location Id Department Name Last Name Job Id

xxxx xxxxxx xxxx xxxxx


xxxxxxx xxxx

a ble
Group Above f e r
ans
n - t r
o
an
Location Id xxxx
Department Name xxxxxx ha s
Last Name Job Idom
) e ฺ
c i d
xxxx m ailฺ t Gu
xxxxx
xxxxxxx @ gxxxxden
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M
Break Report
A Labelsl i c en
K U
T
IIn a Group Left report, all the labels appear above the fields.
VN
NA In a Group Above report, labels for the bottom detail groups appear above the fields, as in
a tabular report.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Mailing Labels and Letters

Wizard pages:
• Style
• Data
• Text
• Template
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Creating
U M c
MailingliLabels and Letters
K
T you choose the Mailing Label or Form Letter report style, the Wizard displays only
IWhen
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Mailing Labels and Letters (continued)


You can type directly into the text area instead of selecting from the Available Fields list.
However, remember to prefix each field name (variable) with an ampersand.
Any word that you type without an ampersand appears as a text string in your mailing
label output. For example:

Text Area Output


LAST_NAME LAST_NAME
&<LAST_NAME> Kingsway
LAST_NAME
Kochhar

The optional angled brackets allow you to display two variables side by side with no era
ble
f
separating space.
-ans
tr
no n
What Is the Difference Between Mailing Labels and Form Letters?
a
h a s
Mailing Label Form Letter m ) eฺ
o
Multiple records on one page One record on a ilฺcpageGuid
each
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
U M l ic
I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Matrix Report

Three additional wizard pages:


• Matrix rows
• Matrix columns
• Matrix cells
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Creating
U a Matrixlic
M Report
K
T you choose the Matrix report style, the Wizard displays three new tab pages.
IWhen
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Matrix Report (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Previewing a Paper Report in a Browser

• Use Insert > Bookmark to create a bookmark for


your break report

a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
ฺc o id
• Use File > Generate to Filemail t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Previewing
U a Paper Report in a Web Browser
K
T you will learn in a later lesson, Oracle Reports enables you to easily create Web
IAs
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Previewing a Paper Report in a Browser

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Previewing
U a Paper Report in a Web Browser (continued)
K
T preview your paper report output in a Web browser:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
• Create new reports of different styles n s fe
- t r a
• Preview a paper report on the Web on n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Report Styles
VN
NA 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.
Unauthorized reproduction Oracle Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
• Creating a Matrix with Group report s
- t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 4
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-31 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 4


1. Create a tabular report, paper layout only, containing the following data. Use Query
Builder to build the query.
DEPARTMENTS: DEPARTMENT_NAME
EMPLOYEES: FIRST_NAME, LAST_NAME, JOB_ID, SALARY
2. Using the reentrant Report Wizard, make the following modifications.
a. Modify the query to sort the data in descending order of salary.
b. Add a summary to show the total salary value.
c. Ensure the width of SALARY and TOTAL is 6.
d. Select the Green template.
e. Save the report to a file named p4q2.rdf.
3. Using the reentrant Wizard, modify the report to create a break report.
a. Select the report style Group Above.
r a ble
b. Modify the query and remove the join clause so that the report contains allsfe
employees and not just managers. - t r an
c. Group the report by the department name. n on
d. Save the report as p4q3.rdf. s a
4. Create a new report as follows:
a
) h eฺ
a. Using the Report Wizard, create a paper layout
m
co and uselect
id the Mailing Label
a i l ฺ G
style.
g m ent
b. Enter the query in the data source
3 1 @ tud window:
definition
select c.cust_first_name
v n it is S|| c.cust_last_name Name,
c.cust_address r n a e th
m a cu
s
u
from customers
t o
(k textsiseavailable in the file p4q4.sql.
ThisR query
InA
c. M the text
l i c en include each of the following fields on a new line: NAME,
area,
K U STREET_ADDRESS, CITY, and STATE_PROVINCE. Include
NI T
A V COUNTRY_ID, and POSTAL_CODE on the same line.
N d. Select No template and click Finish.
e. Save the report to a file named p4q4.rdf.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-32 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 4 (continued)


5. Using the reentrant Wizard, modify the report to create a Form Letter style.
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. r a ble
n s fe
d. Save the report as p4q5.rdf.
-t ra
6. Create a new report. n on
s a style.
a. Create both a Web and paper layout. Select the matrixareport
m
b. For the query, import the contents of p4q6.sql. ) h eฺ
o
ฺc id
c. Display customer names down the left side
m ail of thet G u
page.
d. Display product numbers across@ gtop ofdthe
the e npage.
1 Stu
it3values
e. n
Display the sum of thevtotal
a t h is in the cells.
f. arnto give
Create a summary
m u e total of the sum(total_value) values.
sthe
g. kuwidth
Change(the eofto
all four summaries to 4. Change the PRODUCT_ID label to
R
A liRemove n s
U MProduct. ce the label for SumTOTAL_VALUE.
IT Kh. Select any template and click Finish to preview your report.
V N i. Save the report to a file named p4q6.jsp.
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-33 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 4 (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 4-34 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enhancing a Basic Paper Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
r a ble
• Modify the positioning of report data s fe
t r a n
• Highlight data using conditional formatting -
n on
• Add page numbering and the current date sa
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview U
T K
IIn this lesson, you learn to enhance your paper reports with the most commonly required
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M PaperlicDesign View?
What IsUthe
I T K
The report Paper Design view is a WYSIWYG editor. All edits that you perform in the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Paper Design Window


1

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
4
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T KToolbar
N I
V 2 Stylebar
NA
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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying a Report

Common modifications:
• Align columns
• Set format masks
• Manipulate objects
• Edit text
a ble
f e r
• Modify visual attributes
ans
n - t r
• Highlight data using conditional formats o
• Insert page numbers and current date as an
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ModifyingU Ma Report l ic in the Paper Design View
I T K
In this section, you learn about some of the most commonly required changes that you
VN
NA 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

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Aligning Columns

a ble
f e r
ans
n - t r
a no
h a s
Point and
m ) eฺ
Select
o id
select
a ilฺc“Align G uRight”
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Aligning U M
Columns l ic
I T K
In the sample report output, in the left panel, the salary values are aligned to the left. You
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting a Format Mask

Change format masks from the stylebar

a ble
f e r
ans
n - t r
1 2 3 4 o5
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
UM lic
1 K Currency symbol
V N 2T Percentage symbol
I
NA 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

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting a Format Mask (continued)


To alter a numeric format:
1. Select the numeric field to which you want to apply a format mask.
2. Select the corresponding format mask button on the stylebar.
The format mask is applied.
Note: Reports Developer applies the format mask only to fields whose datatype is
NUMBER. Also, the currency and percentage format masks are mutually exclusive: only
one or the other can be applied to a numeric field, never both.
NLS Support for Format Masks
The stylebar always shows “$” for the currency button, “,0” for thousands, and “.0” for
decimal places, but the output currency symbols are language-specific and can differ at
run time.
a ble
e r
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. tran
sf
o n -
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
NI T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Manipulating Objects

• Clear fields
• Move fields
• Resize fields

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
lฺc Guid
Flex Mode adjusts layoutgduring a i
m enchanges. t
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Objects
Manipulating
U l ic
I T K
You can alter the position of objects, such as fields and labels, by selecting the object you
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 5-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
ans
-Sales Report - Sales Report by Area
-
Sales Report by Area
n t r
o
Year
1993
Region
Americas
Sales
200
Year
1993
Region
Americas
Sales
200
s an
Year Region Sales

1993 Europe 400 1993 Europe 400


) ha 1993 Americas 200
1993 Asia Pacific 770 1993

c o m ideฺ
Asia Pacific 770 1993
1993
Europe 400
Asia Pacific 770
Year
1994
Region
Americas
Sales
210
Year

m
1994ailฺ t Gu
Region
Americas
Sales
210
Year Region Sales
1994 Europe 390
@ g den
1994 Europe 390 1994 Americas 210

t31 is Stu
1994 Europe 390

n i
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Modifying
U Visual Attributes
K
T change field and boilerplate font:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying Visual Attributes (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Applying Conditional Formatting

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Applying
U Conditional Formatting
K
T can highlight or suppress objects using conditional formats.
IYou
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Applying Conditional Formatting (continued)


Formatting is applied in the order that the format exceptions are listed; a format exception
overrides a previous format exception if both evaluate to TRUE.
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Inserting Page Numbers, Dates,


and Times

• Inserted easily
• Customizable extensions

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Inserting
U ic
MPage Numbers,
l Dates, and Times
K
T add page numbers and the current date to your report in the Paper Design view, select
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Inserting Page Numbers, Dates, and Times (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Dates

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U M Dates l ic
I T K
If the mask that you want does not exist, and you do not want to add it to your
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 le
r a b
– Apply format masks
s f e
– Add page numbering and current date - t r an
o n
• Save report to preserve changes
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Summary U
T K
IFeatures of the Paper Design View
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 5 Overview

Modifying reports by applying changes in the Paper


Design view

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
PracticeU M c
SessionliOverview: Lesson 5
K
T practice session involves modifying reports by applying changes in the Paper Design
IThis
V N
NA view. You reuse some of the reports that you created in the last session.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 5


1. Open report p4q2.rdf. Make the following changes in the Paper Design view:
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 era
ble
SALARY field accordingly. a n sf
c. Make the same changes to the total at the end of the report. Move n -
thetrgrand total
a no use the
so that it aligns with the SALARY field (you must do this manually;
ruler guides to help you). h a s
d. Change the text color of the employee data heading m ) to blue.
e ฺ
c o i d
e. Make whatever other changes you like.ailฺ G u
m
g deand
f. Save the report to a file named p5q2.rdf
t
n close it.
@
3. Open report p5q3_a.rdf. Make
n i Stu changes in the Paper Design:
t31 theisfollowing
v ofththe page. Give it any format you want.
a. Add a date at the topacenter
n
b. Make whatever r se you like.
aother changes
u
m o named p5q3.rdf and close it.
u toea tfile
c. Save the(kreport
4. OpenA report
c e ns Make the following changes in the Paper Design:
R p4q6.jsp.
K UMRight-justify
a. li the Product ID field.
N IT b. Add commas and two decimal places to the cells and summaries and make them
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 5 (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 5-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Managing Report Templates

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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
r a ble
• Modify a predefined report template s fe
t r a n
• Register a customized template -
n on
• Add a Web link to a template sa
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview U
T K
IIn this lesson, you learn how to open and modify predefined Oracle Reports paper
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Report Templates

For paper reports, you have three template options:


• Predefined
• User-defined
• No template
a ble
f e r
an s
n - t r
a no
h a s
Installation templates in: m ) eฺ
o
<oracle_home>\reports\templates a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using theU MReportlicTemplates
I T K
The template page of the Report Wizard has three options for choosing a template for a
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying a Template

Margin Body

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Modifying
U Ma Template
l ic
I T K
A report template is not the same as a report definition. A template is divided into regions,
VN
NA 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

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying a Template (continued)


Modify template objects in the Template Editor or in the Object Navigator.
The Template Editor is similar to the Paper Layout view of the Report Editor. You can
create, delete, and modify objects (such as page numbers, text, and graphics) in the
margin area. In the body area, you can modify the properties of body objects.
The Report Style drop-down list enables you to view the layout for a selected report style.
Default and Override Sections
Make general modifications to the default section. These modifications affect all report
styles. However, you can override attributes for one or more styles to provide a flexible
inheritance model.
Each report inherits attributes from the default section of the template unless there is an
override value. The override section overrides specific attributes for each style. There is able
r
an inherit button in the Property Inspector to return to the default value.
an sfe
- t r
n on
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing the Template Margin

Include
objects
such as:
• Images
• Text ble
f e r a
• Page s
Numbers - t r an
n no
• Date s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U c
M theliTemplate Margin
K
T can copy, create, or import various objects into the margin of the template.
IYou
N
V • Images: Insert > Image
NA • 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing the Template Body

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U c
M theliTemplate Body
K
IInT the template body, you can modify fonts, colors, and fills of the field, label, summary,
N
V and frame objects. You make changes directly in the Template Editor or by using the
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding Web Links to a Template for


Report HTML Output

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Links
AddingUWeb l icto a Template for Report HTML Output
IAT K
paper report output in HTML format can include many types of Web links, such as a
VN document header or footer for placing a logo or a link at the beginning or end of a
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 6-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
Reports.Tabular_Template_File =
f e r
(rwbeige, Reports.Tabular_Template_Desc =
ans
rwblue, n - t r
no
("Beige",
mytemp, "Blue", a
rwgray, "My Template )Description", has
rwgreen, "Gray",ฺco
m ideฺ
m ail t Gu
rwpeach,
@ g den
"Green",

n i t31 is Stu
"Peach",

r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Predefining
U Your Own Templates
K
T you create your own templates, you might want to include some in the predefined
IWhen
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Predefining Your Own Templates (continued)


To register a customized template in the predefined list in the Wizard:
1. Open an existing template, modify the template objects as required, and save the
template as a .tdf file.
2. Move the template and the image 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 ble
the description is listed in the same position as the relevant file. These are the fer
a
descriptions that you see in the predefined list when you apply a template
s
ainnthe
- t r
Report Wizard.
n on
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding a Template Preview Image

• Image area is 200 x 150 pixels


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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
AddingUaM Template l ic Preview Image
I T
Each
Kpredefined template has a small image associated with it that is displayed on the
VN right side of the template page of the Report Wizard. The image is optional but is a useful
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
• Add your templates to the predefined list s fe
t r a n
• Display an image for a predefined template -
n on
• Add Web links for report HTML output s a
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
SummaryU
T K
IModifying a Template
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 6 Overview

• Customizing an existing template


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 6
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 6


1. Customize an existing template, adding a company logo and report title to the report
margin, and modify the report body.
a. Open rwblue.tdf. This file should exist in your working directory; it is a
copy of the Blue predefined template.
b. Display the margin region. (This usually appears by default when you open a
template.)
c. Delete the Your Company logo. 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 able
Right. s f er
g. Save the template as laketech.tdf.
- t r an
2. Apply the modified template to an existing report. n on
Hint: You must search for the template file; it does not appear s ain the list of
predefined templates.
a
) h eฺ
a. Open p4q3.rdf.
m
co uid
i l ฺ
b. Apply laketech.tdf to the report.
g ma ent G
c. The report shows some changes
i t 3 1@butSnot
t udall. Which template changes have been
applied and which have n not?this
a v
a rn tousyour
d. To apply all changes e report, you will have to create the layout again.
k m
From theumenu, select t o Edit > Select All to select all layout objects. Now delete
( e
them.
e.MA
R Invoke
c e nstheasReport Wizard and reapply your template.

K U Save theli report p6q2.rdf.


I T3. Continue to modify the template and test it using a new report.
A VN a. Change the text color of the master group fields to red for the Group Left style
N 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 6 (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 6-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Web Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Describe the elements of the Web source code s
t r a n
• Preview a Web report on -
n
• Identify supported image formats for Webs areports ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
IOracle Reports is designed for the Internet. You can develop Web reports simply and
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
What isUJavaServer l ic Page (JSP) Technology?
I T K
JavaServer Page technology is an extension to the Java servlet technology from Sun that
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
Web pages f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
JSP Advantages
U l ic
I T K
JSP technology enables the rapid development of Web-based applications that are
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

JSP Advantages (continued)


Since the JavaServer Pages cleanly separate dynamic application logic from static HTML
content, page designers who have limited or no Java programming expertise can modify
the appearance of the JSP page without affecting the generation of its content. The
separation of the HTML coding and the business logic in a Web page allows HTML
programmers and Java programmers to more easily collaborate in creating and
maintaining applications. The application logic itself can reside in server-based resources
that the Web page accesses through tags that are similar to XML tags.
Another advantage of using JSPs is that they are easy to code. JSPs are compiled “just in
time”, offering faster performance with maximum portability. JSPs are rapidly becoming
the standard environment for enterprise Web publishing. JavaServer Pages are recursive
and can execute different code streams within the HTML, making them more versatile for
deploying information on the Web.
r a ble
For more information about JSP technology, see the JavaSoft Web site at http:// n s fe
www.javasoft.com/products/jsp/. - t r a
n
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Simple JSP Example

<HTML>
<HEAD><TITLE>Simple JSP Example</TITLE></HEAD>
<BODY>
Welcome to my page!!
Current time is :
a ble
<%= new java.util.Date() %> f e r
ans
</BODY>
n - t r
</HTML> a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
SimpleUJSP M Examplel ic
I T K
Before you learn about Reports JSPs, let’s look at a very basic JSP example.
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU M l ic
a Web Report
I T K
You can easily create Web reports using the declarative features in the Report Wizard.
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using the Report Wizard

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using the
U MReportlicWizard
I T K
You have already used the Report Wizard to create paper reports. The Wizard gives you
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Editor: Web Source View


Reports JSP
Custom Tag
Library
Start of report

Data model
information
a ble
HTML template f e r
information ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
End of report
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Web Source
U M Viewlic
I T K
The Web Source view of the Report Editor displays the source code for your Web report,
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 7-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Web Source View (continued)


A Reports JSP includes both standard JSP tags and Reports custom JSP tags.
A JSP tag is a Java class that encapsulates functionality and can be used in a JavaServer
Page. The use of JSP tags keeps the JavaServer Pages manageable and easy to read. You
do not have to write a lot of inline Java code. You simply reference a JSP tag. When a
.jsp file is run, each tag is substituted with the corresponding code.
JSP 1.1 supports custom tag libraries. You can write your own set of tags and reference
them within your JSPs. A set of custom JSP tags was created for 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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

JSP Tags

• Standard JSP Tags


– taglib
– page
• Reports Custom JSP Tags
– rw:report le
r a b
– rw:objects
s f e
– rw:foreach - t r an
n no
– rw:field a
– rw:include h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
JSP TagsU M l ic
I T K
The standard JSP tags, taglib and page, are required in the definition of a report module.
VN
NA • <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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

JSP Tags (continued)


Reports Custom JSP Tag Library
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 r a ble
parameter) in HTML n s fe
- t r a
rw:include Provides for the formatting of any top level layout on
an
object into HTML output. This tag is used to reference
s
a paper layout within a Reports JSP. ) ha
rw:graph Provides a graph definition in XML.
c o m ideฺ
ฺ ail t Gu
m
g den
@
Technical Note
n i t31 is Stu
v JSP
For a complete list of Reportsacustom
n th tags, consult the online Help system.
a r us e
u m t o
R (k se
M A licen
K U
I T
VN
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Web Source Example

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Example U M l ic
I T K
The Web Source in this example was generated by the Report Wizard using the following
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Example (continued)
Modifying a Web Report Using the Report Wizard
You can modify a Web report using the reentrant feature of the Report Wizard just as you
did for paper reports. The Wizard preserves your current setting and data source
definition. You can make changes to these and other settings and click Finish when you
are ready to reapply the Wizard settings to your Web report.
Saving Your Web Report 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 r a ble
environments. n s fe
-atr
Technical Note no n
s a
A Reports JSP contains the full definition of your report module.
) h a However, Reports
Builder hides a good deal of the code in the Web Sourcem
o view. You
d e ฺcan view the module,
<module_name>.jsp, outside the Builder using c
ilฺa text G i
u and see much more—
editor
m a t
data source, data links, layout, and so forth. g
1@ Stud en
i t 3
n this
a v
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Generating Output

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Generating
U Output
K
T preview your Web report in a browser:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Generating Output (continued)


Another way to publish a report on a Web site is to create an OracleAS Portal component.
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Image Format Support

Source Image Formats: Destination Image formats:


• JPG, JPEG • JPG, JPEG
• GIF • GIF
• PNG • PNG
• BMP • BMP
a ble
f e r
• TIFF ans
n - t r
• CGM no
• Progressive JPEG s a
h
) eฺ a
• Exif JPEG o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Image U M Support
Format l ic
I T K
Web publishing often includes dynamic media content, from animated images to full-
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Image Format Support (continued)


Oracle Reports supports the following formats:
• 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 ble
speed, aperture, and the date and time the image was captured.
s f era
• Destination Image formats:
- t r an
- JPEG / JPG
n on
- GIF s a
- PNG a
) h eฺ
- BMP m
co uid
a i l ฺ
t G output later in the course.
gmin yournreport
You learn how to specify the format for images
3 1 @ tude
v n it is S
r n a e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
• Use the Run Web Layout feature to test Web s fe
n
deployment -tra on
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Creating Web Reports
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 7 Overview

• Creating Web reports using the Report Wizard


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 7
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 7


1. Create a tabular report, Web and paper layout, entitled Compensation Report. The
report should contain the following data:
SELECT d.department_name, e.first_name, e.last_name,
e.job_id, e.salary
FROM departments d, employees e
WHERE d.department_id = e.department_id
a. Display all fields. Select the predefined Blue template. Do not make any
changes to the other Wizard pages.
b. Run the Web layout to test.
c. Examine the Web source. How many <rw:foreach> tags are in the code? Why
this number?
d. Modify the report using the Report Wizard. Make this a Group Left break
report displaying employing information grouped by department. Include aera
ble
sum for salary. a n sf
e. Examine the Web source again. Now how many <rw:foreach>otags n -trare in the
code?
s an
f. Which JSP tag identifies the overall appearance and
) haformatting of the data in
the Web report?
c o m ideฺ
g. Which JSP tag delimits the data model lฺ layout
aiand G uinformation? Can you view
m
g den
this information in the Reports Builder?
t
@ u as p7q1.jsp.
h. Run the Web layout to test.
n i t31Saves
the
S treport
2. Create a report for the Web
r n thi current product information.
av thatedisplays
a. Use the Report
m a Wizardusto create a new tabular report called Our Products.
u e to data from the PRODUCT_INFORMATION table:
(kthe following
Include
R ens
M A
Column lic Label
K U
N I T product_id Product No.
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 7-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Enhancing Reports Using the Data Model:


Queries and Groups
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Change the order of data in a group s
t r a n
• Eliminate data from a report on -
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
IYou have learned to create simple, single-query paper and Web reports using Reports
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Data Model Objects

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
The DataU l ic
MModel Objects
I T K
The Data Model defines the report data and its hierarchy—that is, the report structure. The
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Data Model Objects (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying Properties of a Query

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Modifying
U MProperties
l ic of a Query
I T K
You can modify a query, including the SQL statement, by changing properties in the
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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: le
r a b
– Exiting SQL query statement
s f e
– Compiling or executing a report - t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Modifying
U Properties of a Query (continued)
K
T Column and Table Aliases
IUsing
V N
NA 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

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying Properties of a Query (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

More Properties

Aid maintenance and testing:


• Rename queries in complex reports
• Add comments to describe queries:
– Use the Comment property
– -- comment for single lines
a ble
– /*comment*/ for multiple lines f e r
ans
• Set Maximum Rows to Fetch n - t r
o
to restrict data
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
More Properties
U
T K
IRenaming Queries
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

More Properties (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 8-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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. le
r a b
The Wizard destroys previous layout and creates new s f e
objects. - t r an
• For Web reports: n on
a s
– Select the Report Wizard and navigate ) a
hthrough each of
m ฺ
the tabbed pages, reselecting the
i l ฺ u ideoptions.
codesired
or g ma ent G
@ tud
it31manually.
– Edit the Web source
v
S
n this
a
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ApplyingU MChanges l ic
I T K
When you alter the Data Model, you must update your layout to see the changes.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Applying Changes (continued)


For Web reports, reentering the Report Wizard will delete the layout that was previously
created. A new Web layout will be created based upon the selections you make on each of
the tab pages in the Wizard. You can also manually edit the Web layout using the Web
Source view of the Report Editor. You will learn more about this in a later lesson.
Note: If you edit a query statement to alter any columns that are part of an existing layout,
and run the report without re-creating the layout, the Source property becomes null, and
the field in the Previewer appears with a large cross.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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. le
r a b
• Developer-created groups for: sf e
– Control break reports - t r an
n no
– Complex matrix reports a
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Changing
U Mthe Group
l ic Structure
I T K organize your data into sets of records and, in a hierarchy, determine the
Groups
VN frequency at which records in that group appear in the output. Each group contains
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Changing the Group Structure (continued)


Example: You create a Web layout using the Report Wizard and the default group name
is G_LAST_NAME. You change the name to G_EMP in the Property Inspector. Now do
the following:
1. Display the Web Source view of the Report Editor.
2. Locate <rw:foreach id="R_G_last_name_1"
src="G_last_name">.
3. Change the value of src to G_emp:
<rw:foreach id="R_G_last_name_1"
src="G_emp">
Developer-Created Groups
Sometimes you do not want to modify existing Data Model objects in the Report Wizard;
for example, during later maintenance. In this case, you might need to create your own rab
le
groups in the Data Model to perform the following actions: n s fe
• Produce control break (nested) reports - t r a
• Produce complex matrix reports n on
s a
h a
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Group Hierarchy

a ble
f e r
1 ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid 2
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
UM lic
I1T KDrag columns up or left to create a parent group.
V N 2 Drag columns down or right to create a child group.
NA
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Group Hierarchy (continued)


Creating a New Group
Select DEPARTMENT_ID and drag it out of and above the default group to create a break
group. Change the group name to make it more meaningful.
You can drag other columns, such as DEPARTMENT_NAME, into the new group.
Alternatively, move more than one column into a new group by using [Shift]-click to
select the columns before dragging them all together.
Note: You can also drag columns down a hierarchy, from a higher group into a new or
existing lower-level group. The order in which the groups exist in the Data Model has an
effect on the output. Always make sure that your parent (master) group is first and the
child (detail) group is second.
When you drag a column to create a new group, the new group is only one level above or ble
below the column’s original group in the hierarchy.
s f era
t r
To create a group more than one level from the original group, follow these steps:
- an
1. Move the column to the level immediately above or below the required
n on position of
the new group. s a
a
) hlevel.ฺ
2. Drag the column out to create the new group at them next
i l ฺ co uide
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Ordering Data in a Group

2
a ble
f e r
3 ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T K Break group controls primary sort; use the Break Order property
N I
V 2 Order by DEPARTMENT_NAME column: Break Order = Descending
NA 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 column’s
values. It is denoted by a solid arrowhead to the left of the column. For column values in
user-created groups, you must use the Break Order property to specify how to order the
break column’s values. The order of precedence depends on the order of columns, from
the top down, in the group.
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Ordering Data in a Group (continued)


Break Order in Break Groups
Remove unnecessary break columns in each break group to improve the performance of
your report. A break group is any group other than the lowest group of each query. If
several columns are all unique, such as the DEPARTMENT_ID and DEPARTMENT_NAME
columns, having break order set on both columns can sometimes cause unnecessary
sorting.
1. Open the DEPARTMENT_NAME column Property Inspector.
2. Alter Break Order to None.
3. Repeat for each column that is not part of the sort.
Break Order in Lower Groups
The Break Order property has no effect on columns in the lowest group of each query.
Modify the ORDER BY clause in the SQL query statement to control this group. r a ble
sf e
Removing the Break Order property from columns in this lowest group is optional
- t r anand has
no effect on the output.
non
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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,


a ble
f e r
e.last_name...
ans
FROM employees e, departments d n - t r
a no
h a s
WHERE e.department_id = d.department_id
ORDER BY 2, e.salary m) ฺ
co uide
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Query U M l
Modificationsic
I T
The
Kfollowing example shows how the ORDER BY clause is modified.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Query Modifications (continued)


If you create a break group containing DEPARTMENT_ID and DEPARTMENT_NAME, but
with DEPARTMENT_NAME as the only break column, then at run time your query
becomes:
SELECT d.department_id, d.department_name, e.last_name,
e.salary
FROM employees e, departments d
WHERE e.department_id = d.department_id
ORDER BY 2, e.salary

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Filtering Data in a Group

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Filtering
U MData in laicGroup
I T K
A group filter allows you to control the processing of records in each group. This section
VN
NA 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.
Instructor Note
Demonstration: In the same report, restrict G_DEPT to the first two records.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using a U M
Packaged l icFilter
I T K
A packaged filter allows you to specify the number of records that you wish to retrieve in
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
• Filter data in a group s
- t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
SummaryU
T K
IQueries
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 8: Overview

• Modifying report hierarchy


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 8
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 8


1. Open report p8q1_a.jsp, a tabular report showing customer information.
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 era
ble
greater than 1500. You need to modify the query properties. a n sf
a. Include CREDIT_LIMIT in the query statement, although you do n - tr need to
not
a nowho have a
display it. Restrict the query statement to show those customers
credit limit greater than 1500. h a s
)
b. Save the report as p8q3.jsp and run the Web omlayout.eฺ
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 8-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enhancing Reports Using the Data Model:


Data Sources
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Reuse PL/SQL code to create a REF cursor s
t r a n
• Link data from multiple data sources using a o
data
n -
link n
sa ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
ITo keep pace with today’s demand for information, you need to be able to access all
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Data Source Types

Access data from a variety of sources:


• SQL-based
• XML
• Oracle OLAP
• JDBC
a ble
f e r
• Express
ans
n - t r
• Text
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Types
Data Source
U l ic
I T K
With Oracle Reports, you can publish data from any data source, and even combine data
VN
NA from one or more of these data sources in a single report.
For example, today e-businesses use XML as a means of data interchange. Imagine a
business-to-business scenario where a wholesaler’s inventory is available to a supplier
through XML. The supplier wants to see what products to ship to his customer, but
obviously, he can only ship those products he has in stock himself. This data is stored in
his internal relational database. Using 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Data Source Types (continued)


The information you need to publish is often derived from various data sources. These
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 able
data source is provided for backward compatibility s f er
n
• Data in flat files
on -tra
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Pluggable Data Sources

Text
Express JDBC OLAP SQL XML
files

a ble
f e r
ans
- t r
Oracle n no
s a
Reports h a
m ) eฺ
o
Client a ilฺc Guid Oracle10g
m
g de n t
@
n i t3 is Stu
1
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Pluggable
U Data Sources
K
IATpluggable data source, or PDS, is an Oracle Reports feature that enables data input from
V N
NA numerous sources through the implementation of design time and runtime Java
application program interfaces (APIs). Reports Builder provides interface definition,
which acts as a translator between Reports Builder and the data source by redefining the
Builder’s requests in terms of the specific data source.
The PDS feature also enables you to leverage various capabilities in 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Out-of-the-Box Options

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Pluggable U ic
MData Sources
l (continued)
K
IInT addition to traditional data sources such as SQL, PL/SQL, and Express, Oracle Reports
V N
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using XML as a Data Source

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using XML
U M as a Data
l ic Source
I T K
XML enables business-to-business exchanges of data across applications and platforms.
VN
NA 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.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using XML as a Data Source (continued)


To define an XML query:
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Example: XML Data Stream

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Example:U MXML Data
l ic Stream
I T K
The Human Resource (HR) department is preparing for quarterly bonuses. Each manager
VN
NA 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>

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© 9-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Example: XML Data Stream (continued)


The Document Type Definition
The DTD defines the structure of the data in the XML document. Like the XML
document, the DTD can be stored locally or remotely. For our example, the DTD contains
this definition:
<!ELEMENT TABLE (*ROW)>
<!ELEMENT ROW (EMPID?, BONUS?, PERINC?)>
<!ELEMENT EMPID (#PCDATA)>
<!ELEMENT BONUS (#PCDATA)>
<!ELEMENT PERINC(#PCDATA)>
It indicates that the XML document contains three data elements, EMPID, BONUS, and
PERINC. The content specification, #PCDATA, specifies that an element contains only r a ble
parsed character data, that is, ordinary text. n s fe
- a
tr
no n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

XML Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
The XML U Report
T K
IThe output for the report is a simple tabular report.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

OLAP Data Source

a ble
f e r
Multidimensional
ans
objects n - t r
a no
h a s
OLAP database
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using OLAP
U M as aliDatac Source
I T K
Online Analytical Processing (OLAP) queries involve inter-row calculations, time series
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Defining an OLAP Query

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
DefiningU OLAP Query
an
K
T define an OLAP query:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Example: OLAP Report

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Example:U ic
MOLAP lReport
I T K
The example illustrates the use of OLAP in a finance department. This report compares
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Text as a Data Source

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Text
U M as a Data
l ic Source
I T K
The information you want to publish may be in a character-delimited text file. You can
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting Up the textpds.conf File

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
SettingUUpM the Text
l ic PDS Configuration File
I T K
Before you can use a text file as your pluggable data source, you must set up the Text
VN PDS configuration file (textpds.conf) with the definition of the values in your text
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting Up the Text PDS Configuration File (continued)


For example, the textpds.conf entry for the text file Products_CSV.txt is:
<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 le
delimiter and file format type. Each File Format has columns. You specify the individualr a b
e
sfof
column information within the <columnInfo> tags. The column information consists
a n
the following attributes: n-tr
no
Column Name: Heading for the column s a
Column Type: Data type of the column. String, Number, and h a
) Dateeฺare the only supported
o m
data types.
a ilฺc Guid
Cell Wrapper: This attribute is optional. If g m enthis
specified, t character overrides the File
Format delimiter for the column for which
i t 3 tud
1@it isSspecified.
v
Pattern: This attribute is optional.
a n Thisthisicurrently
s used only for date fields and specifies
r n
a value,ufor
the pattern of the date field e
s example, dd/MMM/yyyy
u m t o
(k text sfile
In this example, the
R e contains five columns: Product_ID, Product_Name,
A land n
Category,
U MStatus, iceList_Price. The cellWrapper attribute indicates that each
IT K
column value is present within quotation marks.
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Defining a Text Query

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Defining U a Text Query
K
T you update the textpds.conf file, launch Reports Builder.
IAfter
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Sample Text PDS Report

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M PDSlicReport
SampleUText
I T K
The Paper Design view for the Text PDS report is displayed. The report style is Group
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using JDBC as a Data Source

a ble
f e r
ans
n - t r
a no
h a s
JDBC data sourceom
) eฺ
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using JDBC
U c Source
M as aliData
I T K
Java Database Connectivity (JDBC) is an application program interface (API) that
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Configuring the jdbcpds.conf File

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
JDBC Configuration
U l ic File
I T
The
Kjdbcpds.conf file is the configuration file for the JDBC Query of Oracle Reports
VN and is located under ORACLE_HOME\reports\conf. In this file, you specify
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Technical Note
Oracle provides a set of Merant DataDirect drivers that can be downloaded from the
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Defining a JDBC Query

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Defining U M c
a JDBCliQuery
I T K
After configuring the relevant JDBC drivers, you can define and run a JDBC query using
VN
NA 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 database’s 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Defining a JDBC Query

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Defining
U M c (continued)
a JDBCliQuery
I T K d. Connect button: Displays the Connect dialog.
VN e. Enter the connection information such as user name, password, and database
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding New Data

1 le
r a b
5 2 s f e
- t r an
3 o n
6
s an
4 ) ha
7 o m ideฺ
c
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U Query
1 KSQL 5 Express Server Query
N I T
V 2 XML Query 6 JDBC Query
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding New Data

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
AddingUNew
en
MADatalic(continued)
I T K
To create a new query using the Data Wizard:
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding New Data (continued)


Creating a New Query Manually
To define an additional data source manually, open the Data Model view of the Report
Editor, select the appropriate tool in the vertical toolbar, and click in the Data Model
painter area to create a new query. Tools are provided for SQL Query, XML Query, Ref
Cursor Query, JDBC Query, Text Query, and Express Server Query.
A Query object appears and the corresponding editor opens. Create the query statement as
in the Data Wizard.
Note: If you have registered your own pluggable data source in 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,
r a ble
G_employee_id, G_department_id, and so on. fe
s
- t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using REF Cursor Queries

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using REF
U M Cursor l icQueries
I T K
A REF cursor query uses PL/SQL to fetch data. Each REF cursor query is associated with
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using REF Cursor Queries (continued)


2. In the Data Model view of the Report Editor, select the Ref Cursor Query tool and
click in the Data Model painter area.
3. In the PL/SQL editor, enter the PL/SQL function that opens a cursor and returns a
cursor variable of the REF cursor type you defined in the package.
FUNCTION QR_1RefCurDS return RefCurPack.EmpCurType is
V_EmpCur RefCurPack.EmpCurType;
BEGIN
OPEN V_EmpCur FOR SELECT * FROM employees;
RETURN V_EmpCur;
END;
4. Refine the query properties as desired.
5. Define break groups as required using the Data Wizard.
a ble
Reference f e r
ans
For more information on REF cursors, see Reports Builder Online Help. n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Viewing Output from Multiple Query


Reports

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Viewing U M l
Output fromic Multiple Query Reports
I T K
When you reenter the Report Wizard and update the paper layout based on multiple
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Viewing Output from Multiple Query Reports (continued)


Example
In the report opposite, the G_ORG group appears to the right of the hierarchical model of
G_DEPT and its related child group G_FIRST_NAME; therefore, the department and
employee records are formatted in the output before the department location records.
The output shows a master-detail listing of departments and employees. After all
departments have been processed, a tabular list of departments appears.
If you want to output the department information first, move Q_DEPT and G_ORG to the
left of, or below, G_DEPT. G_FIRST_NAME is always related directly to G_DEPT
because the two groups are owned by the same query.
Remember to reenter the Report Wizard to update the layout after you modify the Data
Model.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-31 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Data Links

Equijoin
DEPARTMENTS

Department_Id Department_Name

90 Executive
EMPLOYEES
a ble
100 Finance f e r
Last_Name Department_Id ans
n - t r
DeHaan 90 a no
h a s
Department_Id = m ) eฺ
Greenberg
l ฺ c o u100
id
Department_Id a i G
g m ent
3 1 @ Faviet t u d 100
v n it is S
r n a e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Using Data
U Links
K
IATdata link defines a relationship between a group and a query, or between two data
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-32 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Data Links

• Compound join:
– Multicolumn primary or foreign key
– Define multiple equijoins
• Nonequijoin:
– Primary key value between two other values le
r a b
– Create two links:
s f e
- t r an
o n
an
employees.salary >= job_grades.lowest_sal
s
) ha
employees.salary <= job_grades.highest_sal
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
Using Data M en
ALinkslic(continued)
K U
T
NIAunderlying
data link often corresponds to a primary/foreign key relationship between the
V database tables. The common SQL term for this is a join.
NA
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 relationship—that 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-33 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Column-to-Column Link

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M l ic
a Column-to-Column Link
K
T you have learned, Oracle Reports permits multiple queries in a single report and each
IAs
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-34 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Column-to-Column Link (continued)


To modify the link definition, open the Property Inspector using the right mouse button or
double-click the link object in the Data Model or Object Navigator. You can modify the
SQL Clause and Condition properties; both have lists of values.
• Change the SQL Clause property from the default WHERE to HAVING or START
WITH.
• Change the Condition to any logical operator in the list, such as >= or <=.
The other properties are read-only. If you want to change the parent or child properties,
you must delete and re-create the link.
Creating a Multiple-Query Linked Report
Assume the following two queries within a report.
Query: Q_EMP:
r a ble
SELECT d.department_id, d.department_name, e.last_name,
n s fe
e.job_id, e.salary -tra on
FROM employees e, departments d
a n
WHERE has
e.department_id = d.department_id
)
Query: Q_JOB: om uide ฺ
l ฺ c
ai t G
SELECT department_id, job_id,mcount(employee_id)
@ g den
count_names
n i t 31 s Stu
FROM employees v na hi t
ar usejob_id
GROUP BY department_id,
m to
You need to link ( k u e job information for each department instead of one
them tosdisplay
A R e n
separateM
U c The link in the Data Model is from the
list at theliend.
I T K
Q_EMP:DEPARTMENT_ID column to the G_JOB:DEPARTMENT_ID column.
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-35 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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)
r a ble
• Automatic: Using primary/foreign key constraints to sfe
n
form the link (SQL queries) -tra on
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Other Data
U ic
M Link lMethods
I T K
There are two other types of data links that you can create:
VN
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-36 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Other Data Link Methods (continued)


Create a manual link for the following reasons:
• Define a complex join condition in a query
• Implement a Cartesian product, linking two tables without a join condition
• Link a query that contains objects columns or REF columns
• Link a REF cursor query using parameters in the REF Cursor query function
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
le
child queries. You must include the primary/foreign key columns in your queries.
e rab
a n sf
n -tr
n o
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-37 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Efficiency Issues: Multiple- or Single-


Query Hierarchy

• Outer joins
• Data ratio
• Multitier environment

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Efficiency
U MIssues:licMultiple- or Single-Query Hierarchy
I T K
You can create the department/employee group hierarchy with two queries instead of one.
VN
NA If you link these two queries, the data structure is the same as the single-query example;
that is, a two-level, master-detail hierarchy.
Because you can build a similar report structure using a single-query or a multiple-query
data model, your choice depends partly on your report requirements—that is, whether you
require an outer join report, and on the ratio of master to detail records in your data tables.
Outer Joins
Consider whether you want to display all master records, regardless of any existing details
(outer join), or only those master records that have related details.
You can add the outer join notation (+) to a single query, but if you require many or
complex outer joins, consider using multiple queries that fetch all records in the master
query even if there are no records in the detail query.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-38 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Efficiency Issues: Multiple- or Single-Query Hierarchy (continued)


Data Ratio
Consider the likely ratio of master to detail rows. As a general guide, use a single query
for many master records with relatively few details.
If your data contains relatively few masters with many details each, however, consider
using two queries with a link. This means that you retrieve the columns for each master
record only once (in the master query) instead of repeating the master columns for every
detail row in a single query.
Multi-tier Environment
A multi-tier environment is a strong argument for reducing the number of queries on the
database to a minimum. Multiple queries for a hierarchical report result in far greater
network traffic in order to fetch records from each query separately.
r a ble
Note: You can use SQL*Trace to analyze your report; for example, see how much time
n s fe it
t
is taking to retrieve data from the database. You will learn more about analyzing
- r aand
tuning your report in a later lesson.
a non
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-39 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
cursor query fe r a
n s
• Create a relationship between data in different n-tra
queries using a data link a no
h a s
• Design the data model to be most efficient
)
om uideฺ
l ฺ c
m ai t G
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
Summary M A licen
K U
T
IPluggable Data Sources
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-40 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 9
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-41 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 9


1. Open p8q1_a.jsp.
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. r a ble
g. Note how the data appears in the Paper Design view. The G_CUSTOMER_ID n s fe
- t r a
data appears before the G_ORDERS data. Remember that you
n o n alter the
can
order in which the data is displayed by modifying the queryaorder in the Data
Model. You may want to try that. h a s
Note: If you do adjust the order of the queries, m ) eback
put them ฺ in the original
c o i d
order and save before the next question.ailฺ G u
h. Save the report as p9q1.jsp. g m e n t
@ d
2. Continue with the same report.
n i t31 is Stu
a. In the Data Model, link
r n av theetwothqueries together on the primary and foreign
keys.
u m a
t o us
Hint: To
R (kcreatesthee link, select the Link tool. Click and drag from the primary
n
A fieldliincethe Customer_Id group to the foreign key field in the Orders group.
key
U M
I T Kb. Redo the layout by opening the Report Wizard. Select the Group Above style.
Do not display CUSTOMER_ID.
A VN c. Save the report as p9q2.jsp.
N
d. Run the Web layout.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-42 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 9 (continued)


3. Create a new report that lists the sales representatives and the products they have
sold.
a. Create both a Web and paper layout and select a Group Above report style.
b. Import the query file p9q3_a.sql.
c. Make NAME and EMPLOYEE_ID the group fields. Make sure that these fields
are in one group, at Level 1, and not two separate groups.
d. Do not display EMPLOYEE_ID, but display all other fields in the order described
in the table below.
Hint: You can change the order of fields in the Report Wizard in the Displayed
Fields text region.
e. Change the following field attributes:

Column Label Width a ble


f e r
name Name 15 ans
n - t r
product Product 15
a no
product_id ID 4 s
a
) h eฺ
quantity Quantity 4 m
prod_total Total
o
5ailฺc Guid
g m ent
f. Use the predefined Gray template.
i t 3 1@ Stud
g. Click Finish to run youra v npaper layout.
t h is
h. Now you need rn not
toashow u e which products the sales representatives have
sonly
m
ku whosearetothe customers they have done business with.
sold but (also
GoA toRthe Data enModel and add a new query, importing the file p9q3_b.sql.
M l i c
U This query returns the customer names, their IDs, and the total sales per customer
I T K
N for each sales representative.
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-43 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 9 (continued)


4. An international business has warehouses around the world. The database at
corporate headquarters maintains information about each of the warehouses
(warehouse id, name, city, country, and so forth). However, each warehouse stores it
operational data locally in a relational database. A planning team at headquarters
needs to access this inventory data for every warehouse. The warehouse data is only
available as an XML stream.
Create a report that combines general data stored in headquarters with the inventory
data from each warehouse location.
a. Create a new report manually.
b. In the Data Model view, create a SQL query. Import the SQL query
p9q4.sql.
c. Create an XML Query. For the Data Definition, locate the file
warehouse_inventory.xsd. For the Data Source, locate the file r a ble
n s fe
warehouse_inventory.xml.
- t r a
d. Link the two data sources together so that your report will provide
n onfor each
a general
description of each warehouse along with the specific inventory
s a
location. a
) hSelect
e. Create both a Web and paper layout for this o m
report. d e ฺ the Group Above
c i
ailฺ andtdisplay
style. Ensure that both groups are selected
m G u all fields. Use the Blue
template for this report.
@ g den
f. Save the report as p9q4.jsp.
n i t31 is Stu
g. Run the Web layout.
r n av e th
5. Create a new report
m s cursor query.
ausing auREF
u
(k Navigator,
a. In the Object e t o create a local package called RefCur defining a record
R
A a REF n s
UM
and cecursor. The record has the following fields:
li
K
IT Name Definition
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 9-44 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enhancing Reports Using the Data Model:


Creating Columns
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Create report summaries and subtotals s
t r a n
• Derive data using a formula column on -
n
• Create and populate a placeholder sa ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview
U
T K
IWhen you define a query to extract the data from the database or from another data source
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Data Model Columns

1 le
r a b
s f e
- t r an
o n
2
s an
) ha
3 c o m ideฺ
m ailฺ t Gu
4 @ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U source columns
1 KData
N2I T Summary column
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Data Model Columns (continued)


Developer-Created Columns
A developer-created column can be one of three types:
• Summary column: Summarizes another column and can recalculate for each record
in a specified group
• Formula column: Uses a formula you have written in PL/SQL to calculate a value
from one or more other columns
• Placeholder column: Has its value set from another object at run time
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


a ble
Summary CS_1
f e r
Formula CF_1 ans
n - t r
Placeholder CP_1 o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Maintaining Data Source Columns

Read-only
properties

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Maintaining
U c
M DataliSource Columns
T K
IBecause
N Reports Builder creates data source columns from the contents of the query
V
NA statement, there are some restrictions on how you can modify these columns.
To display a column’s Property Inspector, as for other report objects, you can use one of
several methods:
• Double-click the Column icon in the Object Navigator.
• Double-click the column in the Data Model.
• Select the column and use the right-mouse-button menu.
• Select the column and use the Tools menu.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Maintaining Data Source Columns (continued)


For data source columns, some of the property settings are not editable in the Property
Inspector. You can see the values, but you cannot modify them. These values are
dependent on the column name and type in the data source definition.
The read-only properties are:
• Name
• Column Type
• Data type
• Width
All editable properties, except Value if Null, provide a list of values.
Some properties may or may not appear in the Property Inspector, depending on the
column datatype or on the value of another property.
a ble
Note: The column types Database - Object and Database - Ref refer to object columns e r
and reference columns in Oracle 10g. Their properties should not be changed.tran
sf
-
ondelete
You cannot delete a data source column object directly from the group.nTo a
column, you must remove the corresponding expression from the a
sdata source definition.
h a
) in theequery.
For database columns, you must edit the SELECT statementm ฺ
c o i d
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Producing File Content Output

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Producing
U ic
MFile Content
l Output
K
T can include in your report the contents of a file for which the filename varies for each
IYou
V N
NA record retrieved. The file can contain an image—for 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Producing File Content Output (continued)


To create a file column:
1. Open the column Property Inspector.
2. Set Read from File to Yes.
3. Select the appropriate file format from the list of valid types.
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Column

Summary column
• What type of value?
Choose the correct column Formula column
tool
Placeholder column

a ble
f e r
ans
• What frequency? C_xxx n - t r
C_xxx
a no
Create in a group or s
h
) eฺ a
at report level o m
a i lฺc Guid
m ent
C_xxx
g
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M
a Column l ic
I T K
There are two important questions to ask yourself before you create a column:
VN
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Column (continued)


To create a column:
1. Select the appropriate tool from the toolbar in the Data Model editor. Click inside a
group to create the column at the same frequency as other columns in that group.
Note: To display the column once for the report, click in an open area of the Data
Model editor.
2. Double-click the column to display its Property Inspector.
3. Replace the default column number with a brief but descriptive name. Consider
standard naming conventions for different types of columns.
4. Fill in the rest of the settings as appropriate for the type of column you require.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Summary Columns

• Specific properties:
– Function
– Source
– Reset At
– Compute At le
r a b
• Data type depends on Source data type s f e
• Page summaries: Not supported in the wizard - t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
CreatingU Summary Columns
K
IATsummary column performs a computation on another column’s data.
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Summary Columns (continued)


The datatype of a summary column depends on the data type of the source of the
summary. If you change the data type of the source column, the datatype of the summary
also changes.
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying Subtotals
Reset At:
G_DEPARTMENT Report

a ble
f e r
1
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
2 @ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1 KDepartment totals
N2I T Report total
V
NA
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_DEPARTMENT—that is,
values start from zero for each new department record.
• The report total at report level is reset at Report.
To create an accumulating total for the department total, change the Reset At property to
Report.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying Subtotals (continued)


The Reset At property displays only options that are valid for each summary.
There are two options, Report and Page, that are valid for all summaries. Depending on
the level of the summary, some groups are also available in the valid list.
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying Percentages
Reset At: G_EMPLOYEE G_EMPLOYEE
Compute At: G_DEPARTMENT Report

a ble
f e r
ans
n - t r
2 o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T KDepartment percent of total
N I
V 2 Employee percent of total
NA
Displaying Percentages
The control break report shows the following two percent of totals created by the Report
Wizard:
• Employee’s 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying Percentages (continued)


The Reset At property works the same way that the Sum function does. The default, Reset
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 era
ble
f
percentage of the whole report value, change Compute At to Report.
- ans
tr
no n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 a ble


f e r
G_EMPLOYEE Running Total Running Total ra
Record-tTotal
ns
n on
a s
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Resetting
U MSummary l ic Values
I T K
The Data Model group defines how often a value is calculated. Therefore, Reports Builder
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
f e r
a n s
function CF_SALCALCFormula return Number is n -t r
n o
begin
return(my_function(:salary)); ha s a
end; m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M l
a Formula ic Column
I T K
A formula column performs a user-defined computation on the data of one or more other
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Formula Column (continued)


Note: The code displayed is a simple example to illustrate the syntax. The
MY_FUNCTION function might be a local program unit at report level, a program unit in
an attached PL/SQL library, or a stored program unit.
Consider using a formula column only if you cannot include your calculation in the query
statement.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
level
n s fe
– Formula column in same
- t r a
group or below non
CF_xxx a
as
placeholder
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M l ic Column
a Placeholder
I T K
A placeholder column is an empty container at design time. The placeholder can hold a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Placeholder Column (continued)


Using placeholder columns, you can:
• Populate multiple columns from one piece of code. You can calculate several values
in one block of PL/SQL code in a formula column and assign each value to a different
placeholder column. Thus, you create and maintain only one program unit instead of
many.
• Store a temporary value for future reference. For example, store the current maximum
salary as records are retrieved.
You cannot populate a placeholder by writing code in the placeholder’s own Formula
property.
The PL/SQL Formula button opens up the Program Unit editor where you enter and edit
your code. This is applicable only when you call a user exit.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Populating a Placeholder Column

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Populating
U ic
M a Placeholder
l Column
K
T sample report shown is a report of all employees. The aim of the report is to:
IThe
V N
NA • 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 earner’s name at run time
• A formula to:
- Compare each employee salary with the maximum salary
- Populate the placeholder with the employee name if salary equals maximum salary

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Populating a Placeholder Column (continued)
To create the columns:
1. Create a summary column CS_MAX_SALARY at report level (outside all groups).
Data type: Number; Width: 10; Function: Maximum; Source: Salary; Reset At:
Report
2. Create a placeholder column CP_MAX_EARNER at report level (outside all
groups). Data type: Character; Width: 80
3. Create a formula column CF_CALC_MAX in the G_EMP group. Data type:
Number; Width: 10 (these are the default values)
4. Open the Program Unit editor from the PL/SQL Formula property in
CF_CALC_MAX. Create a function:
function CF_CALC_MAXFormula return Number is
begin
if :salary = :CS_MAX_SALARY then
r a ble
:CP_MAX_EARNER := (:LAST_NAME||’ in sfe
n
Department ’||:DEPARTMENT_ID||’--’ -tra
||:DEPARTMENT_NAME); a non
a s
end if;
m ) h eฺ
return(0);
i l ฺ co uid
end; a m ent G
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
output: f e r
ans
– Reset At: Resets to zero n - t r
o
– Compute At: % of Total only s an
• Create Formula columns to returnm ) ha eฺ
values
o uid
• Create Placeholder columnsato ilฺcholdGvalues
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Column Types
VN
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 10
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 10


1. Create a new report using the Report Wizard. Create both a Web and paper layout
and select a Group Above report style.
a. 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. r a ble
s e
fthe
d. Create the following summaries. Can you use the Report Wizard to create
t r a n
summaries? on -
a n
Column Summary a s
line_total sum m ) h eฺ
i l ฺ co uid
line_total % Total
g ma ent G
e. Specify the following labels
i t 3 1and S tud
@ widths.
a v n this
Column
order_id um
arn Labelu seNo.
Ord.
Width
4
( k t o
A R ense Order Date
order_date 10
li c
M line_item_id No. 2
IT KU product_id Product No. 5
V N
NA unit_price
quantity
Price
Quantity
4
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 10 (continued)


2. Open the p9q3.jsp report .
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 a ble
f e r
employees employee_id ID 2
ans
first_name First Name 6 n - t r
last_name Last Name 6 a no
h a s
salary Salary
co m)8 ide

Include a summary of the salary column in lฺ report.
aithe G u
b. Use the Beige template and finish m n t
g the dWizard.
e
@
31 s Sby
c. Modify the report to listitemployees tusalary, beginning with the highest paid
in each department. n
av e thi
r n
d. To displaym
u t o usadd a column call RANK in the group
thearanking,
(k se
G_EMPLOYEE_ID.
R
e. A
M l i en Wizard to display the rank, giving it a width of 2.
Use the cReport

IT KUf. Run the paper layout to test.


N g. Save the report as p10q3.rdf.
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 10 (continued)


4. Open the p10q1.rdf report to display the highest and lowest orders at the end of
the report.
a. In the Data Model, add the columns necessary to list the maximum order total
and the corresponding ORDER_ID, as well as the minimum order total and the
corresponding ORDER_ID.
Hint: You need one formula column and two summaries and two placeholders.
You can copy the code for the formula column from the file p10q4.txt.
b. Use the Report Wizard to add the new columns to the layout. Display the
maximum order total, the maximum ORDER_ID, the minimum order total, and
the minimum ORDER_ID.
c. Run the paper layout to test. Scroll down to the last page to see the new columns.
d. Save the report as p10q4.rdf and close it.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 10-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enhancing Reports
Using the Paper Layout
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Objectives

After completing this lesson, you should be able to do


the following:
• Identify the paper report sections
• Design multipanel reports
• Mail a report ble
fe r a
• Distribute a report to various destinations s
a n
• Describe the layout objects and relationshipson-tr
n
• Modify an existing paper report layout s a
) ha
• Create variable length lines om eฺ
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OverviewU M l ic
I T K
You can fulfill many of your paper report requirements simply by making modifications
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Viewing the Paper Layout

Header Compensation
section Report

Page 1 of 1
Main a ble
section f e r
ans
n - t r
a no
h a s
m ) eฺ
o uofidreport
Trailer
sectionma
ilฺc End G
g e n t
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Viewing U M
the Paper l icLayout
I T K
The Report Editor Paper Layout view enables you to define and modify the layout objects
VN
NA for a paper report. Layout objects define the report’s appearance and are displayed in the
Paper Layout view.
The Paper Layout Sections
The Paper Layout editor allows you to modify the report layout in three sections: header,
main, and trailer. Each section has its own body and margin area. Report sectioning
allows you to define multiple layouts for the same data model, producing output in a
number of styles. For example, a single report can include an executive summary in the
header section, and a detailed breakdown in the main section.
When you enter the Paper Layout editor, you see the body region of the main section of
your report. To change the section, choose the Main Section, Header Section, or Trailer
Section tool, or choose View > Layout Section > Header, Main, or Trailer.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Viewing the Paper Layout (continued)


Header Section: The header section consists of one or more pages that appear once, on a
separate set of pages, as the first part of the report.
Main Section: By default, the Report Wizard creates the paper layout in the Main Section
of a report, positioned between the header and trailer pages.
Trailer Section: The trailer section consists of one or more pages that appear once, on a
separate set of pages, as the last part of the report.
Note: In the Object Navigator window, the three report sections are listed under the Paper
Layout node.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Viewing the Section Areas

Header Compensation Body/


section Report Margin

Page 1 of 1
Main Body/
a ble
section Margin f e r
ans
n - t r
a no
Trailer h a s Body/
End of report ) ฺ
section
l ฺ c om uide Margin

m ai t G
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Viewing U Section Areas
the
K
T Paper Layout editor allows you to modify the body and margin report areas in one of
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Designing Multipanel Reports

Logical Page 1
Panel 1
Physical Page 1
Header Logical Page 1
Panel 2
Physical Page 2

Logical Page 1
Panel 1
Logical Page 1
Panel 2 a ble
f e r
Main Physical Page 3 Physical Page 4
ans
Logical Page 1 Logical Page 1
n - t r
Panel 3
Physical Page 5
Panel 4
Physical Page 6 a no
h a s
Logical Page 1 m ) eฺ
l o
ฺc Guid
Trailer Panel 1
a i
Physical Page 7
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Designing
U MMultipanel
l ic Reports
I T K
Reports Builder enables you to design large, or multipanel, report layouts by maintaining
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Designing Multipanel Reports (continued)


To define dimensions for a section of the report:
1. Select the Header Section, Main Section, or Trailer Section node in the Object
Navigator.
2. Open the Property Inspector.
3. Specify physical page size: Width and Height properties.
4. Specify logical page size: Horizontal Panels per Page/Vertical Panels per Page
properties.
Define the logical dimensions in multiples of the physical page width and height.
5. Define the page orientation as required.
Example: In the diagram opposite, the layout is twice the width of the physical page. For
example, to output a logical design of 16 inches across 8-inch pages, the settings are:
• Unit of Measurement: Inch
r a ble
• Physical Page Height: 8
n s fe
• Horizontal Panels per Page: 2 - t r a
• Vertical Panels per Page: 1
a non
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Printing Multipanel Reports

Page 1-1 Page 1-2

Page 2-1 Page 2-2 a ble


f e r
ans
n - t r
a no
h a s
Logical horizontal panels = )2
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PrintingU Multipanel Reports
K
T default order in which panels are printed is across/down. That means that horizontal
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Different Objects in the Paper Layout

4
5
1
2 a ble
f e r
3 s
- t r an
n
no
s a
) h a 6
om uide ฺ
l ฺ c
m ai t G
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1
K UFrame
N I T
2 Repeating frame
N AV 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Different Objects in the Paper Layout (continued)


• Field: A field defines the appearance of a column’s data. It may contain character,
number, date, graphics, image, or sound data. Created by default or by the developer
• Boilerplate: Hard-coded text or graphics that appears in a report every time it is run.
Created by default or by the developer
• External Boilerplate: Text or graphics that appears in a report every time it is run,
but read from a file. Created by the developer
• Graph: An object that allows data to be represented in a graphical way
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 ble
ra
n s fe
- tra
no n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Paper Layout Layers

F_xxx F_xxx
R_G_xxx
a ble
M_G_xxx
f e r
ans
Body n - t r
a no
h a s
Layers of a tabular report m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
The PaperU MLayoutlicLayers
I T K
All layout objects exist in a hierarchy. Each object is contained inside and on a layer
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Paper Layout Layers (continued)


Group Reports
Group Left and Group Above reports create two repeating frames; the detail group frame
is nested inside the master repeating frame to produce a detail tabular listing for each
master record.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Avoiding Layout Errors

• Confine Mode

• Flex Mode
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
AvoidingU c
MLayoutliErrors
I T K
To avoid common hierarchy errors in your report layout, always work in the Paper Layout
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Avoiding Layout Errors (continued)


• Flex Mode
- 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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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


a ble
f e r
ans
END M_G_detail n - t r
a no
h a s
m ) eฺ
o uid
a ilฺc M_G_master
END
G
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ReportU M
Processingl ic
I T K
To understand how the Paper Layout maps to the output that you see in the Paper Design
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Processing (continued)


Layout objects often show symbols and icons that indicate their characteristics. The
diagram opposite shows two of these symbols:
• Black arrowhead: Indicates a repeating frame object
• Diamond: Indicates that the object is a variable size; it can increase or decrease in size
depending on the contents

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Layout Objects

The tool palette contains:


• Standard GUI drawing tools
• Frame, repeating frame, field objects 6
• Other layout objects
1 ble
f e r a
ans
n - t r
2 a no 7
h a s
3 m) ฺ 8
c o i d e 9
m ai4lฺ t Gu
@ g d5en
it3 is S 1 tu
v n
a e th
r n
a Copyrightus© 2004, Oracle. All rights reserved.
m
k se to
u
(
R en
A lic
1 K UM
Drawing objects 6 Text
I T
N 2 Frame
V 7 Repeating frame
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Layout Objects (continued)


When you create a layout object, the default name is an alphabetic character that indicates
the object type, followed by a number. Rename your layout objects meaningfully to help
you in developing and maintaining the report.

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
r a ble
it is run, but is read from a file on disk
n s fe
Anchor None A layout object that anchors the position of one object
- t r a
ondefault
relative to another; create an anchor to overridenthe
a
position as
) h eฺ
Technical Note m
co uid
i l ฺ
The ability to embed an OLE2 object in a report
g mais obsolete
n t Gin Oracle Reports 10g. While
existing applications using OLE2 objects
3 1 @
shouldtu de to run without modification,
continue
n
this functionality can be mimicked t usingismime
iby S types with associated plug-ins and
v h
hyperlinks.
a rna use t
( kumse to
A R en
U M l ic
I T K
VN
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Paper Layout Tools

• Pin a tool: Double-click

• Shift key for constrained objects

• Magnify a ble
f e r
ans
n - t r
• Frame Select
a no
h a s
m ) eฺ
• Report Block o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
The PaperU MLayoutlicTools
I T K
In addition to the object tools in the tool palette, the Paper Layout provides some specific
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Bursting

Trailer Æ HTML

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ReportU M
Bursting l ic
I T K
The capability of producing multiple copies of a given report or portions of it in different
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Bursting

Dept 10
West East

Dept 20
West East

ble
; f e r a
Dept 30 ans
West East
n - t r
a no
h a s
Dept 40 m ) eฺ
…… ailฺc t Guid o
g m en
Dept 3 @ tud
180
n i t i s S
v h
a rna use t
( kumseCopyright
to © 2004, Oracle. All rights reserved.
A R en
ReportU M
Bursting l ic
(continued)
I T K
With Oracle Reports, you are also able to burst on repeating data within a report. This
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Bursting on a Repeating Group

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
BurstingU a Repeating Group
on
K
T set up a report to burst on a repeating group:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Bursting on a Repeating Group

Setting the Repeat On property

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Bursting
U a Repeating Group (continued)
on
T K
IExample
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating an Additional Layout

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
CreatingU Additional Layout
an
K
T create a layout for the header and trailer section of your paper report:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating an Additional Layout (continued)


Using the Report Block Tool
The Report Wizard creates the initial layout for your report. You might want to create
additional parts of the layout without affecting the layout that is already there. Both
layouts use the same data; there is no need to create additional queries.
Reports Builder provides the Report Block tool, which enables you to build an indefinite
number of additional layouts based on all or part of the Data Model.
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. r a ble
5. Select the group you want and the direction to print the records. n s fe
- t r a
6. Complete the Wizard tabs as before. on
n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Distributing a Report

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M a Report
Distributing
U l ic
I T K
Report distribution enables you to send all or part of a report to numerous destinations,
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Distributing a Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M
Distributing
Aa Report
l i c en(continued)
K U
T
ITo distribute a report:
VN 1. Define the distribution
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Tracing the Report Distribution

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Tracing U M Report
the l ic Distribution
I T K
You can check a report’s distribution without actually distributing the report through the
VN
NA Reports Builder Trace facility. The trace file will state which distribution lists were used
and which section was sent to which destination.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Tracing the Report Distribution (continued)


To trace the report distribution:
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Variable Length Lines

Flex lines adjust to fit variable frames


and repeating frames.

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Creating U MVariablel icLength Lines
I T K
The line drawing tool enables you to draw straight vertical lines between columns of a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Variable Length Lines (continued)


• To make the line stretch to fit the group frame, draw the line from the top of the
column labels through the repeating frame. Change the property Line Stretch with
Frame to the group frame, M_xxx_GRPFR.
Paper Design Versus Paper Layout
You can create and modify a line in the Paper Design or in the Paper Layout. There are
advantages and disadvantages to both:
• Paper Design: It is easy to create a line and change the property. You can easily see
the line stretching with the data, but you cannot move the line outside its enclosing
object, because you cannot disable Confine Mode.
• Paper Layout: You can disable Confine Mode to change the position of the line, but
you cannot see the effect of Line Stretch with Frame until you view the report in the
Paper Design. a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-31 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
• Variable length lines s
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
In this lesson, you learned to modify a paper report layout in the Paper Layout.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-32 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 11 Overview

• Using report sections


• Adding a repeating frame to the header page
• Adding flexible lines
• Distributing a report
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 11
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-33 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 11


1. Open report p10q1.rdf. Modify the report as follows:
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 today’s date in the top right portion of the margin.
b. Add a report title in the body region.
Use Arial bold as the font and 20 as the size.
c. Add a trailer section that displays today’s date with the text “End of Report” on
one line, and “Report run on: ” on the second line in the body region. Select a
larger font.
Hint: Copy and paste the date from the Margin Area of the header section of the r a ble
report. n s fe
- t r a
d. Save the report as p11q1.rdf.
n on
e. Run the Paper Layout. Run the Web layout. What is different?
s a
2. Open report p10q1.rdf. a
)allhorder
a. Modify the report to add a header section that o m
lists d e ฺ numbers, order dates,
c i
and order totals in the body region.
m ailฺ t Gu
b. Add “Executive Summary” as boilerplate
@ g text d e nin the margin region of the header
section.
n i t31 is Stu
c. Set the distribution for
r n avthe header
e th section to an HTMLCSS file.
d. Set the distibution
m s section to a PDF file.
a for theumain
u
k thesreport
e. Run and(test t o
e using the Distribute facility in Reports Builder.
f. Look R
A at the n
e generated for both file formats.
output
U M l i c
I T Kg. Save the report as p11q2.rdf and close it.
A VN 3. warehouse
Open report p11q3.rdf. Modify the report to burst on repeating data, based on
ID, and distibute a PDF report for each warehouse.
N
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-34 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 11 (continued)


c. Define the distribution for the report. Generate a PDF file for each warehouse,
using the warehouse name as a unique identifier for each PDF file, such as
rptBejiing.pdf.
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. r a ble
5. Open and run report p2q10.rdf. n s fe
- t r a
a. Using the Paper Design view, compare the output with s11q5a.rdf.
n o n What is
different? Change the report so that it looks like s11q5a.rdf. a
b. Fully expand the Paper Layout node for p2q10.rdf. a s
c. Open the Paper Layout and move the windowoto m ) h eฺMake sure it doesn’t
the right.
obscure the Object Navigator window. ailฺ
c
G uid
d. Move the F_EMPLOYEE field down g m2 inches.
e n tIt should not be enclosed by any
frame. i t 3 1@ Stud
a
e. Resize the R_G_EMPLOYEEv n thframe is so that it only encloses the F_SALARY and
arn use
F_JOB_ID fields.
m
(
f. Resize the e to
kuM_G_EMPLOYEE_GRPFR frame so that it encloses the
R
A lice
R_G_EMPLOYEE n s repeating frame.
U M
I T K g. Move the F_DEPARTMENT_NAME and F_DEPARTMENT_ID fields to the
right.
A VN h. Create a new repeating frame in the free space. Set the Line color attribute to No
N
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 11-35 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Controlling the Paper Layout:


Common Properties
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
f e r a
• Modify Web Settings properties s
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Overview U M l ic
I T K
All Reports Builder objects have properties that provide default settings, which in many
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying Paper Layout Object Properties

Accessing a Property Inspector:


• Object Navigator:
– Select object
– Double-click node icon abc
• Paper Design or Paper Layout view: ble
– Use Select Parent Frame tool f e r a
ans
– Select Tools > Property Inspector n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Modifying
U c
MPaperliLayout Object Properties
K
T have already seen that you can access the Property Inspector for any object in several
IYou
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Modifying Paper Layout Object Properties (continued)


• Using the Object Navigator:
- Select the object directly in the Object Navigator, where you can easily see the
name and type of object.
- To open the Property Inspector, click the node icon to the left of the object name,
or use the right-mouse-button menu.
• Using the Select Parent Frame tool:
- Select the top object in the Paper Layout or Paper Design. Choose Select Parent
Frame to select the enclosing object on the layer below. For example, select a
field, choose Select Parent Frame to select the repeating frame, and choose Select
Parent Frame again to select the group frame.
- To open the Property Inspector, select Tools > Property Inspector or use the Object
Navigator. le
e
Do not double-click the object in the Paper Design, because you will probably select ftherab
wrong object on the top layer. a n s
n -t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
NI T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Comparing Properties
Intersection Pin

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Comparing
U Properties
K
T compare the properties of two objects:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Common Layout Properties

Four objects with common properties:


• Frames
• Repeating Frames
• Fields
• Boilerplate Objects
a ble
f e r
Some common properties affect:
ans
n - t r
• Sizing o
• Pagination s an
) ha
• Frequency of display c o m i d eฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Common U Layout Properties
K
T layout objects share a number of common properties. This section explains how to
IMost
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Sizing Objects
Layout icons
Elasticity Vertical Horizontal

fixed

expand ble
f e r a
ans
n - t r
contract a no
h a s
m ) eฺ
o
variable a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Sizing U M
Objects l ic
I T K
You can create objects of any size in the Paper Layout. The elasticity properties enable
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Sizing Objects (continued)


How Wizard Report Styles Affect Elasticity
Frames: The Report Wizard sets the elasticity of enclosing objects, such as a group frame,
to allow for multiple occurrences of a repeating frame.
Fields: When you reduce the size of a character field in the Labels tab, the Report Wizard,
depending on the report style, sometimes alters the vertical elasticity of the field to allow
for additional characters.
Layout Style Horizontal Elasticity Vertical Elasticity
Tabular Fixed Expand
Group Above Fixed Expand
Form Fixed Expand
a ble
Form Letter N/A N/A
f e r
Mailing Label N/A N/A ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Anchors

• Objects in the push path have implicit anchors (not


visible in Paper Layout)

a ble
f e r
ans
• Explicit anchors override implicit anchors n - t r
no
• All anchors appear in Object Navigator s a
) ha
c o m ideฺ
ailฺ t Gu
Implicit (shaded)
m
g (solid)
Explicit e n
@ d
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
AnchorsU
T K
IAnchors are used to determine the vertical and horizontal positioning of a child object
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Anchors (continued)
The chart below compares implicit and explicit anchors.
Implicit Explicit
Not visible in the Paper Layout Visible in the Paper Layout
Created and maintained automatically by Created by the developer using the
Reports Builder anchor tool in the tool palette
Visible in the Object Navigator if Anchoring Information is enabled (Navigator
option)

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Layout Object Relationships

1
a ble
2 f e r
ans
n - t r
o
3 s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1T K
UNo relationship, no anchor
N I
V 2 Explicit anchor to enforce relationship
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Layout Object Relationships

4
1
2

3
a ble
6 f e r
ans
n - t r
5 o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
MA Relationships
LayoutUObject l ice (continued)
IT K
V N Layout Object Relationship
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Layout Object Relationships (continued)


More About the Push Path
By default, Reports Builder implicitly anchors each object to its immediate enclosing
object. However, sometimes Reports Builder must alter the implicit anchor to ensure that
objects do not overlap at run time when their size is not fixed.
Reports Builder uses an implicit anchoring algorithm to determine whether an object lies
in the push path of another object.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Pagination Icons in the Paper Layout

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Pagination
U c the Paper Layout
M Iconsliin
I T K
The four common properties that affect whether and where additional page breaks occur
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Pagination Icons in the Paper Layout (continued)


The Paper Layout displays icons representing each of the properties when they are set to
Yes (this is the default). These icons are very useful, especially for maintenance and
support. However, you can suppress these and other icons in the Paper Layout options.
1. Select Tools > Options > Paper Layout.
2. Click the Options tab.
3. Select or clear the options as required.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Page Break Before

-1-
1

-2-
xxx
xxx

a ble
f e r
-1-
ans
xxx -
-2-
n t r
o
2 xxx
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K UImage is not related to repeating frame
I
N2 T Image is in the push path of and implicitly related to the
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Page Break Before (continued)


Examples
Example 1: The repeating frame and image are not related. Therefore, when you select the
Page Break Before check box for the repeating frame, the image does not move to the
next page.
Example 2: The image is below, and in the push path of, the repeating frame. Therefore,
there is an implicit anchor between the repeating frame (parent) and the image (child).
The image formats after the repeating frame on the same page as the repeating frame.
Note: Setting Page Break Before on a repeating frame gives a page break before the first
occurrence of the repeating frame only. It does not provide a page break between each
record.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Page Break After

-1-
xxx
1 xxx

a ble
f e r
-1-
ans
xxx n - t
-2- r
o
2 xxx
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1K U Image and rectangle are not related to repeating frame; Page
N I T Break After has no effect
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Page Break After (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Page Protect

-1-
40
xxxxxxxx
f_dept_id
xxxxxxxx
Employee
-2-
f_ename
41 bl e
fe r a
xxxxxxxx
n s
xxxxxxxx -tra
on
xxxxxxxx
n
sa
axxxxxxxx
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Page
U M Protect l ic
I T K
Page Protect indicates whether to keep the entire object and its internal child (enclosed)
VN
NA objects on the same logical page.
Page Protect applies only to the first logical page on which the object normally formats;
Reports Builder ignores Page Protect on subsequent pages to avoid an infinite loop.
Example: A particular instance of a master repeating frame might contain so many detail
records at run time that it is not possible to display them all on the same page. If so, you
can force a page break before the master instance begins.
• To start the master on a new page, set Page Protect to Yes on the master repeating
frame.
• If there is no suitable frame to protect several objects, create your own frame, enclose
the objects in the frame, and set Page Protect on the frame.
Hint: If you create your own frame to protect several objects, give the frame a solid fill so
that you can ensure that you place it at the correct layer of the layout. The frame must be
behind all the objects it encloses.
Remember to remove the fill when you are satisfied with the layout.
Ensure that the frame’s elasticity properties are set to Variable, Expand, or Contract,
depending on the sizing of the objects it encloses.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Page Protect (continued)


Using Keep with Anchoring Object
The Keep with Anchoring Object property is similar to Page Protect, except that it affects
anchored objects instead of enclosing objects.
Keep with Anchoring Object is useful when you want to keep two objects together on the
same page.
If there is not enough room to display the child object on the same page as its parent,
Keep with Anchoring Object moves both parent and child objects to a new page.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Controlling Print Frequency

-1-
Your Company Your Company
-2-
Your Company
-3-
Your Company

a ble
f e r
an s
n - t r
Print Object On = All Pages a no
has
m)
Base Printing On = Enclosing Object
c o i d e ฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Controlling
U Print Frequency
K
T related properties, Print Object On and Base Printing On, control how often to print
ITwo
V N
NA the object in relation to another object.
Which Page?
Print Object On determines on which of the parent’s logical pages the object is printed.

Print Object on Object Prints on


All Pages All logical pages of the parent
All But First Page All logical pages except the first or last page
All But Last Page
First Page/Last Page The first or last logical page only
Default The option that Reports Builder chooses; Reports Builder
resets the property, using an internal algorithm; use the
default setting if you have made a mistake and want to return
to the report default

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Controlling Print Frequency (continued)


Which Parent?
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
e
Base Printing On to Enclosing Object (default). abl
er
a n sf
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 n - tr or
page,
o
“...continued” on all but the first page.
s an
hareceive an “invalid setting
There are several restrictions that apply to these settings. If you
)
om Builder
error,” look at the explanation and restrictions in the Reports
ilฺc Gui deฺ Help Topics.
a
m ent
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Format Triggers

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyrightus© e2004, Oracle. All rights reserved.
( ku se to
A R en
M Triggers
Using Format
U l ic
I T K
A format trigger is a user-written PL/SQL function that executes each time before the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Layout Object Properties for Web Support

• Hyperlink
• Hyperlink
Destination
a b le
• Bookmark fe r
a n s
• Application
- t r
n on Line
Command
a s
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Properties
LayoutUObject l ic for Web Support
K
T paper layout objects support Web features. Use the following Web Settings properties:
IAll
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Layout Object Properties for Web Support (continued)
Examples
• Dynamic Hyperlink
‘Dept Details’ || to_char(:deptno)
• Dynamic Bookmark
‘Company Car Policy, Category ’ || :level
• Application Command Line
C:\orawin10g\bin\rwrun.exe report=payload_det.rdf

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Summary

In this lesson, you should have learned how to:


• Identify common properties for most layout objects:
– Size
– Pagination
– Print frequency le
r a b
– Format trigger
s f e
– Web settings - t r an
o n
an
• Modify common properties for special reporting
s
needs ) ha m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Summary U
T K
IReport objects provide many properties that you can modify in the Property Inspector to
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 12 Overview

• Creating a break report with continuation pages


displaying limited information
• Modifying properties for object Web support

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 12
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 12


1. Create a new break report showing each customer and the relevant orders.
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 a ble
f e r
postal_code Zip: 5 ans
n - t r
country_id Country: 2 o
credit_limit Credit Limit: 6 as an
m ) h eฺ
d. Run the paper layout. What do you see? lฺco u id
a i G
e. Ensure that no customer data displaysm
g on a page
e n twithout details.
f. Save the report as p12q1.rdf.
i t 3 1@ Stud
g. Run the paper layout againn to test. is
a
n sev
2. Create a new tabularrreport. t h
a. Define the SQLm a as:u
( k u query t o
A R last_name,
select
e n se first_name, hire_date
U M l ic
from employees

N IT K Display all fields. Choose the Wine template.


V b. In the margin region of the report’s Main Section, delete the company logo.
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 12-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Controlling the Paper Layout:


Specific Properties
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Create a file link s
t r a n
• Specify the format order for the report sections
on -
n
• Enable cataloguing and searching of PDF s aoutput ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview U
T K
IIn the previous lesson, you learned about common object properties. There are however a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Properties of a Repeating Frame

a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Modifying
U MProperties
l ic of a Repeating Frame
I T K
A repeating frame is record-related, and its properties allow you to modify specific
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Specifying Print Direction

3
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Specifying
U ic
M Print lDirection
I T K
Print direction specifies the direction in which to print the repeating frame’s records, and
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Specifying Print Direction (continued)


Example
In diagram 1 opposite, the default print direction of the records is Down. Therefore, the
vertical elasticity property of the enclosing group frame is set to Variable to allow for a
variable number of records, but the horizontal size is fixed.
If you decide to alter the print direction to Down/Across as in diagram 2, you may need to
modify the properties of the enclosing group frame to be variable (diagram 3). If not, the
records still overflow to the next page.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Controlling the Number of


Records per Page
1 2
-1- -1-

-2-

-3- -2-
a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyrightus© e2004, Oracle. All rights reserved.
( ku se to
A R en
Controlling
U ic
M the Number
l of Records per Page
K
T can specify the maximum number of records that you want to display on each logical
IYou
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Controlling Spacing Between Records


Mailing Labels

1
2

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Spacing
Controlling
U l ic Between Records
I T
The
Kproperties Horiz. Space Between Frames and Vert. Space Between Frames control the
VN amount of space between occurrences of a repeating frame; that is, record spacing.
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Minimum Widow Records

Without widow control With widow control


(Min Widow Records = 3)

Page 1 Page 1

a ble
f e r
Page 2 Page 2
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Minimum U c
MWidowliRecords
I T K
You can specify the minimum number of records that must display on a page. The default
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Column Mode

Column Mode Off Column Mode On

Page 1 Page 1

10 20 10 20 30

a ble
f e r
Page 2 Page 2
ans
n - t r
20 30 20 a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Column U M
Mode l ic
I T
You
Kcan set Column Mode to Yes to allow the next instance of a repeating frame to begin
VN formatting before the previous instance completes. Column Mode is used mainly for
NA 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 frame’s print
direction is Across, and the employee repeating frame’s print direction is Down.
Use Column Mode to start formatting department 30 on page 1, and also to align the
overflow for department 20 on page 2.
Note: Column Mode does not make sense for repeating frames that have a print direction
of Across/Down or Down/Across.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Properties
U of a Field
K
IATfield is a layout container for a column or a parameter.
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Properties of a Field (continued)


The Source property provides a list of columns, of which there are three categories:
• Columns in the Data Model
• Parameters (always listed in uppercase)
• System variables, such as today’s date and current page number
The datatype of a field depends on its source.
Defining a Format Mask
When you insert a 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.
r a ble
The list provides all the format masks that exist in your preferences. Modify your sfe
preferences to include the common masks that you use, or enter a different mask
- t r ainn this
property.
a non
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

System Variables

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
MA licase the Source of a Field
SystemUVariables
I T K
The following table lists the variables and describes their display values.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
Page 1 of 1
End f e r
Page 2 of 2 ans
n - t r
Page 1 of 2
a no
Report h a s
Title m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
Page Numbering
U l ic
I T K
When the source of a field is one of the system variables for page or panel numbers, you
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Page Numbering (continued)


Example 2
To number all pages in the main section of a report, excluding header and trailer pages,
and to restart the numbering at 1 for each new department record in the repeating frame
R_Dept, you would specify:
Page Numbering Property Value
Include Main Section
Start At 1
Increment By 1
Reset At R_Dept
ble
s f era
Note: When resetting page numbers for each record in a repeating frame, make sure that
t r n
each record starts on a new page. Use the Maximum Records per Page property;athis
property of the repeating frame was discussed earlier in this lesson. on -
a n
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Valid Source Columns

G_Region

R_Region

F_1 R_Dept
G_Dept R_Emp
a ble
f e r
ans
n - t r
a no
G_Emp h a s
F_REPORT
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Columns
Valid Source
U l ic
I T K
When creating new fields, make sure that they exist at the correct level within the report;
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Valid Source Columns (continued)


Report-Level Fields
If you create a field outside any repeating frame, that is, at report level, the source column
must be a report-level column—outside all groups in the Data Model.
System columns, such as current date or page numbers, are report-level columns; you can
use these in report-level fields, or at any lower level of your report. For example, you can
display the current date at report level or within a repeating frame.
You often use the Header section or margin region of each section to display report-level
information.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying File Contents

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Displaying
U l ic
M File Contents
I T K
There is a special type of boilerplate object, called a file link, that does not have to remain
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying File Contents (continued)


To create a file link object:
1. In the Paper Layout toolbar, select the File Link tool. Drag an area in the layout to
create a file link object of the required size.
2. In the Property Inspector, change the name of the object.
3. Enter the name of the file link that you want to include in the output, and the format
of the file.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

When Are the Contents Updated?

Reports Builder reads the file contents when you:


• Modify the Property Inspector
• Open a report definition
• Run a report
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
When AreU ic
Mthe Contents
l Updated?
K
T Reports picks up the contents of a file link at run time. Therefore, the file contents
IOracle
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Linking and Importing Files

1 2
Import

Link
a ble
f e r
3 4 ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Linking U M Importing
and l ic File Contents
I T K
If the contents of a file might change, and especially if you want to use the same contents
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Comparing a File Link and a File Column

Q_EMP

G_EMP

a ble
PICTURE F_PICTURE
f e r
ans
1
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid 2
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
1 K U M lic
The layout field F_Picture depends on its source column PICTURE in the Data
N I T Model. The filename, and therefore the picture, can be different for each record.
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Specifying the Format Order

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Specifying
U M the Format
l ic Order
I T K
Earlier in the course, you learned that every report has three sections, Header, Main, and
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Specifying the Format Order (continued)


You then use report triggers to build a table containing the TOC entries. You learn about
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

PDF Document Taxonomy Properties

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
PDF Document
U ic
M Taxonomy
l Properties
K
T documents store properties that track general information about the document, such
IPDF
V N
NA as the document’s 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
f e r
• Specify taxonomy properties for PDF documents
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Report objects provide many properties that you can modify in the Property Inspector.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 13
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 13


1. Open report p4q4.rdf.
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. era
ble
3. Open p10q1.rdf. a n sf
a. On the operating system, copy the file summitlo.tif to a file n - tr
logo.tif.
a
b. Delete the logo in the margin area and create a file link in its no to display the
place
contents of logo.tif. h a s
c. Run the paper layout. m ) eฺ
o utoidlogo.tif.
d. On the operating system, copy any other a ilฺc file
.tif G
e. Rerun your report. g m ent
f. Save the report as p13q3.rdf.
i t 3 1@ Stud
v n this
4. Continue with report p13q3.rdf.
a
a. Ensure that all rn of uone
aitems seorder are printed on the same page.
m to
u asep13q4.rdf
b. Save the(kreport and close it.
A R ens
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 13-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Web Reporting

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Add dynamic content to a Web page s
t r a n
• Identify Reports custom JSP tags on -
n
• Customize Web reports sa ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
IUsing Oracle Reports, you can easily publish data from any source, in any format, with
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

High Quality Web Publishing

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M WeblicPublishing
High Quality
U
I T K
HTML is the de facto standard for publishing information on the Web. The organization
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

High Quality Web Publishing (continued)


JSP-Based Runtime Environment
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 able
r
returns HTML that references the created image.
an sfe
-
Reusable components and the open architecture of Oracle Reports makes previously
n tr
difficult tasks simple to implement. The ability to incorporate existing o components
nJava
a
sYou can also share
into a report using JSP and servlet technology provides openness.
h a
) eฺ within your
m
business components between Oracle Reports and other applications
o
organization. ailฺ
c
G uid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Comparing Static and Dynamic Reporting

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Comparing
U M Staticlicand Dynamic Reporting
I T K
The two categories of Web reports are static reports and dynamic reports.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Comparing Static and Dynamic Reporting (continued)


Dynamic Reports
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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding Dynamic Content

Report Block Wizard


Graph Wizard
<body>

a ble
</body> f e r
ans
n - t r
Data Model JavaServer
o
n (JSP)
Web Source a Page s
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
AddingUDynamic l c
iContent to a Web Page
K
IInT a previous lesson, you created Web reports using one of the HTML templates supplied
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding Dynamic Content to a Web Page (continued)


Defining the Data Model
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. r a ble
5. Enter the query as you would using the Report Wizard. n s fe
6. Create additional groups as required. - t r a
7. Create summaries as required. n on
s a
Saving Your Report as a JSP File a
) hFileeฺ> Save As.
1. With your report selected in the Object Navigator, m
select
comodify
a i
2. Make sure the file type is Reports JSP (*.jsp),l ฺ G uidthe report name if desired,
and click Save. gm dent
i t 3 1@ Stu
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Report Block

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU Ma Reportl icBlock
I T K
Now that you have defined the data for your report, you are ready to create a report block
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Report Block (continued)


Example:
<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>

a ble
f e r
an s
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Invoking the Report Block Wizard

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
InvokingU Report Block Wizard
the
K
T invoke the Report Block Wizard:
ITo
V N
NA 1.
2.
Position your cursor in the desired location in the Web source code.
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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> a ble
Paper Layout (XML) f e r
ans
</layout>
n - t r
</rw:objects>
a no
<HTML> h a s
m ) eฺ
Web Layout (JSP) o
Graph (XML) a ilฺc Guid
g m ent
</HTML>
</rw:report> i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Examining
U M the Webl ic Source Code
I T K
Now you will examine the code created for the report block, and learn more about the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Examining the Web Source Code

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Examining
U the Web Source Code (continued)
K
T Header Tag
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

rw:foreach Tag

a b le
...
e r
<rw:foreach id="R_G_EMPLOYEE_ID_1" src="G_EMPLOYEE_ID">
a n sf
<tr> n - tr
<td <rw:headers id="HFEMPLOYEEID" a no
src="HBEMPLOYEEID"/>. . . h a s
<td <rw:headers id="HFEmployee" m ) eฺ
o
src="HBEmployee"/> . . .
a ilฺc Guid
... gm
@ tude nt
3 1
it is S
v n
a e th
r n
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M
The rw:foreach
en
A licTag
K U
T
IThe rw:foreach tag loops through the specified data source group. The tag creates a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

rw:field Tag

a ble
f e r
... ans
n - t r
<td <rw:headers id="HFEMPLOYEEID"
a no
as
src="HBEMPLOYEEID"/> class="OraCellNumber">
)h
c o m ideฺ
<rw:field id="F_EMPLOYEE_ID" src="EMPLOYEE_ID"
ailฺ Gu</rw:field></td>
nullValue="&nbsp;"> F_EMPLOYEE_ID
m ent
g
...
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Tag
The rw:field
U l ic
I T
The
Krw:field tag returns a value from a column, system parameter, or user parameter,
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Reports JSPs

• Modify the classes in the style sheet


• Use HTML tags and attributes
• Use Reports custom tags

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Customizing
U Reports JSPs
K
T can customize your Reports JSPs by:
IYou
V N
NA • Modifying the classes in the style sheet file
• Using standard HTML tags and attributes
• Using Oracle Reports custom tags

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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"/>
r a ble
class="OraCellNumber"><rw:field
n s fe
id="F_EMPLOYEE_ID" src=“EMPLOYEE_ID"
- t r a
nullValue="&nbsp;"> F_EMPLOYEE_ID </rw:field></td>on
s an
) ha
.OraCellNumber { color: #000000; background-color: c o m ideฺ #f7f7e7;
font-family: Arial, Helvetica, sans-serif;
m ailฺfont-size:
t G u 10px ; text-
align: right} @ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Customizing
U Reports JSPs Using Style Sheets
K
T you select a template supplied by Oracle Reports, the headings and data in your
IWhen
V N
NA report block inherit the characteristics defined for the template through the template’s
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Reports JSPs Using Style Sheets (continued)


Example: In the Reports JSP source code shown, the Oracle Reports template rwbeige
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 le
b
the stylesheet. era
sf
r a n
on -t
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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" r a ble
bgcolor="yellow"> Salary </th> n s fe
</tr> - t r a
</thead> non a
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U M Reports l ic JSPs Using HTML Tags and Attributes
I T K
If you want to customize particular instances of a class in a report, you can edit the Web
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Reports JSPs


Using Reports Custom Tags

Tag attributes provide additional formatting functionality.


Example: rw:field tag optional attributes:
• breakLevel
• breakValue
• nullValue
a ble
f e r
• containsHtml
ans
n - t r
• formatMask
a no
• formatTrigger
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Reports
Customizing
U l ic JSPs Using Reports Custom Tags
I T K
Each Reports custom tag is defined with a list of attributes. While some attributes are
VN
NA 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 field’s value is null. The default value
is &nbsp.
• containsHtml: A value that indicates whether the field’s 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Reports JSPs Using Reports Custom Tags (continued)


• formatMask: Contains the Reports format mask to be applied to the field’s value.
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 field’s attributes in the Reports backend structure and the tag
handler picks up those attributes and converts them to HTML.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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" r a ble
nullValue="&nbsp;" formatMask="$999,999.00" > n s fe
F_SALARY - t r a
</rw:field> n on
</td> s a
a
) h eฺ
… m
</tr> i l ฺ co uid
a
</rw:foreach> </tbody> gm @ tude nt G
3 1
it is S
v n
a e th
r n
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
CustomizingM A Reports
l i c enJSPs Using Reports Custom Tags (continued)
K U
T
IThe slide above shows an example of using Reports custom tag attributes to modify the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Reports JSPs


Using Reports Custom Tags

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U M Reportsl ic JSPs Using Reports Custom Tags (continued)
I T K
The slide above shows the result of using Reports custom tag attributes to modify the
VN
NA appearance of a field in a report.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
• Use style sheets to customize Web reports s fe
n
• Use HTML attributes and Reports custom tag n-tra
o
attributes to customize Web reports an s
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Adding Dynamic Content to a Web Page
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 14 Overview

• Adding dynamic content to an existing Web page


• Customizing a Web report using JSP tag attributes

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 14
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 14


1. Create a new Web report by adding dynamic content to an existing Web page.
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.
r a ble
2. Customize the p14q1.jsp report using JSP tag attributes.
n s fe
a. Display the salary and summary values with an appropriate currency - t r a
format.
on summary?
b. Run the Web layout to test. Did you remember to format the report
n
Save the report as p14q2.jsp.
ha sa
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 14-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Extending Functionality Using XML

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
f e r a
• Debug XML report definitions s
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Overview U M l ic
I T K
In an earlier lesson, you were introduced to Extensible Markup Language, or XML. Recall
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Why Use XML Report Definitions?

• Apply run-time customizations


• Perform batch updates
• Build fully functional reports
• Product openness
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Why Use U l ic Definitions?
MXML Report
I T K
Using XML tags, you can build a full or partial report that can serve as either a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Why Use XML Report Definitions? (continued)


Run-Time Customizations
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.
a ble
Batch Updates
f e r
Using an XML report definition, you can apply batch updates to existing reports. n
aYou s
- t r
onis that you can
have the option of saving the combined definition to a file. The advantage
n
quickly update a large number of reports without having to open each
s a file in Reports
Builder to make the changes. a
) h eฺ
m
o uid
Building Fully Functional Reports ilฺc
a G
If you can generate XML tags, you can create g m n t
a fullyeself-contained report definition that
can be run by Oracle Reports. Using 3 @ d
tu definition, you can build reports on
an1XML report
n i t s S
the fly without using Reports a
n v
Builder.
t hi
Product Openess mar u se
XML supportR ku Reports
in (Oracle e to provides a mechanism for exchanging data with third-
A
party applications. c
Ite nsoffers a way to furnish data to tools that accept XML output for
also
K
data
UM andliXML is easily displayed on the Web.
analysis,
IT
NTechnical
A V Note
N
For more information see the section “Customizing Reports with XML” in the Oracle
Application Server Reports Services Publishing Reports manual.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating XML Report Definitions

<report> • XML tags


<data> • Partial definition
. . . • Full definition
</data>
<layout>
a ble
. . .
f e r
</layout> ans
n - t r
</report>
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M
and Usingl ic XML Report Definitions
I T K
The steps below briefly outline the process of building and using XML report definitions:
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating and Using XML Report Definitions (continued)


Example
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"/> a ble
f e r
</section>
ans
</layout> n - t r
a no
</report>
h a s
Every XML report definition, whether full or partial, must m ) ethe
contain ฺ required tag pair,
o
lฺc Guofidthe report customization,
<report> </report>. The <report> tag indicates the ibeginning
its name, and the version of the Document Type a
m Definitiont (DTD) file that is being used
g d e n
with this XML customization. The </report>
i t 3 1@ tag S tuindicates the end of the report
customization. A full report requires
a v n both t h iasdata model and layout and therefore requires
arn use tags and their contents.
the <data></data> and <layout></layout>
m
ku sein the
The report name (attribute to <report> tag can be any name you wish, and can be
different than
A Rthe name enof the .rdf file. The name attributes in the <field> and <section>
M l i c
U the names of the fields and sections. As a result, the attributes will be applied
tagsKmatch
N T
Ito the fields and sections listed.
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Partial Report Definitions:


Format Modification Example

<report> • Empty <data> tag


<data> • Use of <layout>
</data> • Use of <field>
<layout>
<section> a ble
f e r
<field .../>
ans
n - t r
no
...
</section> s a
</layout> h
) eฺ a
o m
</report>
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
PartialUReport l ic
M Definitions
I T K
One of the main uses of XML report definitions is to make modifications to an existing
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Partial Report Definitions (continued)


Formatting modification example
<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"
a ble
f e r
source="prodid"
ans
lineColor="black"
n - t r
fillColor="r100g50b50"/> a no
a s
<field name="f_current_price"
m ) h eฺ
source="price"
i l ฺ co uid
lineColor="black" g ma ent G
fillColor="r100g50b50"/>
i t 3 1@ Stud
</section> a v n this
rn use
</layout> ma
ku se to
(
R edoes
This XML A definition
c n not add data because the <data> tag is empty. The purpose is to
apply U M l i
the formatting attributes mentioned in the <field> tags for the fields in the report’s
T K
V NImain section.
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Partial Report Definitions:


Format Exception Example

<report> • Empty <data> tag


<layout> • Use of <exception>
<section> • Use of <condition>
<field ...>
a ble
<exception>
f e r
<condition .../> ans
n - t r
</exception> o
</field> s an
) ha
</section>
c o m ideฺ
</layout>
m ailฺ t Gu
</report>
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Partial Report Definitions (continued)


Formatting exception example:
<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"/>
a ble
</exception> f e r
ans
</field>
n - t r
<field name="f_bonus" source="bonus">
a no
<exception textColor="blue"> h a s
m ) e ฺ
<condition source="bonus" operator="gt" c o i d
operand1="10"/>
m ailฺ t Gu
</exception> @ g den
n i t31 is Stu
</field>
n a v th
</section> a r us e
</layout> (k u m t o
A R ense
M
</report>
U l ic
K
T XML definition adds formatting exceptions to the F_SAL and F_BONUS fields.
IThis
V N Notice the use of the <exception> tag. However, the formatting change will only be
NA applied when the criteria defined in the <condition> tag is met.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Full Report Definition:


Data Model Modification Example

<report> • Empty <layout> tag


<data> • Use of <dataSource>
<dataSource> • Column aliases
... • Bind references
</dataSource>
a ble
</data>
f e r
<layout> ans
n - t r
</layout> o
s an
ha
</report>
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Full Report Definition


Data model modification example:
<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
r a ble
group by l.city,d.department_name
n s fe
</select> - t r a
</dataSource> n on
s a
</data>
) h a
o m d e ฺ
<layout> c i
<section name="header"> m ailฺ t Gu
@ d e n
g template="rwgray.tdf">
<tabular name="Sal_summary"
n i t 31 s Stu
r n av e thi
<labelAttribute font="Arial"
fontSize="10"
u m a
t o us
(k se
fontStyle="bold"
R
M A licen
textColor="white"/>
K U
N I T <field name="f_loc_name"
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Full Report Definition:


Data Model Modification Example

<report> • Empty <layout> tag


<data> • Use of <dataSource>
<dataSource> • Column aliases
... • Bind references
</dataSource>
a ble
</data>
f e r
<layout> ans
n - t r
</layout> o
s an
ha
</report>
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Full Report
U Definition (continued)
K
T things happen in this XML definition file:
ISeveral
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Full Report Definition (continued)


• The query uses column aliases. If you do not use an alias, the name of the column is
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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running XML Report Definitions

• Apply to an .rdf or .xml file

rwclient userid=... report=...


customize=....xml server=...
destype=... desformat=...
a ble
f e r
• One or multiple definitions
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Running U M l
XML Report ic Definitions
I T K
Once you have created your Reports XML customization file, you can use it in the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running XML Report Definitions (continued)


Applying One XML Report Definition
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
a ble
destype=file desname=emp.pdf desformat=PDF
f e r
Applying Multiple XML Report Definitions a n s
n r
-t an
You can apply multiple XML report definitions to a report at run time byoproviding
argument list with the CUSTOMIZE keyword. The following command s a nline sends a job
ha definitions,
request to OracleAS Reports Services and applies two XML) report
emp0.xml and emp1.xml, to the .rdf file employee.rdf: c o m ideฺ
ilฺ Gu
areport=employee.rdf
rwclient userid=scott/tiger@db1
g m e n t
i t 3 1@ Stud
customize="(d:\rep10g\custom\emp0.xml,

a v n d:\rep10g\custom\emp1.xml)"
t h is
rn use
destype=file adesname=emp.pdf desformat=PDF
m o
(ku se t
server=repsrv1
R
MultipleM files i en in the order listed in the CUSTOMIZE argument. The last
A are lapplied
c
U
N I T K applied overrides any similar modifications made by a prior definition.
definition

N AV

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running XML Report Definitions

• Before Form or After Form trigger


SRW.APPLY_DEFINITION(....xml);

• Run by itself
• Batch updates
a ble
f e r
ans
rwconverter source="(...)"
n - t r
o
dest=... customize=...
s an
batch=yes
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
RunningU XML Report Definitions (continued)
T K
IApplying
N an XML Definition in PL/SQL
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 17 and/or its affiliates.
2010, Oracle
SQL Star International Limited
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
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)" a ble
f e r
dtype=rdffile
a n s
t r
on-
dest="(emp1_new.rdf,emp2_new.rdf,staff_new.rdf)"
customize="(d:\rep10g\custom\labels.xml, s an
) ha
c o m ideฺ
d:\rep10g\custom\format_mask.xml)"
batch=yes
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Debugging XML Report Definitions

• XML parser
• Tracing option
• Using Reports Builder

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Debugging
U XML Report Definitions
K
T have options when debugging XML report definitions.
IYou
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 19 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Debugging XML Report Definitions (continued)
The Trace Option
For testing purposes, you may want to activate the trace facility when you run your report.
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
le
summaries are being placed in the appropriate group in the Data Model.
e rab
Technical Note a n sf
n - tr
For more information on the XML parser, refer to the Oracle Technology
n oNetwork
(http://otn.oracle.com).
ha sa
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Summary

In this lesson, you should have learned how to:


• Use XML report definitions:
– Run-time customizations
– Batch updates
• Apply XML definitions ble
f e r a
• Debug XML definitions s
- t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Summary U
I T•
K
Using XML report definitions:
V N - Run-time customizations
NA - 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 15 Overview

• Creating an XML report definition


• Applying a run-time customization
• Debugging an XML definition

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 15
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 15


1. Run an XML report definition.
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? r a ble
se
f
r a n
on -t
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 15- 23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Creating and Using Report Parameters

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Build a Paper Parameter Form layout s
a n
• Customize a Paper Parameter Form layout on-tr
n
• Use HTML parameter form extensions s a
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
IParameters enable you to develop dynamic report documents that produce variable report
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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


a ble
f e r
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
ans
n - t r
no
FROM CUSTOMERS
<a where clause> s a
h
) eฺ a
• Substitute a single column or expression o m
a i lฺc Guid
SELECT <a column/expression>
g m ent
FROM CUSTOMERS
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M l ic
User Parameters
I T K
You can create your own parameters and use them to change the SELECT statement of
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating User Parameters

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
CreatingU User Parameters (continued)
K
T create a user parameter in the Object Navigator:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating User Parameters (continued)


Parameter Properties

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. r a ble
Validation Trigger Validate the parameter value. Enter a PL/SQL function.ans
fe
List of Values n
Create a list of values from which users select a valid
tr
- value
o
at run time. s an
Type of Pluggable Used by the PDS for acquiring single ) a information. It
hsign-on
o m sign-ond e ฺ information
Data Source c
identifies that parameter as lcontaining
i ฺ Gu i
ma
for that PDS connection.
g den t
@
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Referencing Parameters in a
Report Query

• Bind reference replaces a value:


:parameter_name
• Lexical reference replaces a clause:
&parameter_name

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Referencing
U Parameters in a Report Query
K
T are two ways to reference parameters in a query:
IThere
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Referencing Parameters in a Report Query (continued)


What Is a Lexical Reference?
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.
a ble
Comparing Bind and Lexical Reference Types f e r
ans
Type Prefix Use to Replace Parameter Created by Default?
n - t r
Bind : Single value or expression Yes, if it does not alreadyn oexist.
s a
in Reports Builder
) h adisplays a warning
the following clauses: message om
and addse
d ฺ
the parameter to
l ฺ c u i
WHERE, GROUP BY,
m ai t G
User Parameters in the Object
ORDER BY, HAVING, g Navigator.
@ d e n
CONNECT BY,tSTART
n i 31 s Stu
WITH av
r n e thi
Lexical & Anym part s
a of a uSELECT Provided it is not used for a column
u
(kstatement
e t o or table, yes: if it does not already
R n s
U MA lice exist. Reports Builder displays a

I T K warning message and adds the


V N parameter to User Parameters in the
NA Object Navigator. Datatype must
always be Character.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Bind References

• Restrict values in a WHERE clause


SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
FROM CUSTOMERS
WHERE CUSTOMER_ID > :P_CUST

a ble
• Substitute a single value or expression in the select s f e r
statement tran n -
n o
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
s a
FROM CUSTOMERS a
) h eฺ
m
co uid
ORDER BY DECODE( :SORT, l ฺ
, 1, CUST_LAST_NAME,
i
2, g ma ent G
NLS_TERRITORY,
@ tud
t31 ACCOUNT_MGR_ID)
nS i is
a v t h
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Bind
U M References
l ic
I T K
Use a bind reference anywhere in a query where you can use a single literal value, such as
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Bind References (continued)


SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
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, r a ble
such as the contents of a parameter: n s fe
- t r a
SELECT LAST_NAME, SALARY * :P_RATE
n on
FROM EMPLOYEES s a
a
) h eฺ
• Replace any part of a FROM clause m
o uid
• Replace reserved words or clauses ilฺc
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

a ble
SELECT CUST_LAST_NAME, ACCOUNT_MGR_ID
f e r
FROM CUSTOMERS
ans
&P_WHERE_ORD_CLAUSE n - t r
a no
SELECT &P_CUSTNAME CUST, &P_ACCTMGR MGRas
FROM &P_TABLE m ) h eฺ
i l ฺ co uid
• Make sure that the number manda data t Gtypes match at
g
@ tude n
run time. 3 1
v n it is S
r n a e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Using Lexical
U References
K
T a lexical reference to replace any clause in a SELECT statement, or even to replace
IUse
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Using Lexical References (continued)
• To specify a WHERE clause, ORDER BY clause, or both at run time (as one
parameter):
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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
• Enter an initial value for parameters that affect s fe
n
query validation when NULL -tra on
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Hints andU MTips for l icReferencing Parameters
I T K
If you substitute the name of a column or expression in the SELECT list with a lexical
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Hints and Tips for Referencing Parameters (continued)


Example:
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
r a ble
required for lexical parameters used for column names, table names, and incompletesfe
n
clauses as shown in the example above.
o n -tra
nlexical
Note: Always use column aliases when substituting column names with
a
references.
) eฺ has
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a List of Values

Static list of values

2 3 a ble
f e r
ans
4 n - t r
o
5
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1K
U Choose Static Values.
N I T
V 2 Enter a value and click Add.
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a List of Values (continued)


To create a static list of values:
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a List of Values

Dynamic list of values

1
3

4
a ble
f e r
2 ans
n - t r
o
5 s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K U Choose SELECT Statement.
V N 2T
I Enter a valid query.
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a List of Values (continued)


To see a more meaningful list of descriptive values, instead of the primary or foreign key
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Referencing System Parameters

a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Referencing
U M System l ic Parameters
I T K
Reports Builder provides system parameters to allow you to modify standard run-time
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Referencing System Parameters (continued)
The system parameters are:
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 r a ble
DESTYPE Type of device that will Cache, localfile, file, Cache ns
fe
receive the report output printer, sysout, mail, - t r a
oracleportal, ftp, n on
webdav, screen, s a
preview ) h
a
o mbitmap, d e ฺ Default
MODE Whether report executes in c
Default,
ilฺ Gu i
bitmapped or character mode m aCharacter
t
ORIENTATION The print direction of@ g Default,
printer d e n portrait, Default
output 3 1
it is S t uLandscape
PRINTJOB Whethern v
print
n
a jobedialogth box Yes, No Yes
a r
is displayed at s
run time, if
um e tooruprinter
(kdestype=file
A R ens
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building a Paper Parameter Form

a ble
f e r
ans
n - t r
a no
+ Report
h a sproperties:
•m
)
Width eฺ
o uid
a ilฺc • Height
G
g m ent
i t 3 1@ Stud • Number of Pages
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU M c
a PaperliParameter Form
K
T paper reports that you created in previous lessons ran successfully without a
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building a Paper Parameter Form (continued)


If you create many parameters in your report, the run-time parameter form can spread
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 a ble
f e r
make up the parameter form
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing a Paper Parameter Form

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M a Paper
Customizing
U l ic Parameter Form
I T K
You can customize the parameter form layout in a similar way to customizing the paper
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing a Paper Parameter Form (continued)


Creating Parameter Boilerplate Objects
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Parameter Form HTML Extensions

• Boilerplate text with HTML tags


• Parameter fields with JavaScript
• Parameter Form header
• Parameter Form footer
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
Using Parameter
U l c HTML Extensions
iForm
I T K
HTML Parameter Form extensions enable you to enhance your run-time paper parameter
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Parameter Form HTML Extensions (continued)


To create a boilerplate text object for HTML tags:
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 able
Before Form report properties: s f er
- Open the report Property Inspector. - t r an
on code, or to
- Set the Before Form Type property to Text if you enter the JavaScript
n
File if you will import the code from a file. s a
a
) h... button
- Set the Before Form Value property by clicking the ฺ to either enter the
o m e
uid
lฺcJavaScript.
JavaScript, or select the HTML file with ithe
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Parameter Form Header and Footer

a ble
f e r
ans
Header n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid Footer
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Parameter
U ic
MForm lHeader and Footer
K
T create an HTML parameter form header:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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:
a ble
f e r
– Command line arguments
ans
– Run-time parameter form n - t r
no
• Create a run-time paper parameter form:s a
– Build it using the Parameter Form Builder ) ha
c o m ideฺ
– Customize it using the Report ฺ GHTML
ailEditor, u
m
g den t
@
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Summary U
I T•
K
Parameter types:
V N - User parameters:
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 16
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 16


1. Open report p13q3.rdf.
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. r a ble
c. Save the report as p16q1.rdf. Do not close it n s fe
- t r a
2. Continue with report p16q1.rdf.
a. Add a list of values to select any valid CUSTOMER_ID inathenCUSTOMERS
on
table that has an order in the ORDERS table. Do nothallow a s users to enter any
other value. The list should display customer o m ) noteCUSTOMER_ID
names, ฺ
c
ฺ G i d
numbers.Ensure that each customer name
m ailappear
t
u once in the list, even if the
only
customer has several orders.
@ g den
b. Save the report as p16q2.rdf.
n i t31 iDo s Snottuclose it for the moment.
c. Run the paper layoutato
n v test thethreport. Run the Web layout as well.
3. Open report p5q3.rdf.a r u se
a. Create a(k
m to to enable users to order the data by different columns
u parameter
lexical e
R at all)enatsrun time. Include an ORDER BY clause in the query with a
(orAnot
U l ic
Mlexical reference to the parameter. Enter an initial value for the parameter to
I T K
order by the employee’s last name.
A VN b. Add a static list of values for the parameter P_ORDER. Code two or three
N
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 16 (continued)


4. Continue with report p16q2.rdf.
a. Create a default parameter form.
Include a Title message but not a Hint message.
Display the P_CUSTOMER parameter.
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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 16-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Embedding a Graph in a Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Specify additional graph attributes using s
n
Graph.XML -tra on
• Use graph hyperlinks a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Overview U M l ic
I T K
In this lesson, you learn to display a graph in a report at run time.
VN
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding a Graph to a Paper Report

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M l ic
and Embedding a Graph in a Report
K
T in many Oracle products, Oracle Reports uses the BI Graph Bean for graph
IAs
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating and Embedding a Graph in a Report (continued)


From the Paper Design view:
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding a Graph to a Web Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding a Graph to a Web Report

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
A icen
AddingUaM Graph lto a Web Report
K
T add a graph to a Web report:
ITo
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Selecting the Graph Type

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Selecting
U Mthe Graph
l ic Type
I T K
Select the type of graph that you require. The Wizard provides a preview of what the
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Selecting the Graph Data

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Selecting
U the Graph Data
K
T the next two wizard pages, you define the data in the graph:
IOn
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding Options to the Graph

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
AddingUOptions l
toicthe Graph
I T K
The remaining pages in the Graph Wizard allow you to add optional characteristics to
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Adding Options to the Graph (continued)


• Use the X-Axis page to specify options for the x-axis of your graph. Options include
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.).

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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& a ble
f e r
desformat=htmlcss&emp_id=&EMPLOYEE_ID;">
an s
n - t r
Graph XML a no
h a s
m ) eฺ
o
</rw:graph>
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Customizing
U M WeblicGraphs
I T K
Earlier in the course, you learned how to customize your Web reports by editing the Web
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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"] r a ble
– series n s fe
– width
[width="size"]
- t r a
[height="size"] n on
– height
s a
– graphHyperlink a
[graphHyperlink="link"]
) h eฺ
tag m
o uid
cbody
i l ฺ
ma nt G
g</rw:graph>
3 1 @ tude
v n it is S
r n a e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M
The rw:graph
A Tag l i c en
K U
T
IThe rw:graph tag defines a graph in a Web report. The rw:graph tag requires a data source
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The rw:graph Tag (continued)


Use the Web Source editor to modify or add attributes. In the previous slide, the width and
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Graphs Using


the Graph.XML File

a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Graphs
Customizing
U l ic Using the Graph.XML File
I T K
When you use the Graph Wizard to create a graph in the report layout, it generates
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Customizing Graphs Using the Graph.XML File (continued)


The Graph.DTD File
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
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Graph Hyperlinks

• Document
on same
machine
• Any
destination
a ble
• Any URL f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyrightus© e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Graph
U l ic
M Hyperlinks
I T K
Oracle Reports supports the ability to add a hyperlink to a graph embedded in a report.
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Graph Hyperlinks (continued)


Examples:
• 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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Technical Note
When delimiting parameters in a URL, you can use the ampersand (&) or the plus sign
(+). The ampersand is more commonly used and recommended. The ampersand
immediately preceding EMPLOYEE_ID indicates substitution.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 le
r a b
• Customize graphs using the Graph.XML file s f e
• Use a graph hyperlink for drilling down - t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
• Use the Graph Wizard to create and embed a simple graph in your report.
VN • Reenter the Graph Wizard to make changes to the graph object, such as its position in
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
• Customizing a graph in a Web report s
- t r an
o n
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 17
K
T practice session contains:
IThis
V N
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 17


1. Open report p17q1a.jsp.
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
ble
d. Run the paper layout to test. Resize the graph in the Paper Layout, if necessary.
s f era
e. Save report as p17q1.jsp.
- t r an
2. Reenter the Graph Wizard to change the characteristics of the grapho
n n in the
created
previous exercise.
s a
a. Give the graph the following characteristics: h
) eฺa
o m
Title
i ฺc Guid
Order Total per Sales lRep
a
Graph Type Horizontal Bargm
e n t
Graph Subtype Bar 31@
i t S tud
b. Run the paper layoutato v ntest. this
arn use
c. Save report to p17q2.jsp.
m
3. Continue with ( e to
u p17q2.jsp.
kreport
A
a. Run Rthe Web e s What do you see?
nlayout.
Ub.MUpdate the c
li Web source with the correct column name.
IT K
N c. Run the Web layout again to test.
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 17 (continued)


4. Open report p9q3.jsp.
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. r a ble
c. Run the paper layout and test the report. n s fe
- t r a
d. Save the report as p17q4.jsp.
5. Continue with report p17q4.jsp. n on
s a
a. Add a bar graph to the Web source for the data group
) h a
G_PRODUCT. Use the
same data group, category, and value settingsoas e ฺ
min theidprevious exercise.
i l ฺ
Hint: You want to insert the graph justabefore
c the u
m n t Gtermination of the rw:foreach
tag for the group G_NAME.
@ g de
b. Run the Web layout to test.
i 1
t3Ensure tua graph displays for each sales
that
S
respresentative. av n thi s
r n e
c. Resize the graph
u m t o us of 800 and a height of 450.
a to a width
d. Save the
R ens (kreport as
e p17q5.jsp. Run the Web layout to test.
A lic
K UM
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 17-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enhancing Matrix Reports

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Create and modify matrix summaries s
t r a n
• Create a matrix with group report on -
n
• Create a nested matrix report sa ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OverviewU
T K
IMatrix or cross product reports show cells of information that relate to values appearing
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Matrix Data Model

4
2 le
r a b
s f e
- t r an
o n
s an
3 ) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T K Cross product group
I
V N 2 Row and column groups
NA
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Matrix Data Model (continued)


There is an extra group that surrounds the row and column groups. It is called the cross
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Matrix Paper Layout

Job Title F_job_id

Dept Name Sumsalary


a ble
f e r
F_department_na F_Sumsalary ans
n - t r
o
s an
) ha
c o m ideฺ
a ilฺ Gu
1 g m 2 ent 3
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
1K UM lic
Repeating frame for rows (Down direction)
I
N2 T
V Repeating frame for columns (Across)
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Matrix Paper Layout (continued)


For the simple matrix style, the Report Wizard creates:
• 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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Matrix Summaries

F_CITY 1

Job Title F_job_id

Dept Name Sumsalary


a ble
f e r
F_name F_Sumsalary F_SumsalaryPerDEPT
ans
n - t r
o
2 F_SumsalaryPerJOB_I F_SumsalaryPerCITY
s an
) ha
c o m ideฺ
F_SumsalaryPer m ailฺ t Gu
@ 3g d e n
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
1 K
UProduct Order = G_DEPARTMENT_NAME
N I T
V 2 Product Order = G_JOB_ID
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Matrix Summaries (continued)


Setting the Product Order
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:
r a ble
• F_SumSalPerDEPARTMENT_NAME has one value for each department
n s fe
(G_DEPARTMENT_NAME). - t r a
• F_SumSalPerJOB_ID has one value for each job ID (G_JOB_ID). non
s
• F_SumSALARY, the matrix cell, has one value for each combinationa of
a
) h Order
G_DEPARTMENT_NAME and G_JOB_ID, so the Product m ฺ is
o e
G_DEPARTMENT_NAME G_JOB_ID. ilฺc uid
Source Column At g
Reset @ e ma
n G
t Product Order
d
i t31 is Stu
F_SumSALPerDEPARTMEN_ nG_DEPARTMENT_ G_DEPARTMENT_NAM
NAME r n av NAMEe th E
m
F_Sum_SALPerJOB_ID
a s
uG_JOB_ID G_JOB_ID
u
(k se t o
F_SumSALARY
A R n e G_JOB_ID G_DEPARTMENT_NAM
UM li c E
IT K G_JOB_ID
N
V The Reset At option has the same effect as in other report styles. When you create
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 le
r a b
– Create extra groups
s f e
– Create the cross product group - t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
CreatingU M l
the Matrix ic Manually
I T K
You may want to create the matrix report manually. You can use the Data Wizard or you
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating the Matrix Manually (continued)


Building the entire matrix report manually:
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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Matrix with Group Data Model

a ble
f e r
an s
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU Ma Matrixlicwith Group Report
K
IATmatrix with group report consists of a break group that contains a simple matrix
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Matrix with Group Layout

Region: F_CITY

Job Title F_job_id

Dept Name Sumsalary


Total:
a ble
f e r
F_department F_Sumsalary F_SumsalaryPerDEPA
ans
n - t r
F_SumsalaryPerTITLE F_SumsalaryPerCITY a no
h a s
m ) eฺ
o
lฺc Guid
a i
Total: F_SumsalaryPer
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU a Matrixlic
M with Group Report (continued)
K
T Paper Layout for the Matrix with Group style is identical to the matrix style except
IThe
V N
NA for the addition of a repeating frame that surrounds the entire matrix layout and
corresponds to the break group in the Data Model.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building a Nested Matrix

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU Ma Nested l icMatrix
I T K
You create the nested matrix style with the Wizard by adding an extra level in the Rows
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building a Nested Matrix (continued)


To recreate the cross product group:
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.
r a ble
• Nested Matrix Data Model: The cross product contains three or more groups, one
n s feor
-tracolumns.
more levels of break group and two dimensional groups to form rows and
n
Note: You can mix these styles. That is, you can create a Matrix with
a no report where
Group
the matrix has several nested levels within it.
) eฺ has
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Nested Matrix Paper Layout

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Paper
NestedUMatrix l ic Layout
I T K
The Report Wizard creates the same paper layout objects for a Nested Matrix as for a
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Nested Matrix Paper Layout (continued)


Creating a Matrix Object
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.
r a ble
2. Select both repeating frames [Shift]-Click.
n s fe
Note: If you do not select both frames, you receive an error message: tra
REP-3100: Matrix must include at least 1 Downon - 1
and
Across repeating frame. s an
3. Select Insert > Layout Matrix. ) ha
4. Move the matrix object back through the layout o m until
layers d e
it
ฺis behind the cell field
c i
lฺ Guto make the report run, but it
(Layout > Move Backward). This step ism ainecessary
not t
@ g
is useful to see the cell field if the matrix has d
a e n
solid fill.
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Nested Matrix Summaries

a ble
F_SumSALARY F_SumSALPerDEPA
f e r
ans
n - t r
o
F_Sum_CITY
s an
) ha
F_SumSALPerJOB_lฺco
m ideฺ
m ai t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
CreatingU Nested Matrix Summaries
K
T Wizard creates nested summaries in the cross product group.
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating Nested Matrix Summaries (continued)


The Product Order indicates the way in which Reports Builder evaluates a summary.
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.
a ble
Field Name Reset At Product Order f e r
F_SumSALPerJOB_ID G_JOB_ID G_JOB_ID a n s
n-t r
F_SumSALPerDEPART- G_DEPARTMENT_N G_CITY no
MENT_NAME AME s a
G_DEPARTMENT_NAME
h a
) G_CITY
F_SumSALARY G_DEPARTMENT_N
o m d e ฺ G_JOB_ID
AME ilฺ c u i
G_DEPARTMENT_NAME
g ma ent G
The diagram also shows a fourth summary,
i t 3 S tud
1@F_Sum_CITY, which you might want to
n
v fortheach
create yourself to produce a subtotal
a s
i region.
1. Create another summary r n e
a inuthes cross product group.
2. Create a layout m
kufieldseandtoplace it as shown in the diagram, in the R_G_CITY
(
Rframee(use
repeating
A c n the Object Navigator to identify it). The following table shows
M l i
U property settings.
the
T K
V NI
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying Zeros

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Displaying
U M Zeroslicin Cells with No Value
I T K
The field that displays each cell of the matrix is sourced to a summary column, such as
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Displaying Zeros in Cells with No Value (continued)


To display zeros in cells with null values, open the Property Inspector for either the cell
field or the SumSalary summary column and set the Value if Null property to zero.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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: ble
– Cross product group f e r a
ans
– Product Order property n - t r
o
– Matrix layout object
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Summary U
T K
ILetting the Wizard and Template Work for You
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
fe r a
• Displaying more meaningful column information s
t r a n
and rotating the text n - o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 18
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 18


1. Open report p4q6.jsp.
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
a ble
f e r
Matrix Column Fields product_id
ans
Matrix Cell Fields Sum of total_value
n - t r
o
Matrix Totals Sum of the cell field
s an
) ha
b. Change the labels and widths for the followingo fields: deฺ
m
c
ilฺ Gui
a
m entWidth
Field Label g
name Customer
i t 3 1@ Stud 10
product_id a v n this
Product 5
a rn use
month
( kumse toMonth 4
A R en
SumTotal_value Total 5
M l i c
IT KU
All Summaries Total: 5
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 18 (continued)


f. Use the Data Model view to create summaries for each month and for the level
month and product.
Property Value
Name SumMonth
Product Order G_MONTH
Function Sum
Source SumTOTAL_VALUE
Reset At G_MONTH

Property Value
Name SumMonthProduct a ble
f e r
Product Order G_MONTH G_PRODUCT_ID
ans
Function Sum n - t r
o
Source SumTOTAL_VALUE
s an
Reset At G_PRODUCT_ID ) h a
l ฺ
i You
g. Use the Paper Layout view to create theafields.
c deฺ
om ui
m n t G must expand the appropriate
repeating frame.
@ g de
h. Run the paper layout to test i 1
t3the report.
S tu
n s
av e thiDo not close it.
i. Save the report as p18q2.jsp.
r n
3. Continue with the
u m a from
report
t o usthe previous exercise.
R (k for null
a. Add zeros
s e values in the cells.
A that
b. Ensure c n
ethe report shows only three product columns on each page.
U M l i
c. Format all numeric data to be right aligned.
N IT K d. Add commas and two decimal places where appropriate.
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 18-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Coding PL/SQL Triggers

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Create a PL/SQL library s
t r a n
• Publish a report as a result of a database event
on -
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview U
T K
IThis lesson identifies different trigger types and creates conditional trigger code to control
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Types of Triggers in Reports

• Report:
– Five triggers
– Report Triggers node in Object Navigator
• Data Model:
– Formula (column) le
r a b
– Filter (group)
s f e
– Parameter validation - t r an
n no
• Layout: Format trigger on most objects a
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Types U ofMTriggersl icin Reports
I T K
You can code PL/SQL in a variety of triggers in a report to provide conditional or
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Types of Triggers in Reports (continued)


• Data Model:
- 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 parameter—or the corresponding layout object—field, 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. r a ble
Note: Reports Builder does not allow data manipulation language (DML) n s fe
- t r a
commands—INSERT, DELETE, UPDATE—in layout format triggers. on
n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Trigger Code

Boolean:
true
false

a ble
f e r
a n s
n
Character-t r
o
s an
Number
) ha Date
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
n
MA lice
TriggerUCode
I T K
When you create a trigger such as a report trigger or a PL/SQL formula, the Program Unit
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Report Triggers

Before
Parameter F
Form

1 2 If readonly=yes 3

F
If > 1 page a ble
f e r
After
Before Between Aftertran
s
page1 page2
Parameter
Form
Report Pages on-
Report
n
s a
F
a
) h eฺ
F
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
UM lic
1T KIf After Parameter Form returns FALSE, the cursor returns to the run-time
I
N parameter form. If the run-time parameter form is not displayed, control returns
V
NA 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 value—true or false.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Report Triggers (continued)


You can access the report triggers from the Object Navigator. Open the Report Triggers
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 r a ble
tables to be queried n s fe
Before Report Before a report executes; after Carry out initialization- t r a
queries are parsed, but before procedures a n
on
records are fetched h a s
Between Pages Before each page is formatted, Carry m )out customized
e ฺ page
l ฺ c o u i d
except the first page; in
m ai formatting;
t G insert or update
Previewer, fires only once
@ n
g for devalues in tables
each page, evenit3 1 tu
if you revisit
S
the page av n thi s
r n e
After Report After
u m t o us is sent to its Clean up initial processing,
areport output
R (k destination;
s e fires on success such as deleting temporary
n
UMA iconly le tables

I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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'; r a ble
END IF; n s fe
RETURN(TRUE);
- t r a
END; on
s an
• Query syntax
) ha
SELECT CUSTOMER_ID, CUSTOMER_NAME
c o m ideฺ
FROM CUSTOMERS
m ailฺ t Gu
&p_where_clause
@ g den
ORDER BY CUSTOMER_NAME
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Using Report
U Triggers: Creating a Dynamic WHERE Clause
K
T the After Parameter Form report trigger to build a dynamic WHERE clause
IUse
V N
NA depending on the value of a bind parameter that the user enters at run time.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Report Triggers: Creating a Dynamic WHERE Clause (continued)


There are two possibilities at run time:
• 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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
r a ble
RETURN(my_function);
n s fe
ELSE
- t r a
RETURN(TRUE);
n on
END IF;
s a
END; h a ) eฺ
o m
• PL/SQL filters result in all records
a ilฺc being G uid fetched
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Data
U M ModellicTriggers: PL/SQL Group Filter
I T K
Use a group filter when you want to:
VN
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Data Model Triggers: PL/SQL Group Filter (continued)


Example
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.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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);
r a ble
ELSE
n s fe
RETURN(TRUE);
- t r a
END IF;
n on
END; a s
h a
) eฺ or
• You cannot reassign values to parameters o m
columns in this trigger. a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Data
U M ModellicTriggers: Parameter Validation
I T K
Both system parameters and user parameters have a Validation Trigger property in which
VN
NA you can write a PL/SQL function to validate the value of the parameter.
The trigger code must return a boolean value—true or false—depending 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Data Model Triggers: Parameter Validation (continued)


Example: To prevent report output from being sent directly to a printer, test the value of
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
(repeating frame): All records fetched f e r a
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using U M Triggers
Layout l ic
I T K
Most paper layout objects can contain a format trigger; it is one of the common properties
VN
NA 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 value—true 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Layout Triggers (continued)


Suppressing Individual Records
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.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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

1
No employees in
a ble
this department
f e r
ans
Dept: 40
n - t r
No employees nino
a
as
this department
) h eฺ
o m d
2 ailฺc Gui
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
1
M
UBoilerplate c Position behind column heading frame, or
litext:
I T K
N position below and create collapsible anchor to column
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Coding a Format Trigger on a Frame (continued)


Example:
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);
r a ble
end if; sfe n a
end;
n - t r
5. Either code the reverse logic in the format trigger of the boilerplate n otext item created
s a
in step 2 or ensure that the column heading frame has a h
) a fill.
solid
Note: You should code format triggers at the highest possible
o m level d e ฺof the paper layout
c i
hierarchy. The format trigger on the column headings
m ailฺ frame
t G u
suppresses all objects
enclosed by the frame. Do not duplicate code
@ d n
g unnecessarily
e by coding the same trigger on
1 t
t3 caniscause
all individual objects in the frame; ithis u
S increased processing and maintenance
overheads. a v n th
m arn use
( ku se to
A R en
K U M lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using a Format Trigger on a


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 a ble
f e r
f_name f_date
ans
- t r
King
on
17-JUN-87
n
Kochhar as21-SEP-89a
2 m
DeoHaan
) h e13-JAN-93

c i d
m ailฺ t Gu
1 @ g den
n i t313 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T K One repeating frame is positioned behind the other or
N I positioned below with collapsing anchor
V
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using a Format Trigger on a Repeating Frame (continued)


Example:
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);
r a ble
else
n s fe
return(false); - t r a
end if; non
a
end;
h a s
Note: User_type can be a column or parameter thatm is)initialized
e ฺ at run time.
c o i d
ilฺ frame
4. Either code the reverse logic on the other repeating
a G u or ensure that the top
m
repeating frame (containing salary) hasga solid e n
fill. t
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 a ble
f e r
n s
King 17-JUN-87 n-tra
Kochhar 21-SEP-89 a no
h a s
De Haanm ) 13-JAN-93
e ฺ
c o i d
m ailฺ t Gu
@ g den
n i t31 is Stu 2

r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T K Report for payment clerks shows all fields
N I
V 2 Report for other employees shows gap where salary is hidden
NA
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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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" r a ble
nullValue="&nbsp;" n s fe
formatMask="$999,999.00" formatTrigger="mystyles"> - t r a
F_SALARY n on
</rw:field> s a
a
) h eฺ
</td> m
… i l ฺ co uid
</tr> g ma ent G
</rw:foreach> </tbody> 1@ tud it3 is S
v n
a e th
r n
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Using a U Format Trigger on a Field in a Web Layout
K
IInT an earlier lesson, you learned that you can customize your Reports JSPs by editing the
V N
NA 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 field’s attributes.
You will learn about the SRW package in the next lesson.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using a Format Trigger on a


Boilerplate Object
Insert Spacing Between Groups of Records

f_1 f_2 f_3

4 2 le
3
r a b
s f e
FUNCTION spacing RETURN BOOLEAN IS
- t r an
BEGIN
non
IF MOD(:count_column, 3) = 0 THEN
s a
RETURN(TRUE); a
) h eฺ
ELSE m
co uid
i l ฺ
ma ent G
RETURN(FALSE);
END IF;
@ g d
END; t31 Stu
n i is
a v t h
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
UM lic
1T K Transparent rectangle
I
V N 2 Repeating frame, Vertical Elasticity = Variable
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using a Format Trigger on a Boilerplate Object (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Writing Common Code

At the Report level:


• Object Navigator, Program Units
• Menu: Program > PL/SQL Editor
In a library:
• Object Navigator, PL/SQL Library
a ble
f e r
• File > New: Create new library
ans
n - t r
• File > Open: Add to existing library
a no
• Attach library to report
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M
WritingUCommon l icCode
I T K
If you use the same program unit in several places in a report, or in multiple reports,
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Writing Common Code (continued)


Writing Code as Report-Level Program Units
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 ble
or more report definitions, which enables you to reference the same code in multiple fer
a
reports. an s
- t r
on Libraries
To attach a library to a report, open the report definition, select the Attached
n
a
node in the Object Navigator, and add each library that you need
) h eฺ asin the report.
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Event-Based Reporting

• Implemented through PL/SQL stored procedures


• Uses include:
– Running a report
– Displaying report status
– Canceling a report le
r a b
– Managing parameter lists
sf e
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Event-Based
U M Reportingl ic
I T K
Today, it is often desirable to blend automation into business processes through the
VN
NA 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 employee’s 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 employee’s 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Event-Driven Publishing API

Oracle Advanced
PL/SQL Workflow Queuing

Data Data a ble


Output model interface e r
s f
- t r an
Client Reports Services n no
s a
E-mail h
) eฺ a
Reports m
l o
ฺc Guid
Cache Printer a i
File g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Event-Driven
U ic
M Publishing
l API
K
T event-driven publishing API is a PL/SQL package that provides the basic functions
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Event-Driven Publishing API (continued)


The API consists of several key elements:
• 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. r a ble
e
sf
See OracleAS Reports Services Publishing Reports to the Web manual for more
- t r an
information on the Event-Driven Publishing. on
n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Invoking a Report from a Database Event

• Create a database trigger


• Include a parameter list with the required entries:
– GATEWAY
– SERVER
– REPORT le
– r a b
USERID
s f e
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
InvokingU Ma Report l icfrom a Database Event
I T K
Database triggers are the primary mechanism for invoking reports using the event-driven
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Invoking a Report from a Database Event (continued)


Example: Send a report when an employee has submitted an expense report. The code for
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://…');
a ble
f e r
srw.add_parameter(myPlist,'SERVER','repSVR');
a n s
srw.add_parameter(myPlist,'REPORT','alert.RDF'); n -t r
o
srw.add_parameter(myPlist,'USERID','scott/tiger');
s an
srw.add_parameter(myPlist,'ExpenseID',:new.ExpID); ) ha
c o m ideฺ
myIdent := srw.run_report(myPlist);
a ilฺ Gu
END IF; g m e n t
END; i t 3 1@ Stud
a v n this
This trigger will fire after each
rn useor update on the EXP_REP table. When the status of
insert
an expense report changes a
m totDONE, the parameter list is constructed and a report is
( k u o
e myPlist, contains the necessary parameters for submitting the
invoked. The Rparameter s list,
A e n
job:
U M l ic
N IT• KGATEWAY provides the URL to the Reports Servlet that will be used to process the
request.
V
NA • 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 le
r a b
– Validating a parameter value s f e
– Dynamically altering record display - t r an
nno
– Suppressing null fields a
• Use Report-level program units and )create has PL/SQL
m ฺ
libraries for common code ilฺco uide
• Invoke a report from a database g ma enevent tG
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
Using PL/SQL Triggers
VN
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-31 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Summary (continued)
Objects That Must Return a Value
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
a ble
umn) Number, Date f e r
ans
Writing Common Code
n - t r
Use report-level program units or PL/SQL libraries for common code
a no
requirements to
improve productivity and maintenance. ha s
)
Event-Driven Publishing
lฺcom deฺ ui
Use the PL/SQL procedures and functions in the i
aevent-driven
G publishing API to
g m n t
automatically submit jobs to OracleAS Reports
3 1 u de when an event occurs in the
@ tServices
database.
av e thinit sS
r n
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-32 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 ble
f e r a
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 19
K
T practice session contains:
IThis
V N
NA •

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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-33 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 19


1. Create a new report, using p19q1.sql.
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
a ble
f e r
Column
ans
order_id n - t r
order_date a no
h a s
order_total ) eฺ
o m
d. Create a user parameter, user_type, that a has G uid values: Sales
c possible
ilฺtwo
Representative and Sales Clerk. gm e n t
3
e. Ensure that only the GroupitAbove 1@layoutS tuisddisplayed when the user type is Sales
Representative, and thata v nonly the
t h is
Tabular layout is displayed when the user type
r n e
is Sales Clerk.ma
u t o us
Hint: As(kan alternative
e to coding format triggers, you can also use conditional
R
A lice
formatting. n s
U M
To test the result, display the USER_TYPE parameter in the margin of the report.
N IT K Make sure that you can enter a parameter value at run time.
V
NA f. Save the report as p19q1.rdf.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-34 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 19 (continued)


2. Continue with the previous report.
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.
le
4. Open report p19q1.rdf. rab fe
a. Write your own group filter to restrict the number of customers displayed, a n s
depending on the value of a parameter that you enter at runtime.on - t r
Hint: You need to create two parameters, to keep track of how
s a nmany records
have been processed, compared to the cutoff number ) hofarecords required. Make
sure that you can enter the cutoff parameter atc o mtime.ideฺ
run
b. Test the report several times by changing
ilฺ cutoffGparameter
athe u at run time.
g m n t
c. Save the report as p19q4.rdf.
3 1 @ tude
v n it is S
r n a e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 19-35 and/or its affiliates.
2010, Oracle
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Extending Functionality Using


the SRW Package
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

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 ble
fe r a
• Create a simple table of contents s
t r a n
• Create and populate temporary tables on -
n
• Modify visual attributes dynamically sa ha
)
m ideฺ
c o
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview U
T K
IThis lesson provides examples of the contents and use of the Reports Builder built-in
VN
NA package. The package contains program units that you can reference in your PL/SQL
code.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Contents of the SRW Package

SRW.SET_BOOKMARK SRW.DO_SQL
SRW.SET_FONT_STYLE SRW.RUN_REPORT

a ble
f e r
ans
n - t r
SRW.SET_MAXROW a
SRW.TRACE_START
no
h a s
SRW.MESSAGE m ) eฺ
SRW.PROGRAM_ABORT
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ContentsU ic
Mof the Reports
l Builder Built-in Package
K
T Reports Builder built-in package, known as the SRW package, contains procedures,
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Contents of the Reports Builder Built-in Package (continued)


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Outputting Messages

• Warning:
WHEN <exception> THEN
SRW.MESSAGE (999, ‘Warning: report continues’);

• Error:
a b le
WHEN <exception> THEN
e r
SRW.MESSAGE (999, ‘Warning: report terminated’);nsf
- t r a
RAISE SRW.PROGRAM_ABORT;
on
s an
• Exceptions: ) ha
– SRW.INTEGER_ERROR c o m ideฺ
m ailฺ t Gu
– SRW.NULL_ARGUMENTS g
@ d e n
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Outputting
U Messages
K
T SRW.MESSAGE packaged procedure displays a message with a code and text string,
IThe
V N
NA 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
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Outputting Messages (continued)


Is It a Warning or an Error?
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


r a ble
SRW.INTEGER_ERROR You entered a code that is not a numeric integer.sfe
SRW.NULL_ARGUMENTS You omitted the code number or text message
- t r anor
both.
a non
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Executing a Nested Report


1 KING.LIS 2
xxx xxxxxxx
KING xxx xxxxxxx

KOCHHAR
KOCHHAR.LIS
DE HAAN
yyy yyyyyyy
a ble
yyy yyyyyyy
f e r
ans
n - t r
o
DE HAAN.LIS
s an
) ha
zzz
o mzzzzzzz d e ฺ
c i
m ailฺ zzzt G u
zzzzzzz
SRW.RUN_REPORT
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
U
1T K Output from master output
N I
V 2 Output from detailed report
NA
Executing a Nested Report
SRW.RUN_REPORT invokes RWRUN with the string that you specify. Use
SRW.RUN_REPORT to execute a second report from within a report process. For
example:
• Output parts of a report to different destinations
• Divide a large report into several smaller reports that can be run conditionally
Both reports use the same process. SRW.RUN_REPORT starts only one run-time process;
it does not start a new process for each report execution.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Executing a Nested Report (continued)


Example
Run a report called MANAGERS that retrieves the employee record for each manager.
Call the EMPS report (for example, from a group filter). EMPS retrieves the employee
records of all employees managed by the current manager only.
Sample code to implement this example appears on the following page.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Executing a Nested Report

• Example:
SRW.RUN_REPORT
('Report=EMPS
DESTYPE=FILE
DESNAME='||:LAST_NAME||'.LIS
BATCH=YES
MGRNO='||TO_CHAR(:MANAGER_ID));
a ble
f e r
• Exceptions: ans
n - t r
– SRW.RUN_REPORT_FAILURE o
s an
– SRW.RUN_REPORT_BATCHNO
) ha
m ฺ
• Function: SRW.GETERR_RUN ilฺco uide
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Executing
U Ma Nested
l ic Report (continued)
I T K
Example Function Code
VN
NA FUNCTION MGR_REP RETURN BOOLEAN IS
BEGIN
SRW.RUN_REPORT
('REPORT=EMPS
DESTYPE=FILE
DESNAME='||:LAST_NAME||'.LIS
BATCH=YES
MGRNO='||TO_CHAR(:MANAGER_ID));
RETURN(TRUE);
EXCEPTION
WHEN SRW.RUN_REPORT_FAILURE THEN
SRW.MESSAGE(100, 'Error executing EMPS report');
RAISE SRW.PROGRAM_ABORT;
END;
Note: Use LAST_NAME to create the output filename for each manager; use
MANAGER_ID to restrict the EMPS query.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Executing a Nested Report (continued)


Reports Builder raises a specific exception that applies to the SRW.RUN_REPORT
procedure in two cases:
Exception Name Causes
SRW.RUN_REPORT_FAILURE Detail report does not exist.
Detail report failed during execution.
SRW.RUN_REPORT_BATCHNO BATCH parameter is used inconsistently:
master report running with
BATCH=YES,
called a detail report with BATCH=NO

Displaying Report Failure Message a ble


f e r
If the detail report fails during execution, you can display information about the cause
a n s by
using the SRW.GETERR_RUN function. n -t r
o
n using the
Assign the function to a local PL/SQL character variable, which youadisplay
SRW.MESSAGE procedure. ha s
) ฺ
...
ilฺ com ide
msg char(150); ma ent Gu
g
...
i t 3 1@ Stud
EXCEPTION
a v n this
a rn use
WHEN SRW.RUN_REPORT_FAILURE THEN
m
u e to
msg := SRW.GETERR_RUN;
k
(
R
SRW.MESSAGE
A ns(100, msg);
...UM
K lice
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Restricting Data

Before Report trigger


SRW.SET_MAXROW('Q_EMP',3);

Q_EMP le
EMPLOYEE_ID LAST_NAME r a b
s f e
100 KING - t r an
G_EMP 101 no
KOCHHAR
n
a
102 asDE HAAN
) h eฺ
EMPLOYEE_ID m
co uid
LAST_NAME i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Data lic
Restricting
U
I T K
Use SRW.SET_MAXROW to restrict the maximum number of records you want to
VN
NA retrieve for a specified query. Reports Builder uses only the retrieved rows of the query in
subsequent processing, such as computations and summaries.
Suppressing a Query
At run time, you can choose not to display any data from a query by setting the maximum
number of records to zero. This prevents Reports Builder from retrieving any records from
the database.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Restricting Data (continued)


Example
Below is a function to display data for the Q_emp query only if a value of one or more is
entered in a run-time parameter called HOW_MANY:
FUNCTION FETCHIT RETURN BOOLEAN IS
BEGIN
IF :HOW_MANY >= 1 THEN
SRW.SET_MAXROW ('Q_emp', :how_many);
ELSE
SRW.SET_MAXROW('Q_emp', 0);
END IF;
RETURN(TRUE);
r a ble
EXCEPTION
n s fe
WHEN SRW.MAXROW_UNSET THEN
- t r a
SRW.MESSAGE (100,
n n
owas
'Data was fetched before SRW.MAXROW a
a s
called');
m ) h eฺ
RAISE SRW.PROGRAM_ABORT;
WHEN SRW.MAXROW_INERR THENailฺ
co uid
m someonen t G
SRW.MESSAGE(200, 'Contact
@ g d e clever!');
1
it3 is S
RAISE SRW.PROGRAM_ABORT; t u
END; a v n th
a rn e
us in the Before Report trigger; that is, after the query
u m
You must set SRW.SET_MAXROW
t o
has been parsed
R (k before
but seit has been executed. If you call it after the Before Report
A e n
trigger, Reports
U M Builderlic raises the SRW.MAXROW_UNSET exception.
K handle SRW.MAXROW_INERR, always raise SRW.PROGRAM_ABORT,
IIfTyou
N
N AV because your report has an internal problem and you cannot guarantee the outcome.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Initializing Fields

Output: logical page


no. = 2
Paper Layout

Page: F_NEWPAGE Page: 5

1
a ble
f e r
FUNCTION F_LOGICAL_PAGEFormatTrigger
ans
RETURN BOOLEAN IS n - t r
my_page number; a no
a s
) h eฺ
BEGIN
SRW.GET_PAGE_NUM(my_page); m
co uid
2
i l ฺ
SRW.SET_FIELD_NUM(0,my_page+3);
RETURN(TRUE); g ma ent G
END;
n31@ tud
it is S
n v
a e th
r us© 2004, Oracle. All rights reserved.
a Copyright
u m t o
R (k se
M A licen
U
1T K Create format trigger on F_NEWPAGE field
N I
V 2 Set field value to my_page+3
NA
Initializing Fields
You can dynamically initialize the value in a layout field by using the relevant
SET_FIELD packaged procedure; for example:
• SRW.SET_FIELD_CHAR (0, 'a text string')
• SRW.SET_FIELD_NUM (0, 1234)
• SRW.SET_FIELD_DATE (0, '01-JAN-2002')

The first argument is always 0 (zero); you can set the value of the current object.
These procedures are relevant only in the format trigger of a field of the correct type. If
you use a procedure that conflicts with the field type, it has no effect in the report; Reports
Builder ignores the code and does not raise an error.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Initializing Fields (continued)


You can use SRW.SET_FIELD to retrieve the current logical page number and
recalculate the value before displaying it.
Example: Create a function to display the logical page number plus three in a field called
F_NEWPAGE.
Because the logical page number variable is available only in the report layout, not in the
Data Model, you cannot calculate the value in a data column. Therefore, you use a paper
layout field to get the current page number and output a new number by initializing the
same field.
Make use of a packaged procedure called SRW.GET_PAGE_NUM to retrieve the current
logical page number into a local PL/SQL variable, as in the format trigger code on the
previous page.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Table of Contents

• Use SRW.SET_FORMAT_ORDER in an After Parameter


Form trigger to format the Main section of the report
first
• Use SRW.GET_PAGE_NUM in a format trigger to fetch
the page number for each topic in the TOC
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Creating U Ma Tableliofc Contents
I T K
Earlier in the course, you learned that you could use the Format Order of Sections
VN
NA property to modify the order in which Reports Builder formats the sections of the report to
enable you to create a table of contents (TOC).
You can also use the SRW.SET_FORMAT_ORDER built-in procedure to format the
Main section of the report first and use report triggers to build a table containing the TOC
entries. When the first element for the TOC is formatted, a trigger fires and creates a row
in the TOC table containing the TOC entry and the page number. After the Main section
has completed formatting, the format order setting can define that the Header section is
formatted next. The Header section can contain a report block based on the TOC table.
After formatting, you can output your report with a TOC (the Header section), followed
by the report body (the Main section), followed by the Trailer section.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Creating a Table of Contents (continued)


Example: You want to generate a report of all e-mail addresses of your customers. Your
customer database contains thousands of records. You want to group the customers by
country and then generate a table of contents so you can easily find the e-mail address for
the desired customer.
To create a simple table of contents:
1. Create a table in the database to hold the TOC information. You need two columns,
one for the topic and the other for the page number.
2. Use the Report Wizard to create a Group Above report. This report will display the
country name, then the customers and customer e-mail addresses under each country
name. The table of contents you create will then be based on the country name in
this report.
3. Create an After Parameter Form trigger to modify the default order of the report
r a ble
execution, so that the Main section is formatted first.
n s fe
FUNCTION AfterPForm RETURN BOOLEAN IS - t r a
n on
BEGIN
s a
SRW.SET_FORMAT_ORDER(SRW.MAIN_SECTION,
)h a
m ideSECTION); ฺ
ฺco
SRW.HEADER_ SECTION, SRW.TRAILER_
ail t Gu
RETURN (TRUE); m
g den
@
END;
n i t31 is Stu
4. Create a format trigger a onvthe field
ththat displays the country name. The format
r n e
s for each country name, so that the TOC will
a page number
trigger will fetch the
m o u
ku to navigate
enable the (user
s e t to various parts of the report based on the name of the
R
A licen
country.
M
U FUNCTION F_COUNTRY_NAMEFormatTrigger RETURN BOOLEAN IS
T K
V NI pageNum NUMBER;
NA BEGIN
-- get current page number
SRW.GET_PAGE_NUM(pageNum);
-- insert row into database table
INSERT INTO TOC_TABLE (TOPIC, PAGE_NUMBER)
VALUES (:country_name, pageNum);
RETURN (TRUE);
END;
5. Use the Data Model to create a second query with a formula column that calculates
the page range for the data under each country name. This query will fetch the
information from the database table you created in step 1.
6. Create a tabular report block in the Header section of your report to display the
headings in the table of contents (i.e., the country name), and the page range where
the information can be found in the report.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Performing DDL Statements

• Example:
SRW.DO_SQL('CREATE TABLE SRW_LOG
(RPT_NAME VARCHAR2(40),
REC_NUM NUMBER,
MSG_TEXT VARCHAR2(80))' );
ble
SRW.DO_SQL('INSERT INTO SRW_LOG
s f era
(RPT_NAME, REC_NUM, MSG_TEXT)
t r a n
VALUES
on -
a
(''PAY_REPORT'', TO_CHAR(:EMPLOYEE_ID), n
h a
:LAST_NAME||''PAY REPORT RUN'') s');
m ) eฺ
o
lฺc Guid
• Exception: SRW.DO_SQL_FAILURE a i
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Performing
U ic
M DDL lStatements
I T K
The SRW.DO_SQL packaged procedure executes any specified SQL statement from
VN
NA within Reports Builder.
Use SRW.DO_SQL to perform DDL statements dynamically during run time. For
example, create a temporary table and insert rows into it during execution.
You can also perform DML statements using this procedure, but DML statements run
faster if you code them directly within a PL/SQL block. Code DML statements in the
SRW.DO_SQL procedure only if necessary. For example:
• To insert records into a permanent table in the database, code DML in a PL/SQL
block.
• To insert records into a temporary table that does not exist until run time, code DML
in SRW.DO_SQL.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Performing DDL Statements (continued)


Querying from Temporary Tables
If you want to create a temporary table and reference it in a query in the same report, the
table must exist before the Before Report trigger fires. That is when Reports Builder
parses its queries. Therefore, you must create this table in the Before Parameter Form or
After Parameter Form report trigger.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting Format Attributes

Borderwidth
Tuesday, January 2004 Fill pattern
Format mask

a ble
Printer tray control f e r
ans
n - t r
a no
h a s
m ) eฺ
Define ao bookmark
Car Policy a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
SettingUFormat l ic
M Attributes
I T K
The SRW.SET_<attributes> packaged procedures apply specified format attributes to the
VN
NA current layout object: frame, repeating frame, field, or boilerplate object.
Some of the reasons that you would want to use format attributes are:
• To change the visual appearance of layout objects conditionally, depending on values
in a repeating frame, or on run-time parameter values
• To switch to different printer trays as your report formats
• To place a logo or standard links in an HTML document
• To define a bookmark in an HTML or PDF document
You can code the packaged procedure in a function as a local or report-level program unit,
or in a PL/SQL library. This is useful if you want a common format attribute in more than
one object or more than one report. You can then call the function whenever required
from the format trigger of a specific object.
As an alternative to a PL/SQL library, in the Object Navigator, you can drag and drop
report-level program units between different reports. However, note that this creates a
copy of the program unit in each report, rather than a reference to one piece of code.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting Format Attributes

• Visual attributes:
SRW.SET_FILL_PATTERN('solid');
SRW.SET_BORDER_WIDTH(250);
SRW.SET_FORMAT_MASK('Day, Month yyyy');

a ble
f e r
• Printer tray control:
ans
n - t r
SRW.SET_PRINTER_TRAY('letterhead'); o
s an
) ha
• Defining a bookmark: c o m ideฺ
a ilฺ Gu
SRW.SET_BOOKMARK('Car gPolicy m e n t
');
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
SettingUFormat l ic
M Attributes (continued)
T K
IExample
V N
NA Conditionally set the following attributes if salary is greater than $12000:

Attribute Value
Background fill color Blue
Fill pattern Sandpaper
Font style Italic
Font face Helvetica
Font weight Extra bold
Text color White

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting Format Attributes (continued)


Example (continued)
FUNCTION SAL_MASK RETURN BOOLEAN IS
BEGIN
IF :SALARY > 12000 THEN
SRW.SET_BACKGROUND_FILL_COLOR(‘blue’);
SRW.SET_FILL_PATTERN(’sandpaper’);
SRW.SET_FONT_STYLE(SRW.ITALIC_STYLE);
SRW.SET_FONT_FACE(’helvetica’);
SRW.SET_FONT_WEIGHT(SRW.EXTRABOLD_WEIGHT);
SRW.SET_TEXT_COLOR(’white’);
a ble
END IF;
f e r
RETURN(TRUE);
ans
END; n - t r
o
n output
Remember that you can use the Conditional Formatting dialog box to
s a specify
ha based on conditions
formatting attributes (font and/or color) for a selected layout object
)
that exist. However, if you need to apply other attributeso m e ฺ color, for example,
such asdfill
c i
ailฺ Gu
then you need to use the SRW.SET_<attribute> procedures.
m ent
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Format Attributes in a Web Layout


<rw:field id="F_SALARY" src="SALARY“. . .
formatTrigger="mystyles">
F_SALARY
</rw:field>

a ble
f e r
FUNCTION mystyles RETURN BOOLEAN IS
ans
BEGIN
n - t r
SRW.SET_JUSTIFICATION(SRW.RIGHT_HJUST);
a no
SRW.SET_TEXT_COLOR('Red');
a s
SRW.SET_FONT_WEIGHT(SRW.BOLD_WEIGHT);
m ) h eฺ
ฺ co uid
SRW.SET_FONT_STYLE(SRW.ITALIC_STYLE);
i l
return (TRUE);
g ma ent G
END; @ d
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Using Format
U Attributes in a Web Layout
K
T that the formatTrigger attribute of the rw:field tag is used to modify the display
IRecall
V N
NA characteristics of the field. You can only use specific SRW packaged procedures to set the
field’s attributes. These are:
• SET_FORMAT_MASK • SET_FONT_SIZE
• SET_HYPERLINK • SET_FONT_WEIGHT
• SET_LINKAGE • SET_DISPLAY_NAME
• SET_TEXT_COLOR • SET_FIELD_CHAR
• SET_JUSTIFICATION • SET_FIELD_DATE
• SET_FONT_FACE • SET_FIELD_NUM
• SET_FONT_STYLE

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Format Attributes in a Web Layout (continued)


Example
In the example on the previous page, the formatTrigger attribute contains the name of the
function mystyles. When executed, mystyles will set the following attributes on the
salary field:
Attribute Value
Justification Right
Text color Red
Font weight Bold
Font style Italic
Using Format Attributes in Character Mode Reports
a ble
Some attributes are applicable to character environments only; some are for bitmapped e r
environments only. a n sf
n - tr
o or the
If you include a bitmapped attribute and then run the report in characternmode,
a
s This enables you to
reverse, Reports Builder ignores the code and does not cause anaerror.
develop a report for use in a different environment. h
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
U M l ic
I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Summary

In this lesson, you should have learned how to:


• Describe the SRW package contents:
– Procedures
– Functions
– Exceptions le
r a b
• Use SRW.PROGRAM_ABORT to stop report processing s f e
• Use the SRW package to: - t r an
on
– Execute a detail report
s an
– Create a table of contents ) ha
c o m ideฺ

ailฺ t Gu
Dynamically execute DDL statements
m
– Provide conditional layout
3 1@ Studen and display
g formatting
i t
n this
a v
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
• The SRW package contains procedures, functions, and exceptions.
VN Remember that you can raise the exception SRW.PROGRAM_ABORT in your PL/SQL
NA code to stop report processing at any time.
• The SRW package provides a number of features, including:
- Executing a second report from within a report process, using
SRW.RUN_REPORT
- Modifying the format order for a report and then getting the resulting page
numbers for the Main section so that you can create a table of contents in the
Header section
- Support for DDL statements, using SRW.DO_SQL, to enable you to create or drop
temporary tables from PL/SQL code in a report
- Conditional formatting and display using SRW.SET_<attributes>

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 20 Overview

• Building a report containing conditional highlighting


• Modifying a Web report with conditional
highlighting
• Executing a detail report from a master report
• Writing to a temporary table from a report ble
f e r a
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 20
K
T practice session contains:
IThis
V N
NA •

Building a report containing conditional highlighting
Modifying a Web report with conditional highlighting
• Executing a detail report from a master report
• Writing to a temporary table from a report
In this practice session, you highlight values based on conditional PL/SQL code.
You build a master report that enables you to call a detail report and generate a separate
PDF file for each detail report.
If you have time, you add report-level triggers to an existing report to write messages to a
temporary table at various stages of report execution.
• Write PL/SQL functions as local PL/SQL (report-level), and reference the code in a
condition within the relevant object trigger in the report.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 20


1. Open report p9q3.jsp.
a. Display the column CUST_TOTAL in the customer group as red, bold italics if
its value is 10,000 or more.
Hint: Check the Help system for the SRW.SET <attributes> or use conditional
formatting.
Mask Attribute Suggested Value
SRW.SET_TEXT_COLOR Red
SRW.SET_FONT_WEIGHT SRW.BOLD_WEIGHT
SRW.SET_FONT_STYLE SRW.ITALIC_STYLE

You can copy the code from the file p20q1a.txt.


b. Alter the pattern and color of those records where the customer total is 5,000e orra
ble
less. a n sf
Hint: Check the Help system for the SRW.SET <attributes> or o n
use tr
-conditional
formatting.
s an
Attribute Suggested Values) ha
Fill pattern c om uideฺ
Crisscross,lฺsandpaper
Foreground fill color m
Yellow
ai t G
@ g den
Background fill color t31 Green tu
i
np20q1b.txt.
i s S
You can import the a v
file t h
a
c. Write the necessaryrn formats e
triggers.
to u
um asep20q1.jsp.
d. Save the(kreport
A
e. Run Rthe paper
e s
nlayout.
UM with
2.KContinue
c
li the same report.
N IT a. Run the Web layout for the report. Is there formatting on the CUST_TOTAL
V
NA column?
b. Modify the Web source so that the column CUST_TOTAL in the customer
group as displays as red, bold italics if its value is 10,000 or more.
c. Save the report as p20q2.jsp.
d. Run the Web layout to test.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 20 (continued)


3. Execute a detail report from a master report.
a. Create a simple tabular report called MGR_MASTER. The report should query
last names and employee IDs for those employees who are managers. Display all
fields. You can use the query:
SELECT distinct manager.last_name Manager,
manager.employee_id
FROM employees worker, employees manager
WHERE worker.manager_id = manager.employee_id
b. Save the report as mgr_master.rdf.
c. Create another tabular report, the detail report, and name it EMP_RPT. The
report should return department number, employee name, and salary for a
specific manager. The manager_id will be passed to EMP_RPT by
MGR_MASTER. r a ble
d. Save the report as emp_rpt.rdf and close it. n s fe
- t r a
e. Write the code to execute the detail report. For each manager returned,
n onit the
MGR_MASTER should invoke the detail report, EMP_RPT,
s a pass
manager’s employee_id, and produce a report in PDF
) h aformat containing
information about the employees working forothat m manager.d ฺ
e Use the manager’s
l ฺ c u i
employee_id to create an output filename
m ai for each
t Gmanager:
MGR_<employee_id>.PDF. g
@the group e n
dfilter.
Hint: You can write the code 3 1in
it is S t u
f. Compile the PL/SQL v n
a eandthclose the window.
code
g. Run the paper r n s
a foruMGR_MASTER
layout to test. Access the file system and
u m t o
(koutputsefor the detail reports. View two or three of the output files.
locate the
R
M en
A mgr_master.rdf
h. Save
lic
and close it.

IT KU
If You Have Time
N
V 4. Open report p10q1.rdf
NA In this report, you use report triggers to create a temporary table at the start of report
execution, and you insert rows into the table at various stages of the execution.
a. Write a trigger that creates a temporary table to hold the date and userid each
time the report is run. The table should contain three columns: one date column,
one character column of width 10, and one character column of width 80.
CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10), COMMENTS
VARCHAR2(80))

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 20 (continued)


b. The same trigger should also insert the current date, userid, and “Starting
Report” into this table.
INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, 'Starting Report')
Hint: Think about how you code the single quotes.
c. Compile the PL/SQL code and close the window.
d. Save the report as p20q4.jsp.
e. Run the paper layout.
f. Using SQL*Plus, verify that your table exists and was populated successfully.
g. Log on to SQL*Plus (in Microsoft Windows, select the SQL*Plus icon in the
r a ble
Oracle group) using the same userid as you used for Reports.
n s fe
h. Display all records in the RUNREPORT table. - t r a
SQL> col comments format a40 n on
SQL> SELECT * FROM RUNREPORT;as
a
h
)run theeฺreport a second time,
i. Try running the report more than once. Whenoyou m d
the table already exists and Reports Builder
a ilฺcraisesGanuiexception. Make the
necessary change to your code so that m n
g thedreportt
e runs even when the table exists.
1 @ t u
j. Write a trigger that insertsita3record with
S the comment “Printing another page”
v n
whenever it beginsnaanew page. th i s
r e
usa record with the comment “Report completed” when
athat inserts
u m
k. Write a trigger
t o
(kfinishes.
the report
R se
A e n
c as s20q4l.jsp. Generate the output to a PDF file. Verify the
l.UM
Save thelireport
IT K results in SQL*Plus.
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 20-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Maximizing Performance Using


OracleAS Reports Services
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Objectives

After completing this lesson, you should be able to


do the following:
• Describe the OracleAS Reports Services
architecture
• Distinguish between the JSP and Servlet run-time
architectures r a ble
n s fe
• Describe the various ways to run a report - t r a
• List the options for managing and monitoring n on
s a
OracleAS Reports Services )h a
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Overview
U
T K
IWhen you are ready to publish your reports, all the Web server and application server
VN
NA tools you need are available in the Oracle Application Server.
In this lesson, you will learn about the architecture of relevant Oracle Application Server
components in combination with its reports publishing component, OracleAS Reports
Services. You learn how to make report requests, and about the options available for
managing and monitoring Reports Services.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running Reports Using


OracleAS Reports Services

• Provides the deployment platform


• Formats, prints reports on a powerful server
• Eliminates rerunning reports
• Enhances scalability and performance
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Running U Reportslic
M Using OracleAS Reports Services
T K
IOracleAS
N Reports Services is the reports publishing component of Oracle Application
V
NA Server. It is an enterprise reporting service for producing high quality production reports
that dynamically retrieve, format, and distribute any data, in any format, anywhere. You
can use OracleAS Reports Services to publish in both Web-based and non-Web-based
environments.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running Reports Using OracleAS Reports Services (continued)


Benefits of OracleAS Reports Services
OracleAS Reports Services provides a flexible architecture for the distribution and
automated management of report generation engines on the same server and across
multiple servers.
• When used in conjunction with JSP, servlet, or CGI, OracleAS Reports Services
enables you to run reports on any platform from a Web browser using a standard URL
syntax. The JSP engine runs the Web layout. The Reports servlet runs the paper
layout. Reports CGI is maintained only for backward compatibility.
• Reports are formatted on a high-performance NT or UNIX server.
• Reports Services caches the output in a central repository on the server machine. With
OracleAS Reports Services, the Reports cache is persistent. This means that if the
server is shut down and then restarted, all jobs are recovered, not just scheduled jobs. able
• Reports Services detects duplicate reports. Users can share output without rerunning s f er
the report. - t r an
• You can implement multiple run-time engines for one Reports Services n onmachine.
• You can implement multiple Reports Services server instances s a one machine.
on
a
) hto allow
• OracleAS Reports Services provides peer-level clustering ฺ sharing of the
o m e
Reports Server load among multiple machines ifor uidscalability.
lฺcunlimited
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Request Methods

• RWCLIENT command line


• URL syntax
• OracleAS Portal
• SRW.RUN_REPORT
• Event-Driven Publishing API
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ReportU M
Request l ic
Methods
I T K
You can run a report using various request methods. Below is a brief overview of each
VN
NA method.
• The RWCLIENT command: This enables you to run a report from the command
line prompt in a non-Web environment. RWCLIENT is an executable that parses and
transfers the command line to the specified OracleAS Reports server. It can use
command line arguments similar to those used with the OracleAS Reports Runtime
executable file, RWRUN.
• URL syntax: To run a report from a Web browser, use the URL syntax. The
OracleAS Reports Servlet (and CGI, for backward compatibility) converts the URL
syntax into an rwclient command line request that is then processed by OracleAS
Reports Services. You can give your users the URL syntax needed to make the report
request from their browser, or you can add the URL syntax to a Web site as a
hyperlink.
• OracleAS Portal: OracleAS Portal enables you to add a link to a report on a portal
page or portlet. Authorized users accessing the Oracle Portal site simply click the link
to run the report. You can also publish your report output directly in a portlet. Using
OracleAS Portal makes it more convenient and secure to publish a report on the Web.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Report Request Methods (continued)


• SRW.RUN_REPORT: This is a packaged PL/SQL procedure that submits a report to
Reports Services. In the argument list, you specify the JSP or servlet information in
addition to the Reports parameters, and RUN_REPORT sends the request to Reports
Services. Set the SERVER argument to the OracleAS Reports Services server name to
cause the SRW.RUN_REPORT command to behave as though you executed the
RWCLIENT command.
• Event-Driven Publishing API: The Event-Driven Publishing API is a PL/SQL
package that allows for the automatic submission of jobs to OracleAS Reports
Services from within the database. The API provides the basic functions required for
the development of procedures that respond to events in the database. With the event-
driven publishing, you can automatically run a report in response to a database event,
such as the insertion of a record or the change of a value. Event-driven jobs are
submitted using the HTTP protocol. The server assigns a unique job identifier to every r a ble
call, useful for tracking the status of the job. The Event-Driven Publishing API n s
is
fae
- t r a
PL/SQL API. on
n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Oracle Application Server Components

Web
Enterprise Application Development Framework Services
System Management

Security and Identity


Portal

Management
Portal Business Integration
Intelligence Broker
Any Data
Source
Application server a ble
f e r
Mobile and
a n s
Wireless
Grid Computing Infrastructure -t r
nPackaged
a noApplication
Oracle Application Server 10gha
s
m ) eฺ
o
ilฺc Guid
Business
Intelligence
m a t B2B

@ g de n
n i t3 is Stu
1
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
OracleAS U Reports Services Architecture
T K
IOracleAS
N Reports Services is architected to publish reports in both Web-based and non
V
NA Web-based environments. Reports Services can be configured in a number of ways
depending on your requirements. In this section, you will learn about the OracleAS
Reports Services runtime architecture and the various commands used to invoke a report
that is deployed on the Oracle Application Server.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

OracleAS Reports Services Architecture (continued)


First, you should be familiar with the key components of Oracle Application Server:
• The OracleAS HTTP Server is a Web server. It incorporates an OpenSSL module to
provide support for Secure Sockets Layer (SSL) and HTTP Secure Sockets Layer
(HTTPS). It also provides a servlet engine to support the running of Java Servlet
applications. It is the HTTP Listener.
• The module mod_OC4J is used by the HTTP Listener to redirect requests for servlets
and JSPs to OracleAS Containers for Java 2 Enterprise Edition (OC4J). OC4J provides
a fast, lightweight, highly scalable, easy-to-use complete J2EE environment that
includes a JSP translator, a JSP servlet engine, and an Enterprise JavaBeans (EJB)
container.
• The Reports Servlet runs inside the Web server’s servlet engine. The Reports Servlet
translates and delivers information between HTTP and the Reports Server.
r a ble
• The Reports CGI translates and delivers information between either a Web serverfeor
a J2EE Container (for example,OC4J) and the Reports Server. This component a n s
n -t r
enables you to run a report dynamically from your Web browser. o
n fetches
• The Reports Server processes client requests. It spawns runtime s aengines,
completed reports from the Reports cache, and notifies the ) a that the report is
hclient
ready. c o m ideฺ
• The Reports Engine includes componentsm
lฺ GSQL-
airunning
for
u and PDS-based reports.
g formats e t
n the reports, sends the output to
It fetches requested data from the data @ source, d
tujob is complete.
cache, and notifies the Reports n i t31 ithat
Server s Sthe
• The Reports Server Cache r n avstorese completed
th jobs.
a s
m to u the OracleAS Reports Services architecture consists of
When used in a Webuenvironment,
four tiers: R ( k se
A e n
c Web browser)
• TheU M
client tierli(a
I T•KThe Web server tier
N
V • The OracleAS Reports Services tier
NA • The data tier, including databases and pluggable data sources
When used in a non-Web environment, there are three tiers (a Web server being
unnecessary):
• The client tier
• The OracleAS Reports Services tier
• The data tier

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enabling Single Sign-On Access

Oracle Internet Directory

a ble
f e r
• Log in only once ans
n - t r
• Access application level authentication o
s an
• Access data level authentication ) ha
l ฺ c om ui deฺ
m ai t G
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
Enabling
U Single Sign-On Access
K
T deploying reports, you need to ensure that your user has the necessary privileges to
IWhen
V N
NA run that particular report, at that particular time, on that particular server.
Likewise, now that pluggable data sources are part of the benefits offered to you through
Oracle Reports, you need to ensure that your user has the privileges to access the required
data sources. You may want to spare your user the trouble of having to log in to multiple
data sources in order to run one job.
You can address application level authentication and data level authentication through
single sign-on (SSO).

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Enabling Single Sign-On Access (continued)


SSO enables you to establish unique identities for each user which are tied to resources
unique to that user. The user’s resources contain key-identified connection strings for
accessing different data sources. The user is uniquely identified through a once-per-
session login, and the login references the user’s resources to ensure that he or she has
access to the appropriate data sources, without users having to enter this information
themselves.
SSO is made possible through the partnership of OracleAS Reports Services, Oracle
Internet Directory (OID), and the Oracle Login Server, all delivered through the Oracle
Application Server.
Technical Note
For more information on data source single sign-on, see the OracleAS Reports Services, ble
Publishing Reports to the Web manual.
s f era
For information about the requirements and procedures required for setting up - t r an
SSO-
related components, such as the Oracle Internet Directory, see the Oracle
n n
oInternet
s a
Directory Administrator's Guide and the Oracle HTTP Server Administrator's Guide on
h a
the Oracle Application Server documentation CD and onm the) Oracleฺ Technology Network
o e
(http://otn.oracle.com). ilฺc uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running the Web Layout:


JSP Run-time Architecture

HTTP

Oracle HTTP Listener


mod_OC4J
a ble
rept.jsp JSP Engine
f e r
ans
- t r
OID CORBA/IIOP
n on
CORBA/IIOP
s a
Reports
OracleAS a
) h Engine
Reports Services om
d e ฺ
c i
m ailฺ t Gu PDS
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
RunningU Web Layout: JSP Run-time Architecture
the
K
T use the JSP run-time architecture to run the Web layout.
IYou
V N
NA The JSP engine runs the Reports JSP because in a Reports JSP, you can include not only
Reports custom JSP tags, but tags from other libraries as well. Hence, the Reports JSP
cannot be run within Oracle Reports because it may contain tags that are not Reports
custom tags.
The JSP engine executes the JSP, and the Reports custom JSP tags invoke the Reports
server to ensure that the user is authenticated to run the report. Once authentication has
been established, the Reports server spawns a Reports engine and sends the request to that
engine. The Reports engine retrieves the data from the specified data source(s) and passes
it to the JSP engine. The JSP engine formats the data and returns it to the user. The
communication between the JSP engine, the OracleAS Reports server, and the Reports
engine is done through industry standards, Common Object Request Broker Architecture
(CORBA) and Internet Inter-ORB Protocol (IIOP).

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running the Paper Layout:


Servlet Run-time Architecture
HTTP

Oracle HTTP Listener


mod_OC4J
Fax
Reports Servlet int
Pr
CORBA/IIOP a ble
OID ma
il f e r
OracleAS Reports Services an s
n - t r
no
CORBA/IIOP a s a
m ) h eฺ
rept.rdf Reports lฺco u id
a i G
rept.jsp g m ent
Engine

i t 3 1@PDS S tud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Running U Mthe Paperl ic Layout: Servlet Run-time Architecture
I T K
You use the Servlet run-time architecture to run the paper layout.
VN
NA When a request is received for the Reports servlet, the servlet contacts the Reports server
to ensure the user is authenticated to run the report. Once authentication has been
established, the Reports server spawns a Reports engine and sends the request to that
engine to run the report. The Reports engine executes the RDF by:
• Retrieving and formatting the data
• Populating the Reports cache
• Notifying the Reports server that the report is ready.
The Reports server accesses cache and send the report to the specified output destination.
If the report is a Reports JSP that contains a paper layout, the Reports engine interprets the
paper layout, coded in XML, and executes the report as stated above.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running a Paper Report on the Web

URL syntax:
http://vesuvius.world.com:8888/reports/rwservlet?
report=emp_dept.rdf&desformat=html&destype=cache&
server=repsrv1&dept_param=10
Key map file: cgicmd.dat
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Running U M c
a PaperliReport on the Web
T K
IOracleAS
N Reports Services supports requests both from Web and non-Web clients. This
V
NA section covers how to run a report in both environments.
Thanks to the Reports thin client Web interfaces (the Reports Servlet or JSP), running a
report on the Web is simply a matter of entering a URL, just as you would fetch almost
any document on the Web. The URL specifies all the required information to run the
report, such as: what report to run, what format to produce the output in, whether to
schedule the report, and so on. Consider the following example:
http://vesuvius.world.com:8888/reports/rwservlet?
report=emp_dept.rdf&desformat=html&destype=cache&
server=repsrv1&dept_param=10

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running a Paper Report on the Web (continued)


In the example, the first line contains the Web server hostname (vesuvius), the domain name
(world), the port (8888), and the alias (reports), a virtual path that stands in for the absolute
path to the files the URL will access. RWSERVLET invokes the OracleAS Reports Services
servlet. The question mark (?) identifies the beginning of the command line arguments such
as the module name, destination format, destination type, Reports server name, and a value
for a runtime parameter.
The Key Map File
As you can see from the example on the previous page, the URL can become quite long. To
get around this problem, the key map file cgicmd.dat can be used. The key map file
contains command strings for running reports, each identified by a unique keyword. By
using key mapping, the command line arguments are all hidden from the user. By default,
the key map file is located in the <oracle_home>/reports/conf directory. For the r a ble
example above the mapfile entry may look like the following: n s fe
- t r a
emp_rep1: report=emp_dept desformat=html destype=cache
no n
server=repsrv1 dept_param=%1 s a
h a
Note that the delimiter is the map file entry is a space. m) ฺ
c o i d e
The URL now becomes much shorter:
m ailฺ t Gu
g den
http://vesuvius.world.com:8888/reports/rwservlet?emp_rep1&10
@
Technical Note n i t31 is Stu
n a v th without installing Oracle Application Server,
a
For information on testing rreports e
us Note How to Execute Reports Services from 9iDS on
deployment
refer to the Oracle u m t o
R (k se
Reports Technical
A licenNetwork (http://otn.oracle.com).
the Oracle Technology
M
K U
I T
VN
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running a Report from the Command Line

• SERVER = <server_name>
• MODULE|REPORT = <runfile>
• DESTYPE = FILE, PRINTER, MAIL, CACHE,
LOCALFILE, SYSOUT,ORACLEPORTAL
• DESNAME = <desname> ble
f e r a
• DESFORMAT = PDF, HTML, HTMLCSS, RTF, s
DELIMITED, XML - t r an
no n
s a
RWCLIENT SERVER=server1 MODULE=my_rep.rdf
) ha
DESTYPE=cache DESFORMAT=html
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
RunningU a Report from the Command Line
T K
IExample
V N
NA 1. Invoke the command line. In Windows NT, Select Start > Run.
2. Enter the command string, for example:
RWCLIENT.EXE SERVER=server1 REPORT=my_rep.rdf
DESTYPE=FILE
DESFORMAT=PDF DESNAME=my_rep_output.pdf
This command references an executable file that parses and transfers the command line to
the specified OracleAS Reports server. The report is run immediately.
Returning Control to the Client
Include BACKGROUND=Yes in your RWCLIENT command line, the report runs
asynchronously, and then RWCLIENT returns immediately after submitting a job request
to Reports Services.
Technical Note
For a complete list of command line arguments, refer to Oracle Application Server
Reports Services, Publishing Reports to the Web documentation.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The OUTPUTIMAGEFORMAT Parameter

Commands that can use OUTPUTIMAGEFORMAT:

rwclient rwrun rwbuilder rwservlet rwcgi


a ble
f e r
ans
n - t r
a no
Syntax: a s
h
) eฺ
OUTPUTIMAGEFORMAT={PNG|JPEG|JPG|GIF|BMP} o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M l
The OUTPUTIMAGEFORMAT
U ic Parameter
K
T in the course, you learned the various image formats that you can specify for your
IEarlier
N
V report output. The OUTPUTIMAGEFORMAT parameter enables you to explicitly choose
NA the format for images in your report output. You can specify this parameter for the
rwclient, rwrun, rwbuilder, rwservlet, and rwcgi commands.
The values that you can specify for the OUTPUTIMAGEFORMAT parameter are:
• PNG, JPEG, JPG supported image formats when the destination format is PDF,
HTML, HTMLCSS, or RTF
• GIF supported image format when destination format is PDF, HTML, or HTMLCSS
• BMP supported image formats when destination format is RTF
The format of the source image is converted to the format you specify using the
OUTPUTIMAGEFORMAT parameter. For example, invoke the Reports Builder using the
following command:
RWBUILDER.EXE HR/HR@ORCL OUTPUTIMAGEFORMAT=PNG
When you generate the report output to any file type, the output images will be stored in
PNG format regardless of the source format. You must take care to ensure that the format
that you specify is compatible with the output file type.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Schedule Parameter

SCHEDULE = [FREQ from] TIME [retry n after LEN]

RWCLIENT...
SCHEDULE=monthly_last_weekday_from_17:00_Nov_22,_2003_
retry_3_after_1_hour
a ble
f e r
ans
n - t r
FREQ CLOCK o
nDATE
s a
h
) eฺ a
o m
a ilฺc GuidTIME
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
The Schedule
U l ic
M Parameter
I T K
SCHEDULE is a scheduling parameter that you can include in the RWCLIENT command
VN
NA line to control the time and frequency with which your report runs.
The syntax of the SCHEDULE parameter comes primarily from the syntax of a “cron” job
on UNIX. To avoid quoting the schedule string, use underscores (_) instead of spaces.
In default mode, the program runs the report immediately.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

The Schedule Parameter (continued)


Syntax
The full syntax of the SCHEDULE parameter is:, [SCHEDULE=] string, where the string
is, [FREQ from] TIME [retry {n} + after LEN]
FREQ = hourly|daily|weekly|monthly|{every
LEN|DAYREPEAT}|{last {WEEKDAYS| weekday | weekend} before
{n}+}
TIME = CLOCK [DATE] [INCR]
CLOCK = <hh:mm>
DATE=<calendar date>
INCR = {+LEN} | {next SUFFIX}
a ble
LEN = {n} * SUFFIX
f e r
ans
SUFFIX = <time, date, FREQ>
n - t r
Example o
SCHEDULE=hourly_from_09:00am_Mar_01,_2002as
an
m ) h eฺ
i l ฺ co uid
SCHEDULE=last_weekday_from_17:00_Oct_23,_2001_retry_3_afte
ma ent G
r_ 1_hour
Note: This syntax is necessary only if you g
@wantttoudcontrol your report jobs from the
command line. You can also specify 3 1
it the scheduled
S time and frequency of a report when
v n h i s
a e tQueue Manager screen, which you learn about
you define a new job in thern
easy-to-use
later in this lesson. um a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Reports Caching

Cached reports on server:


• Tolerance = n (minutes)
• Tolerance = 0 (default/current behavior)
• Maximum tolerance is 232 minutes (approximately
10,000 years) ble
fe r a
• Cached output controlled by a CACHEDIR server s
t r a n
parameter n -
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Reports U M
Caching l ic
I T K
Include the TOLERANCE parameter in your command line to set the maximum
VN
NA acceptable time (in minutes) for reusing a report's cached output when a duplicate job is
detected. Setting the time tolerance on a report reduces the processing time when
duplicate jobs are found.
Setting TOLERANCE=60 means that Reports Services can detect a duplicate report
request for the same report and return the existing cached output to the client without
rerunning the report if the existing report output is 60 minutes old or less.
Setting TOLERANCE=0 forces the report to rerun for each request. This is the default
behavior.
Reports Services uses a parameter CACHEDIR to determine where to place the cached
output. The default directory is <oracle_home>\reports\cache.
Technical Note
For more information on OracleAS Reports Services, see the eClass Oracle9iAS Reports
Services: Deploy Internet Reports. Also refer to Oracle Application Server Reports
Services, Publishing Reports to the Web documentation.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using Oracle Enterprise Manager

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using Oracle
U ic
M Enterprise
l Manager
K
T section introduces Oracle Enterprise Manager as a means for monitoring OracleAS
IThis
V N
NA Reports Services. It also explains the features of the Queue Manager and how to use it to
view and schedule reports in an easy-to-use GUI.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Managing and Monitoring OracleAS


Reports Services

• Start, stop, and restart a Reports server


• View and manage:
– Current Jobs queue
– Scheduled Jobs queue
– Finished Jobs queue le
r a b
• Monitor server performance s f e
• Edit server configuration - t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ManagingU ic
Mand Monitoring
l OracleAS Reports Services
T K
IOracleAS
N Reports Services operates under the centralized management provided for
V
NA Oracle Application Server by Oracle Enterprise Manager (OEM). Oracle Enterprise
Manager is Oracle's single, integrated solution for administering and monitoring global e-
business enterprises. OracleAS Reports Services can be managed through the new
browser-based user interface for Oracle Enterprise Manager.
Using OEM, you can:
• Start and stop your OracleAS Reports server
• Monitor response metrics
• Edit server configuration
• View server trace information
• View the server log file
• View the various job queues
Because OracleAS Reports Services is integrated with Oracle Enterprise Manager, you
can administer it right along with all the other Oracle Application Server components.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

What Is the Queue Manager?

Real-time Reports Server status:


• View report status and scheduled jobs
• Refresh to see the up-to-date status
• Reprioritize or cancel jobs
a ble
f e r
ans
n - t r
a no
• Administrator password encrypted in .conf a s file
h
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Queue
What IsUthe l icManager?
I T K
The Queue Manager is a facility that enables users and administrators to view the current
VN
NA status of each report.
You can see all the jobs controlled by the master, as well as the server on which each job
is running, and the time that each report started and finished, and whether it terminated
successfully or with an error.
You can also view jobs that are scheduled to run at a future date or time.
You can reprioritize or cancel your own scheduled jobs. Administrators can reprioritize or
cancel any scheduled jobs.
Administrator Privilege
In the <servername>.conf file, the first line gives an encrypted password, IDENTIFIER=.
You can set this password the first time that you start the Reports Services. At the login
prompt, select any username and password to assign as Administrator.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Queue Manager

Past jobs

Current jobs
Scheduled jobs

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
QueueU M
Manager l ic
I T K
The Queue Manager status bar enables you to switch among different views of report
VN
NA jobs.
Icon Name Description
Show Past Jobs Displays jobs that have already run for a given reports server
Show Current Jobs Displays jobs that are currently running
Show Scheduled Jobs Displays scheduled jobs in order to reprioritize or cancel a job

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Queue Manager

All my jobs

All jobs
Refresh

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
QueueU M
Manager l ic
(continued)
I T K
The Queue Manager status bar enables you to restrict the view of jobs by owner.
VN
NA Icon Name Description
Show All My Jobs Displays your reports for a given reports server
Show All Jobs Displays all reports for a given reports server

Displaying Up-to-Date Job Status


Click Refresh on the status bar to refresh the screen and display the up-to-date status.
The default update interval is 15 seconds. You can alter this interval in the Queue
Manager preferences window. Select Options > Preferences > Polling Interval.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Using the Queue Manager

RSVR1
Queue
Manager
RSVR2

a ble
f e r
• Connect to any number of servers
a n s
n -t r
• Administrator can shut down server n o
s
• Reports Services restores scheduled jobsa
) ha after
shutdown om eฺ
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Using the
U c
MQueueliManager
I T K
You can connect to Reports Services by changing the server name in the Queue Manager
VN
NA status bar.
You can shut down Reports Services from the Queue Manager menu if you have
Administrator privileges. Select Queue > Shutdown. This option remains grayed out if
you are not logged on as Administrator.
Reports Services maintains a list of all scheduled jobs in a file, <oracle_home>/
reports/server/servername.dat. If Reports Services shuts down and restarts
for any reason, it reads this file at startup and restores all scheduled jobs.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Summary

In this lesson, you should have learned how to:


• Describe the JSP and servlet run-time architectures
• List several ways to run a report
• Describe the features of Oracle Enterprise Manager
and Queue Manager for monitoring Reports ble
Services f e r a
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
• OracleAS Reports Services provides a flexible architecture for the distribution and
VN automated management of report generation engines on the same server and across
NA multiple servers, in both Web-based and non Web-based environments.
• Run a report using several methods:
- RWCLIENT
- URL syntax
- OracleAS Portal
- SRW.RUN_REPORT
- Event-Driven Publishing API
• OracleAS Reports Services Runtime Architecture
- Run Web layouts using the JSP runtime architecture.
- Run paper layouts using the Servlet runtime architecture.
• Use Oracle Enterprise Manager to monitor OracleAS Reports Services.
• Use Queue Manager to view and schedule reports.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 21 Overview

• Constructing a URL to run a report on the Web


• Creating an entry in the key map file

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 21
K
T practice session contains:
IThis
V N
NA • Constructing a URL to run a report on the Web
• Creating an entry in the key map file
You publish your reports using OracleAS Reports Services in the Oracle Application
Server. This practice session consists of paper-based questions to test your understanding
of OracleAS Reports Services.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 21


1. You created a report called SalaryByDept.jsp that displays the salary
information for a particular department value by accepting a runtime parameter
p_deptno. You need to deploy the report on the Web using a URL.
Component Description
Web server neptune
domain name world
port 8889
alias for the directory path salarydata
The report should be executed by repserver4, the output should be in
HTMLCSS format, and go directly to OracleAS Reports cache. Access the data by
connecting to the Employee database using a username of scott, a password e ofra
ble
tiger, and EmpDB as the database connect string. Construct the URL to a n
run sthef
report using the Reports servlet. n - tr
2. So that you do not have to enter such a long URL each time you a nothe
run
SalaryByDept report, create a key entry in the cgicmd.dat h a s key map file entry
located under <ORACLE_HOME>\reports\conf. m ) eฺ
o uidparameter p_deptno in
a. Name the key salary. Be sure to include a ilฺcthe runtime
G
the key entry. g m ent
b. Reconstruct the URL to run i t 3 1@
the report
S ud the key. Pass a value of 30 for
tusing
p_deptno. a v n this
3. aarnURL,uwhat
In addition to using
m se are the other methods for requesting a report?
4. ku runtime
What is the(JSP e toarchitecture used for?
s
R facilities
5.
U
WhichAtwo
M licen can be used to monitor OracleAS Reports Services?
I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 21-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building Reports: Efficiency Guidelines

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Objectives

After completing this lesson, you should be able to do


the following:
• Describe performance areas
• Use performance measuring tools
• Build reports to run in other languages ble
f e r a
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
OverviewU M l ic
I T K
A report does not run in a vacuum. It is dependent on the underlying hardware, software,
VN
NA and network connection. Because of this complex interrelationship, performance is always
an issue. The second part of this lesson focuses on performance in the run-time
environment and gives you a number of performance tips. You should also realize that
Report applications are portable across multiple platforms and multiple languages. You
can reduce cross-platform development effort by planning for platform-specific features
or restrictions. In this lesson, you also learn how to build reports to run on various
platforms, and in different environments and languages.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Tuning Reports

• No absolute rules
• Investigate specific areas:
– Data Model
– Paper Layout
– Web Layout and JSP report definitions le
r a b
– Run-time arguments
s f e
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M Reports
TuningUOracle l ic
I T K
Tuning a report is not a matter of applying a few small tweaks that will result in dramatic
VN
NA improvements in performance. It is more a case of investigating specific areas. The areas
to investigate are the Data Model, the Paper Layout, the Web Layout and JSP reports
definitions, and run-time arguments. Investigating some of these areas can result in
significant performance improvements, minor performance improvements, or may have
no effect on the actual performance at all, but rather impact the perceived performance.
Be aware that there are no absolute standards.
The Reports Measurement Tools
The first step to take when attempting to tune a report is to determine where the report is
spending the majority of its time in execution. In other words, does the report spend a
large portion of its time in the database retrieving the actual data, in the formatting
process once the data has been retrieved, or waiting for runtime resources and
distribution?

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Tuning Oracle Reports (continued)


The Reports Trace Option
The Reports Trace option produces a file that describes the series of steps completed
during the execution of the report. You have the option to log all events or only a subset
of events such as SQL execution or breakpoints. The trace file can provide very useful
information for performance evaluation, and also tells you what executed when.
Tracing can be set for various methods of report execution, for both RDF and JSP report
definitions containing SQL and non SQL data sources, such as the XML and Text
pluggable data sources.
To set the Trace option, use the TRACEFILE=<filename> command line argument when
running the report, or from the main menu select Program > Tracing.
Typical profile output is shown below:
a ble
f e r
Reports Profiler Statistics
ans
TOTAL ELAPSED Time: 29.00 seconds n - t r
a
Reports Time: 24.00 seconds (82.75% of TOTAL) no
s
) ha
ORACLE Time: 5.00 seconds (17.24% of TOTAL
m ideฺ
c o
UPI: 1.00 seconds
a ilฺ Gu
SQL: 4.00 seconds g m e n t
3 1@ time d elapsed time) for the report, the
tu(total
i t
In this profile output, you see the execution
nthe retrieved S
is data (Reports time), and the amount of time
amount of time spent formatting a v t h
spent waiting for the data
m atornbe retrieved
u se (Oracle time), comprised of time spent
(
establishing the database e to
ku sconnection, parsing and executing the SQL statement (UPI
R n
A timelicspent
time), and the e fetching the data and executing SRW.DO_SQL() statements,
U M
I T K
EXEC_SQL statements, PL/SQL cursors, and so forth (SQL time).

A VN
N

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Performance Measurement

Measurement tool: Trace option


Server and network measurements:
• SQL Trace
• Traffic and bandwidth
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
ServerU M Network
and l ic Specific Measurements
I T K
Oracle Reports uses Structured Query Language (SQL) to retrieve data from a relational
VN
NA database. It is essential for anyone tuning reports to have a good working knowledge of
SQL and to understand how the database is going to executes these statements. For those
users less proficient in SQL, Oracle Reports provides wizards to help build queries.
However, wizards cannot prevent inefficient SQL from being created (e.g., SQL that does
not use indexes).
Database servers and network systems often provide measurement tools to obtain
performance information. An invaluable aid for tuning SQL is the SQL Trace facility
provided by the database. SQL trace allows you to determine the SQL statement sent to
the database as well as the time taken to parse, execute, and fetch the data. Once the trace
file has been generated, use the TKPROF utility to generate the execution plan as well as
vital time statistics. For more information, refer to the Oracle Database SQL Reference
Manual.
You may also want to consult with the database and network administrators. They may be
able to suggest ways to improve performance for their respective areas. An obvious
approach is to consider upgrading to a later, more efficient product release, or to increase
the capacities and speeds of the hardware systems and network connections.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Non SQL Data Sources

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Non SQL U l ic
MData Sources
I T K
As you have learned, it is possible to publish data from any data source in Oracle Reports.
VN
NA Both the XML and Text pluggable data sources can be accessed through a remote URL. If
speed is a concern, download the data locally and use the local data stream rather than the
remote URL. You can also specify the domains for which you can bypass a proxy server.
The XML pluggable data source supports validation of the XML data at runtime. You can
activate this option by checking the “Validate Data Source” checkbox in the XML query
definition window. When you do, the XML data is validated against the data definition
you specified in the DTD or XML schema. This is a rather costly operation. If you are
sure that your XML data is valid, do not activate validation. You will see a noticeable
performance difference, especially if your XML data stream is very large.
You have the option to specify either an XML schema or a DTD for the data definition.
Using an XML schema forces type checking. With a DTD, the data is merely treated as a
string and no type checking is necessary.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Non SQL Data Sources (continued)


You can also specify an Extensible Stylesheet Language file (XSL) for the XML data
stream. Unless you absolutely need to apply the XSL at runtime, it is better to have the
data in the correct format to start with.
The pluggable Text data source supports the use of cell wrappers. This causes the file
format level delimiter to be ignored for every field for which a wrapper is defined. Unless
you really need this feature, avoid using cell wrappers for performance reasons.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Investigating the Data Model

• Schema design • Redundant queries


• Indexes • Break groups
• Efficient SQL • Group filters
• Efficient PL/SQL • Linking queries
• Calculations
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
M theliData
Investigating
U c Model
I T K
If the report spends a large amount of time in the database, then it is often wise to review
VN
NA the data structure and how it is being used. The following areas should be examined:
• Schema design: The specific nature of your application will determine the most
efficient Data Model, but bad schema design can have a dramatic effect. Generally
speaking, query-driven applications can benefit from denormalized tables, whereas
normalized tables are usually best for applications that do many updates and inserts.
Oracle Reports is a typical nonprocedural tool geared for set-based data retrieval.
Hence, an overly normalized Data Model can result in many avoidable joins or
queries.
• Use of indexes: A lack of appropriate indexes can result in many full table scans and
Cartesian joins. Indexes should be placed on columns used in the query WHERE
clause, and on the tables in the detail queries. Indexes on columns in the master
queries of a report have limited impact as these queries only access the database once.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Investigating the Data Model (continued)


• Efficient use of SQL: Inefficient SQL can severely impact performance. As
mentioned earlier, an invaluable aid to tuning SQL in a report is the SQL Trace
facility provided by the database. For reports that have large queries, it is advisable to
either activate the cost based optimizer (by running ANALYZE on the tables or by
setting the appropriate parameter in the init.ora file), or optimize all SQL
statements following the rules laid out for the rule based optimizer.
• Efficient use of PL/SQL: PL/SQL that performs database operations will give better
performance if it is used in stored database procedures. Stored procedures perform
database operations faster than local PL/SQL program units. The opposite is true if
PL/SQL does not involve any database operations. In this case, PL/SQL should be
coded locally using the Program Units node in the Report Object Navigator. You may
also want to consider using PL/ SQL libraries, but the performance overhead is
outweighed only when the benefits of code sharing can be used. r a ble
se
f
r a n
on -t
a n
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Investigating the Data Model

• Schema design • Redundant queries


• Indexes • Break groups
• Efficient SQL • Group filters
• Efficient PL/SQL • Linking queries
• Calculations
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Investigating
U c Model (continued)
M theliData
I T K
• Performing calculations: For calculations within a report (either through summary or
VN formula columns), the rule of thumb is that the more calculations that can be
NA performed within SQL, the better. If calculations are included in SQL, they are
performed before the data is retrieved rather than performed on the retrieved data by
Oracle Reports.
PL/SQL code that performs a significant amount of database operations will perform
better if it is implemented as a stored database procedure. SRW.DO_SQL() should be
used as sparingly as possible because each call to SRW.DO_SQL() necessitates
parsing and binding of the command and the opening a new cursor (just as with a
normal query). Unlike the query, however, this operation will occur each time the
object owning the SRW.DO_SQL() fires. For example, if a block of PL/SQL in a
formula column calls SRW.DO_SQL() and the data model group where the formula
resides returns 100 records, then the parse/bind/create cursor operation will occur 100
times. It is therefore advisable to only use SRW.DO_SQL() for operations that cannot
be performed within normal SQL (for example to create temporary tables or any other
form of DDL).

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Investigating the Data Model (continued)


• Redundant queries: Ideally, a report should have no queries that return data that is
not required in the report. In general, the fewer queries you have, the faster your report
will run. Single query Data Models tend to execute more quickly than multiquery Data
Models. However, situations can arise where a report not only needs to produce a
different format for different users, but also needs to utilize different query statements
depending on user input. Clearly, this could be achieved by producing two different
reports.
• Break groups: If the report requires the use of break groups, care should be taken to
ensure that the break order property is set for as few columns in the break group as
possible as Oracle Reports appends an extra column to the ORDER BY clause of the
query for every break column. The creation of a break group may also make the
ORDER BY clause redundant and in this case should be removed. To give better
performance, break order columns should be as small as possible and should be era
ble
database columns wherever this is feasible. a n sf
n
• Group filters: It is usually more efficient to incorporate a group filterointo -trthe query
WHERE clause. This restricts the number of rows returned fromathendatabase and
avoids local filtering by Oracle Reports itself. h a s
• Linking queries: There are a number of ways to create m )Data Models
e ฺ that include
c o i d
more than one table. You can create a single a ilฺ withGaujoin condition or you can
query
create two separate queries and create a g m e
link between n t the two. In general, it is
preferable to minimize the actuali t 3 1@ S
number ud as each time a query is issued,
oftqueries
a
Oracle Reports needs to parse,v nbind,thand
is execute a cursor. A single query report is
therefore able to return
n the required
arall se data in a single cursor rather than many. Also,
m u
tothe detail query will be reparsed, rebound, and reexecuted
( ku queries,
with master detail e
R record
for eachAmaster c e ns retrieved. In this case, it is often more efficient to use a single
UMreport with
query
K li break groups.
N IT
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Investigating the Paper Layout

• Frames
• Object size
• Format triggers
• Fetching ahead
• Bursting and distribution
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Investigating
U c
M theliPaper Layout
K
T the data has been retrieved, Oracle Reports needs to format the output following the
IOnce
V N
NA Paper Layout the user has created. The time it takes to generate the layout depends on a
number of factors, such as:
• Frames: When generating a default layout, Oracle Reports puts a frame around
virtually every object to protect the object from being overwritten by another object.
In some situations, such as boilerplate text column headings, there is clearly no risk of
the objects being overwritten, hence the immediately surrounding frame can be
removed.
• Object size: An object that is defined as variable, expanding, or contracting in either
or both the horizontal and vertical directions requires extra processing. In this case,
Oracle Reports must determine the size for the object’s instance before actually
formatting the object and any objects around it. If the sizing can be set to fixed, this
can be avoided as the positional relationship between objects is already known.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Investigating the Paper Layout (continued)


• Format triggers: Care should be taken when using format triggers as the trigger fires
every time the object is formatted at runtime. Format triggers should also be placed at
the highest level possible in the object/frame hierarchy so that the triggers fires at the
lowest possible frequency.
• Fetching ahead: Oracle Reports provides the ability to display data such as the total
number of pages or grand totals in the report margin or header pages. This requires
that the entire report is “fetched ahead” before the first page can be output. The usual
execution model is to format pages on an as-needed basis. Using the “read ahead”
functionality does not affect the overall time it takes to generate the report, but rather
affects the amount of temporary storage required and the time it takes before the first
page can be viewed. To enhance perceived performance, reading ahead should be
avoided when a report is going to be run to the screen in a production environment.
• Bursting and distribution: With the introduction of report bursting, a report layout r a ble
can be made up of three distinct sections: header, body, and trailer. A reportacan n sfe
comprise all three sections or it can be viewed as three separate reports n - tr one
within
report. Oracle Reports allows you to control bursting at the group a no level,
record
h
offering a further level of granularity in report bursting. The a s
use of report bursting in
m ) egains.
conjunction with distribution offers considerable performance ฺ Each section of a
c o
lฺ be sent i d
uto multiple destinations in
report can have multiple different formats and
m aican t G
one single run rather than running the same n
g reportemultiple times.
i t 3 1@ Stud
Web Layout and JSP ReportvDefinition
a n this
You learned that Oracle a rn utakes
Reports se full advantage of JSP technology to deliver high
m
ku sRecall
quality Web publishing. tothat you can use your favorite Web authoring tool to
(
R portion e
design the static
M A l i c en of your Web page and then use Oracle Reports to add the
U portion (data) into the appropriate sections of the page. A poorly designed Web
dynamic
K
T
NIpage has an impact on the perceived performance.
V
NA Because it is possible to include any Java code in the JSP, it is easy to get carried away
and mix business and data access Java code with the presentation logic. This should be
avoided as it increases the footprint of the JSP and limits the efficient use and
management of system resources.
Customized formatting of a Web page is always an expensive operation. Any type of
formatting that you cannot natively achieve through Oracle Reports (e.g., changing the
foreground color of a report block) should be done using Java in the most direct way. The
use of PL/SQL wrappers for formatting purposes in discouraged.
A .jsp report definition can contain both a paper layout and a Web layout. Since the Web
layout section of a JSP report could contain an <rw:include> tag referencing a paper
layout object, Oracle Reports always formats the paper layout when executing the report.
If your JSP report does not reference any paper layout objects, it is recommended that you
use the SUPPRESSLAYOUT command option to prevent executing the paper layout.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running the Report

• RUNDEBUG=NO
• Array processing
• LONGCHUNK
• PARAMFORM
• Batch processing
a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Running U M l
the Reportic
I T K
Having designed a report to run efficiently, it is possible to further affect the overall
VN
NA performance of a report by setting specific run-time arguments.
By default, Oracle Reports automatically runs error checks on the layout and bind
variables within a report. This is useful at the design stage but is generally superfluous in
a production environment. Setting the runtime parameter RUNDEBUG= No turns off this
extra checking at run-time.
Oracle Reports is able to take advantage of array processing capabilities. This allows
records to be fetched in batches instead of one at a time and results in fewer calls to the
database. The downside of array processing is that more space is required on the
execution platform for storing the arrays of records returned. If the load on the network
becomes a major bottleneck in the production environment, the ARRAYSIZE argument
(defined in kilobytes) can be set to as large a value as possible for the execution
environment to reduce the number of network trips made to fetch the data for the report.
The default value for ARRAYSIZE is 10 kilobytes.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Running the Report (continued)


If the report has columns of the LONG, CLOB, or BLOB datatype, the LONGCHUNK
parameter can be set to a large value to reduce the number of increments it takes Oracle
Reports to retrieve the long values.
If a parameter form or online previewing is not required, these functions can be bypassed
by setting the PARAMFORM and BATCH system parameters to No and Yes,
respectively.
Calling Reports from Forms
In an application built using Forms Builder and Reports Builder, it is often the case that
some type of report is required on data that has already been retrieved and/or updated by
the Oracle Forms section of the application. The tight integration between Oracle Forms
and Oracle Reports allows you to pass blocks of data between the associated products.
Passing data is achieved using record groups and data parameters in conjunction with the r a ble
RUN_REPORT_OBJECT built-in for calling reports from forms. Sourcing a Reports n s fe
- t r a
query from a Forms record group avoids requerying the database and hence
n on Oracle
Reports will only spend time formatting the data.
s a
h
) eฺa
Technical Note m
o uidTuning Oracle Reports
ilฺcwhitepaper
For more information on tuning your reports, seeathe
G
m ent
on the Oracle Technology Network (http://otn.oracle.com).
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
U M l ic
I T K
VN
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Different Development and Run-Time


Environments

• Reports Builder development


– Bitmapped only
• Reports Builder Runtime
– Bitmapped
MODE = bitmap le
r a b
– Character mode
s f e
MODE = character - t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Different
U M l ic and Run-Time Environments
Development
I T K
Although you always develop your reports in a bitmapped environment, the production
VN
NA reports can run in either bitmapped or character mode.
Therefore, you can develop a report in a bitmapped environment that is to run in a
character mode environment.
Bitmapped Environment
This environment has a unit of pixel and typically supports a mouse. Interaction with the
host computer is continuous.
The bitmapped Designer allows you, as a developer, to take advantage of the graphical
user interface.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Different Development and Run-Time Environments (continued)


Character Mode Environment
This environment has a unit of character, typically 80*24, and rarely supports a mouse.
Interaction with the host computer is at field level; that is, when the user navigates from
the field.
A report that runs in character mode cannot display any graphics features, such as images,
drawings, or multimedia objects.
Running a Character Mode Report from the Builder
You can test your character mode reports very easily in the bitmapped Reports Builder
and view the report output in the Previewer (File > Print Preview).
The execution of the report as bitmapped or character simply depends on a system
parameter called MODE. You can change this parameter in Reports Builder to test the able
r
character output during your report development. sfe
an
- t r
n on
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Developing Reports to Run in Different


GUIs

• Use common fonts or map fonts in


uifont.ali
• Use common colors
• Be aware of dots per inch (DPI)

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Developing
U M Reportsl ic to Run in Different GUIs
I T K
There are a few points that you should consider when moving a report from one GUI to
VN
NA another, because the following GUI differences may affect the report output.
If possible, use fonts that you know exist on the target GUI; otherwise, remember to set up
your font alias file so that the fonts that you use during development map to existing
similar fonts on the target GUI.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Developing Reports to Run in Different GUIs (continued)


Example
In the uifont.ali file on Microsoft Windows, map Motif and Mac fonts to Microsoft
Windows:
/* Motif fonts */
lucidatypewriter = "Courier New"
lucidabright = "Times New Roman"
fixed = "Courier New"

/* Mac fonts */
"Avant Garde“ = "Arial"
"New York“ = "Times New Roman"
ble
In the uifont.ali file on UNIX (motif), map Microsoft Windows fonts to Motif: fera
a n s
/* Microsoft Windows fonts */
n -t r
o
"Courier New" = lucidatypewriter
s an
"Times New Roman“ = lucidabright
) ha
Using Common Colors
c o m ideฺ
lฺ GUI;
aitarget
If possible, use a color that you know exists onmthe G u otherwise, use one that
g den t
@
maps well to the default color of the target GUI.
Beware of Dots Per Inch n i t31 is Stu
r n av e th
a differ
The dots per inch (DPI) may
m u samong machines, even if they use the same GUI. This
o
ku se t characters wordwrap on the screen. Therefore, if you
only affects how (alphanumeric
R
design a report n
A thatlicisedisplayed in the Previewer, try to use the same DPI as the users who
willK U M
eventually run the report.
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Setting NLS Language Environment


Variables

• NLS_LANG
• DEVELOPER_NLS_LANG, USER_NLS_LANG

NLS_LANG=French_France.WE8DEC

a ble
f e r
Unicode:
ans
n - t r
NLS_LANG=<lang>_<territory>.UTF8 a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
BuildingU Reportslic
M to Run in Different Languages
K
T section gives a brief overview of the features available on the server and in Oracle
IThis
V N
NA Reports Developer that provide support for building multilingual applications.
• Switching languages using Oracle’s National Language Support (NLS)
• Translating an application using Oracle’s TranslationHub
Setting NLS Language Environment Variables
Three language environment variables are available:
• NLS_LANG
• DEVELOPER_NLS_LANG
• USER_NLS_LANG
DEVELOPER_NLS_LANG and USER_NLS_LANG take the same parameter as
NLS_LANG. Use them as an alternative to NLS_LANG when you need to use two sets of
resource and message files at the same time; for example, if you prefer to develop using
English but need to build an application in another language.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Building Reports to Run in Different Languages (continued)


Syntax
NLS_LANG = <language>_<territory>.character_set
• Language: Language conventions for displaying messages and day and month names
• Territory: Conventions for default date format, and for displaying currency, decimal,
and thousands symbols
• Character_set: Character set in which data is displayed
Example
NLS_LANG=French_France.WE8DEC
Using Unicode in Oracle Reports Developer
Unicode is a global character set that allows multilingual text to be displayed in a single ble
application. Unicode is a fixed-length two-byte character set that represents up to 65,536
s f era
characters.
- tran
onin one
Using Unicode in Oracle Reports enables you to display multiple languages
n
application without switching character sets. s a
a
) hvariable
To enable Unicode support, set the NLS_LANG environment
o m d e ฺ as follows:
c i
NLS_LANG = <language>_<territory>.UTF8
m ent ailฺ Gu
The data must also be stored in Unicode.@g
i t 3 1 Stud
a v n this
m arn use
( ku se to
A R en
U M l ic
I T K
A VN
N

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Translating an Oracle Reports Application

Use TranslationHub to translate messages and text


defined as part of the application.
Consider:
• Format masks
• Hard-coded strings ble
f e r a
• Multiple character sets s
- t r an
n no
s a
h
) eฺ a
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Translating
U M an Oracle
l ic Reports Application
I T K
In any Oracle Reports application, you see many types of messages, including:
VN
NA • Error messages from the database
• Runtime error messages produced by OracleAS Reports Services
• Messages and boilerplate text defined as part of the application
If the NLS environment variable is set correctly and the appropriate message files are
available, then translation of messages for the first two bullets is done for you. To
translate messages and boilerplate text defined as part of the application, you can use the
Oracle translation tool, TranslationHub.
For more information about using TranslationHub, see the Oracle Technology Network
(http://otn.oracle.com).

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Translating an Oracle Reports Application (continued)
Considerations When Designing Multilingual Applications
• Format masks: Make sure to provide extra space for translation of date and numeric
format masks.
• Text strings: Avoid hard-coding a string containing language-specific words such as a
month name.
• Character sets: If using an application that will run with multiple character sets,
determine the one that is most frequently used and generate the application files with
the relevant NLS language settings.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Summary

In this lesson, you should have learned how to:


• Use performance measuring tools
• Describe the facilities for running reports in other
languages

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arnCopyright
u s©e2004, Oracle. All rights reserved.
( ku se to
A R en
Summary U M l ic
I T K
• Analyze the performance of your reports using the Trace option in Oracle Reports, as
VN well as the SQL trace facility in the database. Tune reports by optimizing SQL,
NA minimizing calls to the database, and minimizing the amount of unnecessary format
processing required for the layout of returned data.
• Using Oracle’s translation tool, TranslationHub, the NLS parameters, and various
features in Oracle Reports, you can build multilingual report applications.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice 22 Overview

• Identifying areas to investigate for tuning reports


• Using the trace facility
• Interpreting time statistics
• Improving performance
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m t o us© 2004, Oracle. All rights reserved.
a Copyright
R (k se
M A licen
PracticeU Session Overview: Lesson 22
K
T practice session contains:
IThis
V N
NA • Generating and interpreting report trace information
• Modifying a report to make it more efficient
Report performance is always an issue. Reports Builder offers a few tools that allow you
to measure performance. In this practice you will use them and interpret the results.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session: Lesson 22


1. Name four main areas to investigate when tuning reports.
2. What is the name of the font mapping file?
3. Generate and interpret Reports Runtime Trace information.
a. Open report p19q4.rdf. From the menu select Program > Tracing.
b. In the Runtime Trace Settings dialog box specify p19q4.txt as the trace file and
select the All check box under Trace Settings.
c. Select OK to close the dialog box.
d. Run the paper layout. Paginate through the report in the Paper Design view.
e. Open p19q4.txt and look at the results. Where does this report spend time?
f. Repeat the same steps for report p22q2b.rdf. Specify p22q2.txt as the
trace file. Compare the result. How do you explain this?
4. Make a suggestion to improve performance.
r a ble
a. Open the report p12q1.rdf and generate Reports Trace information. Look
n s feat
the time statistics. - t r a
b. Examine the Data Model. What could you possibly do to make n othen report run
faster? s a
a
) h ฺDid things improve?
c. Implement your change and regenerate the time statistics.
l ฺ c om uide
m ai t G
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© 22-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

A
Practice Solutions
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Practice Session Overview: Lesson 2


This practice session contains:
• Previewing a report in a browser
• Executing a number of different reports. For each report, answer some questions
Introduction
This practice session consists of a combination of practical and paper-based questions.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-2 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 2


1. Invoke the Reports Builder executable.
Select Reports Builder from the Oracle Reports menu: Start > Programs >
Oracle Developer Suite > Reports Developer > Reports Builder.
This may differ according to the classroom setup.
Click Cancel in the Welcome to Reports Builder dialog box
2. Open the report called p2q2.jsp. Run the Web layout.
From the menu select File > Open. Locate p2q2.jsp in your working
directory and click Open.
Select Program > Run Web Layout from the menu or select the Run Web
Layout icon on the horizontal toolbar.
Specify the database details in the Connect dialog box.
a. Examine the report in your browser. Among the styles discussed in this
lesson as a reference, what style of report is it? r a ble
Tabular report. n s fe
- t r a
b. How many groups of data are there in this report?
n on
One group of data, each row being displayed once within
s a the group.
c. In the browser, use the scroll bars to move up andhdown
) a the report to see all
of the data.
c o m ideฺ
Use the scroll bar on the right side a ฺ browser
ofilthe G u window to scroll up
and down the report data. @g
m e n t
d
u back in Reports Builder.
d. Close the browser window.
n i t31Yous S
are tnow
In the browser, click
r n thi icon in the upper right corner or select
av theeClose
File > Closem afrom theusmenu.
3. Open report( u
kp2q3.rdf e to run the paper layout.
and
From A R menu
the e s File > Open. Locate p2q3.rdf in your working
nselect
U M li c
K directory and click Open.
IT Select Program > Run Paper Layout from the menu or select the Run Paper
V N
NA Layout icon in the horizontal toolbar.
a. In the Paper Design view, move to the next page. Notice that this report has a
header page with text.
Select Next Page to navigate from one page to another.
b. What style of report is this?
Tabular report.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-3 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 2 (continued)


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.
Select File > Print Preview. To split the Previewer horizontally: Select
the small gray area at the top of the right scroll bar. Press the left mouse
button down and drag the gray area. As you do this, you see that a thick
dotted line is dragged down the Previewer. Depress the left mouse button
when you have reached the desired split point. Now you have two
windows, which work independently from each other.
Move the split bar back to its original position.
To split the Previewer vertically: Select the small gray area at the left of
the horizontal scroll bar at the bottom of the window. Press the left
mouse button down and drag the gray area. As you do this, you see that r a ble
e
sfleft
a thick dotted line is dragged right across the Previewer. Depressathen
tr you
mouse button when you have reached the desired split point. o n -
Now
have two windows, which work independently from each a nother.
d. Close the Previewer window. h a s
In the Previewer, click the Close Previewer m ) eฺ
button.
o
4. Open report p2q4.jsp and run the Webalayout. ilฺc Guid
Select File > Open, locate p2q4.jsp, g mand click
e n tOpen.
3
Select Program > Run WebitLayout 1@ from d menu or select the Run Web
tuthe
n toolbar.is S
a v
Layout icon on the horizontal t h
rn isusthis?
a. What stylemofareport e
It is a(k u Left
Group e tomaster/detail report.
b. A R many
How e s of data are in this report?
ngroups
c
UM Thereliare two groups of data.
K
IT c. How many pages are there in this report?
V N
NA There are no pages in a Web report. In Reports Builder, run the paper
layout to determine the number of pages. There are three pages in this
report.
d. Close the browser.
In the browser, click Close.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-4 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 2 (continued)


5. Open report p2q5.jsp and run the Web layout.
From the menu select File > Open. Locate p2q5.jsp and select Open.
Select Program > Run Web Layout from the menu or select the Run Web
Layout icon from the horizontal toolbar.
a. What style of report is this?
It is a Matrix report.
b. How many groups of data are in this report?
There are four groups of data:
Year
Department Name
Job ID
Salary
There actually is an additional, invisible “cross product” group around r a ble
Year, Department Name, and Job ID; this special group defines a n
the sfe
matrix structure and is explained in the lesson on matrix reports. n - tr
c. Close the browser window. a no
In the browser, click Close. h a s
6. Open report p2q6.rdf and run the paper layout. m ) eฺ
o
ฺc Guidand click Open.
From the menu select File > Open. Locate a ilp2q6.rdf
Select Program > Run Paper Layout g m
from e
then t or select the Run Paper
menu
Layout icon in the horizontal i t 3 1@ Stud
toolbar.
a. Notice the Parametera v nForm.tYou
h is are requested to enter a customer ID. The
report willm arn order
display u seinformation based on your input.
(
b. Specify kua valid
e to ID and run the report. Valid values include 101,
customer
A R 148 eand
118, c ns170; pick one of these and then select Run Report.
K UM Clicklin i the customer ID field and enter one of the suggested numbers.
N IT Select Run Report.
A V c. What do you think would be a better method of providing valid values to a
N
user?
It would be more user-friendly to display a list of values. And it would be
even more meaningful to add customer names. This can easily be built
into the report. You will see how this is done in a later lesson.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-5 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 2 (continued)


d. Close the Paper Design view.
In the Paper Design view, click Close.
e. Run the paper layout again. This time do not specify a customer ID.
From the menu select Program > Run Paper Layout. Immediately select
Run Report without entering a value for customer ID.
i. What is the result?
The result is that the report does run; however, it does not display any
data. There are no NULL customer IDs.
ii. In a production situation, what should happen in this instance?
The user should be prevented from entering a NULL value or a blank.
In later lessons you will see how this can be implemented.
f. Close the Paper Design view.
In the Paper Design view, click Close. r a ble
g. Run the paper layout again. This time enter Customer ID 999. n s fe
- t r a
From the menu select Program > Run Paper Layout. Enter
n on the customer
ID 999 and select Run Report.
s a
i. What is the result? a
) h eit ฺdoes not display any
m
The result is that the report does run;ohowever,
data. There is no customer ID 999. a ilฺc Guid
g
ii. In a production situation, what
m
should e n t in this instance?
happen
t 3 1@ Sfrom
The user should be iprevented tudentering an invalid value. In later
a
lessons you will v n this
see howth is can be implemented.
h. Close the m arnDesign
Paper u e
sview.
In the( u Design
kPaper e to view, click Close.
R p2q7.rdf
7. OpenAreport c e ns and run the paper layout.
U M li select File > Open. Locate p2q7.rdf and select Open.
From the menu,
K
IT Run the paper layout.
V N
NA a. In the Parameter Form, notice the list of values for the customer information.
The report displays order information based on your input.
b. Select a valid customer name and run the report.
Select a customer name from the list of values for customer and click
Run Report.
c. Close the Paper Design view.
In the Paper Design view, click Close.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-6 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 3


This practice session contains:
• Invoking Reports Builder
• Opening an existing report
• Switching views in the Report Editor
• Accessing the Help system
Introduction
The questions in the practice session provide an introduction to the Reports Builder
interface. You open and navigate through an existing report definition and use the Help
system to obtain information about some of the Report executables.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-7 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 3


1. Start Reports Builder and open the existing report: p3q1.jsp. Run the paper
layout.
On your desktop, locate the Reports Builder icon and launch the executable.
In the Welcome dialog box of Reports Builder select the Open an existing
Report option and click OK.
Open p3q1.jsp from the file system and run the paper layout. Use the iconic
button on the horizontal toolbar, or use the Run Paper Layout option in the
Program menu.
If prompted, connect to the database using the login information your
instructor gives to you.
When the Runtime Parameter Form comes up, select one of the customers in
the list, and select Run Report.
2. Using the same report, display the Data Model view of the Report Editor. r a ble
In the Object Navigator, select Q_1. n s fe
- t r a
Hint: Move the Data Model window to the right so that you can also
n on see the
s a
Object Navigator. Use the Find field at the top of the Object Navigator to locate
Q_1.
) ha
Notice the object that is selected in the Data Model o m view.d e ฺ
c i
lฺ theGprevious
u
If the Report Editor window is still active
m aifrom t exercise, select
View > Change View > Data Model @ gfrom the
d n
emenu.
If you closed the Report Editor 1
it3 after S t u
the previous exercise:
Select Tools > Report a v n i s
th the menu and then select View > Change
Editor from
View > Data Model r n e
s menu. Or, double-click the Data Model object
a from uthe
u m t
k sNavigator. o
icon in the(Object e
Move A R
the Data e n
Model window to the right of your screen so that you can also
U M l i c
I T K see the Object Navigator.
A VN Activate the Object Navigator window.
Click in the Find field and enter Q_1. The Navigator expands the appropriate
N
node and highlights the first object that meets the entered value.
In the Data Model view, the query object Q_1 is selected.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-8 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 3 (continued)


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.
While the Report Editor window is active, select View > Change View > Paper
Layout from the menu.
Activate the Object Navigator window.
Click in the Find field and enter F_. The Navigator expands the appropriate
node and highlights the first object that meets the entered value.
In the Paper Layout view the field F_CUSTOMER_ID is selected.
In the Object Navigator window, select the Paper Layout node and select fera
ble
Expand All in the vertical toolbar; or select View > Expand All from the a n s
menu. Select R_G_ORD_ID. n -t r
o
In the Paper Layout view, the repeating frame R_G_ORD_ID
s a nis selected.
4. Using the same report, run the Web layout.
) ha
Select Program > Run Web Layout from the menu, o e ฺ the Run Web
m oridselect
c
ilฺ Gu
Layout iconic button from the horizontalatoolbar.
g
5. Use Help Contents to answer the following
m e n t
questions:
From the menu, select Helpit>3Help S tud Use the Index tab to locate each
1@ Contents.
term. a v n this
arn use
a. What is RWSERVLET?
m
u e to RWSERVLET is the executable for the Reports
Enter(kRWSERVLET.
A R ens
Servlet.
U M What lisicRWCLIENT?
b.
I T K
Enter RWCLIENT. RWCLIENT is the executable for the Reports Client.
A VN It parses and transfers the command line to the Reports Server.
N
c. What is the Web Source view?
Enter Web Source. The Web Source is a view of the Report Editor that
displays the source code for your Web report, including JSP and HTML
tags.

Unauthorized reproductionOracle Reports prohibited.


or distribution Developer 10g: Build Reports
Copyright© A-9 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4


This practice session contains:
• Creating and saving a Tabular report
• Modifying the report to create and save a Group Above break report
• Creating and saving a form letter
• Creating and saving a Matrix report
• Creating and saving a Matrix with Group report
Introduction
The questions in the practice session are intended to ensure that you have a good
understanding of how to create various styles of reports using the Report Wizard.
Note: When you are completing the practice sessions, keep to the file naming
conventions that the questions specify. You might need these files in later practices.
r a ble
In addition, note the field headings and widths. With many reports, you need to change
n s fe
these to achieve the desired result.
n- tra
no to use Save
Many of the practice sessions ask you to rename files beforehand; be sure
a
as
As, not Save, so that you do not overwrite the existing file name.
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-10 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4 (continued)


Invoking Reports Builder and the Wizard
If Reports Builder is open after the previous practice session:
• Close any reports currently in the Object Navigator.
• Create a new report by selecting the Reports node and selecting the Create icon.
Note: There is an alternative method. If no reports are open in the Object Navigator, you
can double-click the Reports node.
1. Create a tabular report, paper layout only, containing the following data. Use
Query Builder to build the query.
DEPARTMENTS: DEPARTMENT_NAME
EMPLOYEES: FIRST_NAME, LAST_NAME, JOB_ID, SALARY
Display all fields. Do not make any changes to the other Wizard pages.
In the New Report dialog box, select the option "Use the Report Wizard" andrab
le
click OK. n s fe
In the Welcome to the Report Wizard! page, click Next. - t r a
n
noclick
In the report layout page, select Create Paper Layout onlyaand Next.
In the report style page, Tabular is selected by default. s
haClick Next.
In the data source type page, SQL Query is selected ) ฺ Click Next.
m byiddefault.
e
c o
In the data source definition page, click a ilฺ Builder.
Query
G u
m
In the Select Data Tables dialog box,ghighlight e t
nthe DEPARTMENTS and
EMPLOYEES tables, click Include, @
31 s and d
tuclose the dialog box.
n i t S
In the Query Builder window,
r n a v
e t hi the columns from the tables and click
select
OK.
u m a
t o us
Click Next.(k se
Rfields
CopyAall
c n the Available Fields area to the Displayed Fields area.
efrom
M l i
IT KUClick Next on all other Wizard pages and click Finish on the last page.

V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-11 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4 (continued)


2. Using the reentrant Report Wizard, make the following modifications (test your
report frequently).
Select Tools > Report Wizard from the menu or the right-mouse-button
menu.
a. Modify the query to sort the data in descending order of salary.
On the Data tab choose Query Builder.
In the Query Builder window select Sort. Copy the SALARY column to
the Sorted Columns, select it, and select Sorting Order as Descending.
Close the Sort dialog box and the Query Builder.
Click Finish to test your report.
b. Add a summary to show the total salary value.
Reenter the Report Wizard by choosing Report Wizard from the menu.
On the Totals tab select SALARY and click Sum. r a ble
c. Ensure the width of SALARY and TOTAL is 6. n s fe
- t r a
Make the necessary changes on the Labels tab.
n on
d. Select the Green template. a
sclick
Select the Green template on the Template tab h
) a
and Finish to test
your report. om uide ฺ
l ฺ c
e. Save the report to a file named p4q2.rdf.
m ai t G
Select File > Save As from the @ gmenu dand e nsave the file to disk.
t31 ithe
3. Using the reentrant Wizard, modify
i tu to create a break report.
Sreport
n
av Group
a. Select the report style s
thAbove.
r n e
Select them
u
a style
report
t o uson the Style tab.
b. Modify
R (k the query
s e and remove the join clause so that the report contains all
n
U MAemployees
l i ce and not just managers.
I T K Select the Data tab. Edit the query, removing the join clause

A VN DEPARTMENTS.MANAGER_ID=EMPLOYEES.EMPLOYEE_ID.
Watch for syntax errors!
N
c. Group the report by the department name.
On the Groups tab copy DEPARTMENT_NAME to the Group Fields
area.
Click Finish.
d. Save the report as p4q3.rdf.
Select File > Save As from the menu and save the file to disk.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-12 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4 (continued)


4. Create a new report as follows:
a. Using the Report Wizard, create a paper layout and select the Mailing Label
style.
Create a new report by selecting the Reports node in the Object
Navigator and choosing the Create icon.
As an alternative you can also select File > New > Report from the menu.
Select Create Paper Layout only. Select Mailing Label style.
b. Enter the query in the data source definition window:
For the query type, accept the default selection of SQL query.
Enter the query text:
select c.cust_first_name || ' ' ||
c.cust_last_name Name, c.cust_address
r a ble
from customers c
c. In the text area, include each of the following fields on a new line: NAME, n s fe
- t r a
STREET_ADDRESS, CITY, and STATE_PROVINCE. Include on
COUNTRY_ID, and POSTAL_CODE on the same line.a n
Copy NAME, STREET_ADDRESS, CITY, STATE_PROVINCE, h a s
COUNTRY_ID, and POSTAL_CODE toothe m )Mailing
e ฺ Label Text area.
c
ฺ theGNew i d
To enter the line feeds you can either
m ailuse t
u Line button or simply
press the [Return] key. @ g den
31 Finish.
d. Select No template anditclick S tu
n
av radio
Select the No template s
thibutton on the Template page and click
r n e
Finish. ma
u t o us
k report
e. Save (the
s eto a file named p4q4.rdf.
R n
UMASelect File
ce > Save As from the menu and save the file to disk.
li
I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-13 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4 (continued)


5. Using the reentrant Wizard, modify the report to create a Form Letter style.
Select Tools > Report Wizard from the menu or the right-mouse-button
menu.
On the Style tab select Form Letter.
a. Modify the query to include order information for each customer:
On the Data tab, modify the query text as follows:
select c.cust_first_name || c.cust_last_name Name,
c.cust_address, o.order_id, o.order_total
from customers c, orders o
where c.customer_id = o.customer_id
b. In the text area, enter some free-flowing text for each order. For example:
Order No. &<ORDER_ID> has been shipped to &<NAME> in
&<C_CITY>. r a ble
The order has a total value of &<ORDER_TOTAL> dollars. n s fe
- t r a
Thank you for your business.
n on
Copy the fields that you want to use to the Form Letter
s a Text area and
enter your free-flowing text.
) ha
c. Select a different template and click Finish.om d e ฺ
c
ฺ G i
On the Template page in the Wizard,
m ailselect
t anyu one of the predefined
templates. Click Finish. @g d e n
n i t31 is Stu
d. Save the report as p4q5.rdf.
v fromththe menu and save the file to disk.
Select File > SaveaAs
n
a
6. Create a new report. r u se
m
kureport toselecting the Reports node in the Object Navigator
(
Create a new e by
and A R eCreate
choosing c ns icon.
U M li
K As an alternative you can also select File > New > Report from the menu.
IT a. Create both a Web and paper layout. Select the matrix report style.
V N
NA On the first page, select Create both Web and Paper Layout. On the
Style page choose Matrix.
b. For the query, import the contents of p4q6.sql.
Choose Import Query and select p4q6.sql from the Import dialog
box.
c. Display customer names down the left side of the page.
Copy NAME to the Matrix Row Fields area.
d. Display product numbers across the top of the page.
Copy PRODUCT_ID to the Matrix Column Fields area.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-14 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4 (continued)


e. Display the sum of the total values in the cells.
Select Sum to copy the sum of TOTAL_VALUE to the Matrix Cell Fields
area.
f. Create a summary to give the total of the sum(total_value) values.
Select SumTOTAL_VALUE and choose Sum.
g. Change the width of all four summaries to 4. Change the PRODUCT_ID
label to Product. Remove the label for SumTOTAL_VALUE.
Make the necessary changes in the Labels and Width fields.
h. Select any template and click Finish to preview your report.
Select a template and click Finish to run your report.
i. Save the report to a file named p4q6.jsp.
Select File > Save As from the menu and save the file to disk.
7. Modify the matrix report to create a Matrix with Group. r a ble
Select Tools > Report Wizard from the menu or the right-mouse-button n s fe
- t r a
menu.
n on
On the Style tab select Matrix with Group.
a. Select Month as the group and check that all totalshhave a s aa width of 4.
Go to the Groups tab and copy MONTHotomthe Matrix
) eฺ Group Fields
area. a ilฺc Guid
Check on the Labels tab that g
all
m
fields e n
with
t a label Total: have a width of
4. i t 3 1@ Stud
a v
b. Click Finish to previewn yourthreport
is and save the report as p4q7.jsp.
rn Asufrom
Select Filem>aSave se the menu and save the file to disk.
Note:(k u query
The e o the matrix reports above has been restricted to display
tfor
A R products
only c e nsbeginning with “1,” so that you can see and understand the
M li matrix more easily.
IT KU complete
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-15 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 4 (continued)


8. Web-enable a paper report.
a. Open report p2q9.rdf and run the paper layout.
To open the file select File > Open from the menu or choose Open from
the Toolbar. Run the report by selecting the Run Paper Layout icon
from the horizontal toolbar.
b. Add a bookmark to the report, letting the department names serve as
bookmarks.
Select Insert > Bookmark from the menu. Copy the Department_Name
field from the Available Columns to the Bookmarks. Click OK.
c. Generate HTML Style Sheet output. Save the file as p4q8.htm.
Select File > Generate to File and select Paginated HTMLCSS. In the
Save file dialog box change the filename to p4q8.htm and select Save.
d. Open the report in a browser. r a ble
Start your browser. Select File > Open and use the Browse button n
tos fe
- t r a
specify the location and name of your file.
n on
e. What happens when you click on the bookmarks?
s a
a
)thehreport
The cursor jumps to that specific part in the report.
f. Close the browser and in Reports Builder, save
o m d e ฺ as p4q8.rdf.
c
ฺ andGchangei
Close the browser. Select File > Save
m ailAs t
u the filename to
p4q8.rdf. Select Save.
@ g den
n i t31 is Stu
g. Save and close all reports.
r n av select
For each open report,
e thFile > Save from the menu or Choose Save
from the m a
horizontal s
utoolbar. Then Select File > Close.
( ku se to
A R en
U M l ic
IT K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-16 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 5


This practice session involves modifying reports by applying changes in the Paper
Design view of the Report Editor.
Introduction
In this practice session, you will reuse some of the reports that you created in the last
session.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-17 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 5


1. Open report p4q2.rdf. Make the following changes in the Paper Design view:
To open the file select File > Open from the menu or select Open on the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting the Run Paper
Layout icon in the toolbar.
a. Make the SALARY column right-justified. Do not forget to justify the
column header accordingly.
Select the column SALARY and its label. Then choose Align Right from
the style bar or select Format > Justify > Right from the menu.
b. Add a comma and a currency symbol to SALARY. Add two decimal places.
While the SALARY column is selected, click Commas from the style bar. le
This adds the group separators. Click Currency from the style bar. Then r a b
sf e
click Add Decimal Place from the style bar to add one decimal place. a n
tr the
Repeat the action for the second decimal place. You can also o n -
select
commas and decimal places options from the Formata> n Number menu.
c. Make the total at the end of the report right-justified h a s
and add commas, a
currency symbol, and two decimal places, as m ) eฺ SALARY.
in the column
o id style bar or select
Select the column, then select AlignaRight ilฺc fromG uthe
Format > Justify > Right from g m menu.
the e n t
3 1@choose d
tuCommas,
While the column is selected
n i t i s S Currency, and then Add
Decimal Place from
n v
a theestyle th bar. Repeat the action for the second
decimal place.a r us
u m t o
R (k the label
d. Change
s e of the total to italic font.
n
U MASelect l i celabel, then select Italic from the style bar or use Format > Font
the

I T K in the menu.

A VN e. Make whatever other changes you like.


No formal solution.
N
f. Save the report to a file named p5q1.rdf and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-18 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 5 (continued)


2. Open report p4q3.rdf. Make the following changes in the Paper Design:
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting Run Paper Layout
from the toolbar.
a. Add a border with a with a hairline width around the total for each
department.
Select the column for department total and choose Line Color from the
vertical toolbar. Select any color to add the border. With the column
selected, format the width of the border: select Format > Line > Line
Width > Hairline.
b. Add commas and two decimal places to the SALARY field and the total and r a ble
make them right-justified. Do not forget to justify the column headerafor n fe
sthe
SALARY field accordingly. n - tr
Select the total, the column, and its header, then select a no Right from
Align
the style bar or select Format > Justify > Righthfrom a s the menu.
While the column is selected choose Commas m )and then
e ฺ Add Decimal
c o i d
Place from the style bar. Repeat the ilฺ for
aaction G uthe second decimal place.
You can also select the options
m
gfrom the e t
nFormat menu.
c. Make the same changesitto
@
31the total d
tuthe end of the report. Move the grand
n i s S at
r n avwithethethSALARY
total so that it aligns field (you must do this manually; use
u m a to help
the ruler guides
t o usyou).
Select(kthe column,
e then choose Align Right from the style bar or select
R n s
U MAFormat l i c>eJustify > and from the menu.
I T K While the column is selected choose Commas and then Add Decimal

A VN Place from the style bar. Repeat the action for the second decimal place.
You can also select the options from the Format menu.
N
d. Change the color of the employee data heading to blue.
Select a label, and choose Select Parent Frame from the style bar. Select
Fill Color from the vertical toolbar.
e. Make whatever other changes you like.
No formal solution.
f. Save the report to a file named p5q2.rdf and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-19 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 5 (continued)


3. Open report p5q3_a.rdf. Make the following changes in the Paper Design:
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting Run
Paper Layout from the Program menu or selecting Run Paper Layout from
the toolbar.
a. Add a date at the top center of the page. Give it any format you want.
Select Insert > Date and Time from the menu. Choose the font, style, and
text color you want.
b. Make whatever other changes you like.
No formal solution.
c. Save the report to a file named p5q3.rdf and close it.
4. Open report p4q6.jsp. Make the following changes in the Paper Design: r a ble
To open the file select File > Open from the menu or select Open fromathe n sfe
toolbar. n - tr
Run the report by selecting it in the Object Navigator and a noselecting
then
Program > Run Paper Layout from the menu or selecting h a s Run Paper Layout
from the toolbar. m ) eฺ
c o uid
a. Right-justify the Product ID field. ailฺ G
Select the Product ID field,@ gm
then select e n t Right from the style bar or
Align
select Format > Justify i t >1
3 S
Right fromtudthe menu.
b. Add commas and a v
two
ndecimalt h s to the cells and summaries and make
iplaces
arn use
them right-justified.
m
u columns
Select(kthe e to and choose Align Right from the style bar or select
AFormat c ns > End from the menu.
R >eJustify
K UM Whilelithe columns are selected choose Commas from the style bar. Click
N IT Add Decimal Place twice from the style bar. You can also select the
A V options from the Format menu.
N
c. Why are some of the cell and summary values displayed with asterisks?
What can you do to correct this?
The addition of the comma and two decimal places increased the width
of the data such that it exceeded the display size. To correct this, reenter
the Wizard and increase the width of the cell and summary fields. Select
Report Wizard from the right-mouse-button menu. Select the Labels tab
and choose a width more suitable for displaying the formatted values.
Try a width of 6.
d. Add a blue line color to the parent frame of NAME.
Select the column NAME and choose Select Parent Frame from the style
bar. Select Line Color from the vertical toolbar.
e. Save the report to a file named p5q4.jsp and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-20 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 5 (continued)


If You Have Time
5. Open the file p5q2.rdf and conditionally highlight the SALARY field.
To open the file select File > Open from the menu or select Open from the
toolbar.
Run the report by selecting it in the Object Navigator and then selecting
Program > Run Paper Layout from the menu or selecting Run Paper Layout
from the toolbar.
a. If the salary is less than 8500, print the field in italics.
Select the SALARY field, then choose Format > Conditional Formatting
from the menu or use the right-mouse-button to open the pop-up menu
and select Conditional Formatting from the pop-up menu.
The Conditional Formatting dialog box opens. Click New and enter the
r a ble
condition and formatting as required. Select a font name. Click OK tofe
return to the first page but do not close the dialog box. a n s
n t r
-make
b. If the salary is more than 12000, print the field in bold italics
n o
and the
text color red. s a
Click New again and enter the second condition
a
) handeฺformatting as
required. Click OK to return to the first m
copage of d dialog box and then
ithe
i l ฺ u
OK again to close the dialog box.ma t G
c. Save the report to a file named g
@p5q5.rdf n
de and close it.
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-21 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 6


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

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-22 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 6


1. Customize an existing template, adding a company logo and report title to the
report margin, and modify the report body.
a. Open rwblue.tdf. This file should exist in your working directory; it is a
copy of the Blue predefined template.
Select the Templates node in the Object Navigator.
Select Open and select the file named rwblue.tdf.
b. Display the margin region. (This usually appears by default when you open a
template.)
Select Tools > Template Editor from the menu. If the margin region is
not displayed, click the Margin icon in the horizontal toolbar.
c. Delete the Your Company logo. Import towers2.jpg and place it in the
top left corner of the margin; this file should exist in your home directory.
Select the Your Company logo and press the [Delete] key. r a ble
Select Insert > Image from the menu. n s fe
- t r a
Use the Browse button to locate towers2.jpg
n on
Resize it to fit into the margin region.
s a
d. Add a report title: Lakeside Technologies. h a
)Click
Select the Text tool from the vertical toolbar.o m d e ฺ the editor and
inside
c i
ailฺsize.tClick
type in the title. Select a font and font
m G u outside the textbox to
end. @ g den
e. Display the body regionitto31viewsthe
S u
tchanges you will make in the next steps.
v n i
Click the Marginabutton inththe horizontal toolbar in the Template
Editor. mar
n se
o u
(
f. Change kuthe justification
s e t of numeric fields (number field and summary) to
R n
U MARight. l i cenot forget to change the justification of labels for number fields to
Do

I T K Right.

A VN Select the number field and the number heading in the Template Editor
and click the Align Right tool from the stylebar.
N
Alterative solution:
Open the Field Labels/Headings and the Fields nodes under Paper
Layout > Section > Body > Default in the Object Navigator.
Open the Property Inspector for your selections.
Click Union (the button is a toggle and the tooltip says Intersection at
this point) from the Property Inspector toolbar to display all properties.
Under the headings Labels and Fields, change the Number Justification
property to Right.
Select Summaries > Number in the Object Navigator.
In the Property Inspector change the Number Justification property for
fields to Right.
g. Save the template as laketech.tdf.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-23 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 6 (continued)


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.
Invoke the Report Wizard. On the Template tab select the option
Template file. Click Browse to enter the name of the file in the field
below.
c. The report shows some changes but not all. Which template changes have
been applied and which have not?
Changes applied: Logo and report title
Changes not applied: Number justification
d. To apply all changes to your report, you will have to create the layout again. r a ble
From the menu, select Edit > Select All to select all layout objects. Now n s fe
- t r a
on
delete them. Invoke the Report Wizard and reapply your template.
n
s a
Note: When you delete the objects, Reports Builder displays the
following warning: “This will delete the frame h
) a all the objects it
and
encloses. Continue?”. Click Yes
c o m ideฺ
e. Save the report as p6q2.rdf.
m ent ailฺ Gu
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-24 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 6 (continued)


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.
Select the Character, Number, and Date fields and change the text color
with the Text color palette.
Alternative solution:
In the Object Navigator, expand the Override node, then the Group Left, le
the Section (Level1), and the Fields nodes. r a b
sf e
Bring up the Property Inspector for all the fields
tr a n
Change the text color to red. o n -
b. Save your template as laketech2.tdf and close it. a n
c. Create a new report, using the Report Wizard. ha
s
Use the layout style Group Left. m ) eฺ
c o id
Import the query p6q3.sql from your a ilฺworking
G udirectory.
Make DEPARTMENT_NAME g
the
t
mgroupefield.
n
Display all other columns.
i t 3 1@ Stud
a v n this
Do not create summaries.
Change them arn of SALARY
width u se to 6 and COMMISSION_PCT to 4.
u Template
Apply(kthe e to file laketech2.tdf.
A
NoRformal e s
nsolution.
M c
li report as p6q3.rdf and close it.
IT KUd. Save the
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-25 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 7


This practice session contains:
• Creating reports for the Web using the Report Wizard
• Examining the Web source code
• Modifying a Web report using the Report Wizard
Introduction
In this practice session, you create simple reports for the Web using the Report Wizard.
You also examine the Web source code to identify specific JSP tags.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-26 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 7


1. Create a tabular report, Web and paper layout, entitled Compensation Report. The
report should contain the following data:
SELECT d.department_name, e.first_name, e.last_name,
e.job_id, e.salary
FROM departments d, employees e
WHERE d.department_id = e.department_id
a. Display all fields. Select the predefined Blue template. Do not make any
changes to the other Wizard pages.
Create a new report using the Report Wizard. Create both a Web and
paper layout. Select Tabular as the style and enter Compensation Report
as the title. Select SQL as the data source and enter the query text from
above. Select all fields for display. Do not create any totals. Select the
Blue template and Finish the Wizard. r a ble
b. Run the Web layout to test. n s fe
- t r a
Select Program > Run Web Layout from the menu or select
n on Run
the
Web Layout icon from the horizontal tool bar.
s a
c. Examine the Web source. How many <rw:foreach>
) a
h are in the code?
tags
Why this number?
c o m ideฺ
Display the Web Source view of theaReport ilฺ Editor
G u by one of the
following methods:
m
g den t
@
1 object tu icon in the Object Navigator.
- Double-click the Web
n i t3Source
s S
- Click the Web Source
r n av ebutton thi in the Report Editor toolbar.
Use Edit > m Find s
a anduReplace to locate the rw:foreach tag(s). There is one
u
tag in(kthis Web t o
e source code because there is one group in the data model.
R n s
U MAreport
d. Modifycthe
l e report using the Report Wizard. Make this a Group Left break
idisplaying
I T K employing information grouped by department. Include a

A VN sum for salary. Reenter the Wizard. Select Group Left as the style. On the
Groups page, select DEPARTMENT_NAME from the Available Fields
N
list and copy into the Group Fields list. On the Totals page, select
SALARY and click Sum >. Finish the Wizard.
e. Examine the Web source again. Now how many <rw:foreach> tags are in the
code?
Display the Web Source view of the Report Editor. Use Edit > Find and
Replace to locate the rw:foreach tag(s). There are two rw:foreach tags,
one for each group in the Data Model—one for the master group, one for
the detail group.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-27 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 7 (continued)


f. Which JSP tag identifies the overall appearance and formatting of the data in
the Web report?
The rw:style tag identifies the style sheet for the report.
g. Which JSP tag delimits the data model and layout information? Can you
view this information in the Reports Builder?
The rw:objects tag delimits the data model and the layout information
for a Reports JSP. Reports Builder displays the <rw:objects …> tags,
but, hides the data model and layout information. To see this, use a text
editor such as Wordpad.
h. Run the Web layout to test. Save the report as p7q1.jsp.
2. Create a report for the Web that displays current product information.
a. Use the Report Wizard to create a new tabular report called Our Products.
Include the following data from the PRODUCT_INFORMATION table: fera
ble
ans
Column Label n - t r
product_id Product No. a no
h a s
product_name Name m ) eฺ
o
product_description a ilฺc Guid
Description
g m ent
catalog_url
i t 3 1@ S ud
CatalogtURL

a v n this
n product
arby se number..
Sort the output
m u
to using the Report Wizard. Create both a Web and
Create( kaunewsereport
A R layout.
paper en Select Tabular as the style and enter Our Products as the
M l i c
U title. Select SQL as the data source and enter the query:
I T K
V N SELECT product_id, product_name,
NA product_description, catalog_url
FROM products
ORDER BY product_id
Select all fields for display. Do not create any totals. Modify the labels as
above.
b. Select the predefined Beige template.
Select the Beige template and Finish the Wizard.
c. Run the Web layout to test.
Select Program > Run Web Layout from the menu or select the Run
Web Layout icon from the horizontal tool bar.
d. Save the report as p7q2.jsp.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-28 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 8


This practice session contains:
• Modifying report hierarchy by creating additional groups
• Restricting records in a query
• Restricting records with a packaged filter
Introduction
In this practice session, you modify an existing tabular report and create a break report.
Using two different techniques, you restrict the records in a report.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-29 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 8


1. Open report p8q1_a.jsp, a tabular report showing customer information.
a. Run the paper layout.
Select Program > Run Paper Layout from the menu or select Run Paper
Layout from the toolbar.
b. In the Data Model view, create a break group using NLS_TERRITORY as
the break column. Rename the group G_COUNTRY.
Click the Data Model button in the toolbar of the Report Editor.
Click and drag NLS_TERRITORY up out of the G_CUSTOMER_ID
group, creating a new group above G_CUSTOMER_ID.
Double-click the group bar to display the Property Inspector for this new
group. Enter G_COUNTRY in the Name property field.
Alternative solution: In the Object Navigator, double-click on the name
to obtain the I-beam, and then edit the name as desired. r a ble
c. Reenter the Report Wizard to update the layout. Select the Group Left n s fe
style.
- t r a
Ensure that all fields are displayed.
n on
a
Select Tools > Report Wizard from the menu or the right-mouse-button
s
menu. a
) h eฺ
On the Style tab select Group Left. m
co areulisted
id in the Displayed
On the Fields tab, make sure that all a i l ฺ
fields G
Fields area. g m ent
Click Finish. i t 3 1@ Stud
Examine the Web a v n hisnote that is was updated with the new
Source tand
arn Locate
group information.
m u se the <rw:foreach . . .> tag for the
group( u e to
kG_country.
d. ASave c ns as p8q1.jsp. Do not close the report.
R the ereport
2.KU
M li
Modify the previous report to restrict the number of customer records processed by
N IT the group.
V
NA a. Place a filter on the G_CUSTOMER_ID group to display only the first ten
customers. Run to test.
Select the group G_CUSTOMER_ID in the data model and open the
Property Inspector. Set the property Filter Type to First and enter 10 for
the Number of Records property. Run the paper layout.
b. Save the report as p8q2.jsp and close it.
3. Modify p8q1.jsp to restrict the report to customers who have a credit limit
greater than 1500. You need to modify the query properties.
a. Include CREDIT_LIMIT in the query statement, although you do not need to
display it. Restrict the query statement to show those customers who have a
credit limit greater than 1500.
In the Data Model, right-click the query Q_1, and select Edit Query.
Alternatively, you can also modify the query in the Property Inspector.
Enter WHERE CREDIT_LIMIT > 1500 directly in the query
statement area.
b. Save the report as p8q3.jsp and run the Web layout.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-30 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 9


This practice session contains:
• Creating a second query in an existing report
• Creating a data link
• Creating a report using a pluggable data source
• Creating a report containing a REF cursor query
Introduction
In this practice session, you include new data in a report by adding a query to an existing
single-query report using the Data Wizard. You also practice linking data from different
queries to alter the report structure. You will create a new report using the XML
pluggable data source and a SQL query.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-31 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 9 (continued)


1. Open p8q1_a.jsp.
a. In the Data Model, create the following query:
QUERY: Q_ORDERS
select customer_id, order_id, to_char(order_date,
'dd-Mon-yyyy') order_date,
order_total
from orders
Open p8q1_a.jsp from the file system. Display the Data Model view of
the Report Editor by double-clicking the Data Model icon in the Object
Navigator.
Select the SQL Query tool and click in the Data Model painter area.
Enter the query as above and click OK.
b. Change the name of the group to G_ORDERS. r a ble
Double-click the group bar to display the Property Inspector foranew n sfe
group. Enter G_ORDERS in the Name property field. on-t
r
c. Open the Report Wizard, create both a Web and paper layout,
s a n and select a
Tabular style.
) ha
Invoke the Report Wizard. Make the appropriate o ฺ
m idselections
e on the
l ฺ c u
Report Type and Style pages.
m ai t G
d. Copy group G_ORDERS to the @ gDisplayed
d e nGroups area.
On the Groups page, select
i t31 G_ORDERS
S tu from the Available Groups area
and click the Down
n thi
av> button. s
r n e
u m a fields
e. Copy all remaining
t o us to the Displayed Fields area.
On the
R (kFieldssepage, select all the remaining fields from the Available
M c enand copy to the Displayed Fields area.
AFieldsliarea
K Uf. Select a template and click Finish.
NI T g. Note how the data appears in the Paper Design view. The
A V G_CUSTOMER_ID data appears before the G_ORDERS data. Remember
N
that you can alter the order in which the data is displayed by modifying the
query order in the Data Model. You may want to try that.
Note: If you do adjust the order of the queries, put them back in the original
order and save before the next question.
h. Save the report as p9q1.jsp.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-32 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 9 (continued)


2. Continue with the same report.
a. In the Data Model, link the two queries together on the primary and foreign
keys.
Select the Data Link tool. Click and drag from the CUSTOMER_ID
column in the Customer group to the CUSTOMER_ID1 column in the
Orders group.
b. Redo the layout by opening the Report Wizard. Select the Group Above
style.
Do not display CUSTOMER_ID.
Reenter the Report Wizard and make the necessary changes.
c. Save the report as p9q2.jsp.
d. Run the Web layout.
3. Create a new report that lists the sales representatives and the products they have r a ble
sold. n s fe
- t r a
a. Create both a Web and paper layout and select a Group Above
n on style.
report
b. Import the query file p9q3_a.sql.
s a
c. Make NAME and EMPLOYEE_ID the group fields.
) h a Make sure that these
fields are in one group, at Level 1, and not o mseparate
two d ฺ
e groups.
On the Groups page, select NAMEaand l ฺ c
i EMPLOYEE_IDu i in the Available
m n t G
Fields area and copy them @ g Group
to the d e Fields area, making sure they
1
it3 is S
are both at the same level. t u
v n
a e th but display all other fields in the order
d. Do not display EMPLOYEE_ID,
described min a r n s
the tableubelow.
e. Change u t
(k the following
e o field attributes:
A R ens
K lic
UM Column Label Width
N I T name Name 15
V
NA product Product 15
product_id ID 4
quantity Quantity 4
prod_total Total 5

Modify the lables and widths according to the table above.


f. Use the predefined Gray template.
g. Click Finish to run your paper layout.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-33 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 9 (continued)


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.
Display the Data Model view. Select the SQL Query tool and click in the
painter area. Select Import SQL Query and locate the file p9q3_b.sql.
i. Ensure that the group is named G_CUSTOMER.
j. Link the second query to the correct group.
Select the Data Link tool. Click and drag EMPLOYEE_ID in G_NAME
to SALES_REP_ID in G_CUSTOMER.
k. Use the Report Wizard to display the new group. Display only the r a ble
CUSTOMER, CUSTOMER_ID, CUST_TOTAL fields. n s fe
- t r a
Reenter the Wizard and make the requested changes.
n on
l. Change the following field attributes:
sa
) h a
Column Label o Width eฺ
m
CUSTOMER Customer a ilฺc 15Guid
g m ent
CUSTOMER_ID ID 1@
i t 3 S tud 2
CUST_TOTAL avn Totalthis 5
r n e
u m a
t o us
k report
m. Save (the
s eas p9q3.jsp.
n. R
ARun the n
e layout.
U M l i cWeb
I T K
4. An international business has warehouses around the world. The database at
V N corporate headquarters maintains information about each of the warehouses
NA (warehouse id, name, city, country, and so forth). However, each warehouse stores
it operational data locally in a relational database. A planning team at headquarters
needs to access this inventory data for every warehouse. The warehouse data is
only available as an XML stream.
Create a report that combines general data stored in headquarters with the
inventory data from each warehouse location.
a. Create a new report manually.
Select File > New > Report or select the Reports node in the Object
Navigator and click the Create icon. Select the radio button Build a new
report manually.
b. In the Data Model view, create a SQL query. Import the SQL query
p9q4.sql.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-34 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 9 (continued)


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.
Select the XML Query tool. Click in the painter area of the Data Model
view. Specify the Data Definition by clicking the Browse button and
locating the file warehouse_inventory.xsd. Make sure the file type
selected in the Open dialog box is XSD.
Specify the Data Source by clicking the Browse button and locating the
file warehouse_inventory.xml
d. Link the two data sources together so that your report will provide a general
description of each warehouse along with the specific inventory for each
location.
Select the Data Link tool. Click and drag from WAREHOUSE_ID in fthe r a ble
s e
SQL query group to WAREHOUSE_ID1 in the XML query group.
t r a n
-
n Above
e. Create both a Web and paper layout for this report. Select theoGroup
style. Ensure that both groups are selected and display all n
afields. Use the Blue
template for this report. ha s
Invoke the Report Wizard. Work through m )
the pagese ฺof the Wizard
c o i d
making the selections as indicated. a ilฺ Finish
Click G uto run the paper layout.
f. Save the report as p9q4.jsp. g m e n t
@ d
g. Run the Web layout. it31
n this Stu
a v
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-35 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 9 (continued)


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

Create a new report manually. Select the Program Units node in the
Object Navigator and click the Create icon.
In the New Program Unit dialog box, enter RefCur as the name for the r a ble
package and choose Package Spec. n s fe
- t r a
Enter the code for the package specification. This code is o
n n
available in
p9q5a.txt.
s a
PACKAGE RefCur IS a
) h eฺ
TYPE EmpRec IS RECORD ( m
co uid
i l ฺ
ma ent G
last_name employees.last_name%TYPE,
g
first_name employees.first_name%TYPE,
i t
salary employees.salary%TYPE);3 1@ Stud
Type EmpCur a ISv nREF thCURSOR
is RETURN EmpRec;
r n e
END;
u m a
t o us
R (k thescode
Compile e and close the PL/SQL editor.
n
U MAIn
b. the Data
l i ce Model, create a REF Cursor Query. The function opens the cursor
IT K for the following SELECT statement:
V N SELECT last_name, first_name, salary
NA FROM employees
Select the Ref Cursor Query tool and click in the painter area. Define the
following function or copy the code from the text file p9q5b.txt.
function QR_1RefCurDS return RefCur.EmpCur is
V_EmpCur RefCur.EmpCur;
begin
OPEN V_EmpCur
FOR
SELECT last_name, first_name, salary
FROM employees;
RETURN V_EmpCur;
end;
Compile the code and close the PL/SQL editor.
c. Open the Report Wizard to create the layout for the tabular report. Select all
the fields and choose a template. Click Finish to run the paper layout.
d. Save the report as p9q5.jsp and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-36 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 10


This practice session contains:
• Creating a new report with summaries
• Opening an existing report to add summary calculations to the columns
• Creating a new report with ranking summary columns
• Opening an existing report to add placeholders for the highest and lowest values in
the report
Introduction
In your reports, you may need to include additional columns with summary functions—
or even add summaries, such as break totals and report totals. This practice gives you the
opportunity to create summaries and additional columns with functionality that cannot
be achieved using SQL alone.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-37 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 10


1. Create a new report using the Report Wizard. Create both a Web and paper layout
and select a Group Above report style.
a. Select the following columns in the Query Builder:
Table Columns
ORDERS order_id, order_date
ORDER_ITEMS line_item_id, product_id, unit_price, quantity

Hint: Manually edit the query created by Query Builder to modify the
display of order_date using the TO_CHAR function and specify an alias:
TO_CHAR(order_date, ‘dd-Mon-yyyy’)Order_Date
b. Modify the query to include line_total as a calculation of
unit_price*quantity.
Enter the formula unit_price*quantity into the query text and era
ble
give it an alias name of line_total. a n sf
You can also use the Query Builder to create expressions o -trquery:
innthe
Select the table ORDER_ITEMS.
s an
Select Define Column from the toolbar.
) ha
Enter Line_Total inside the Defined Columns o m box. d e ฺ
c i
ailฺ t Gu inside the Defined as
Enter the expression unit_price*quantity
m
box and click OK. @ g den
tu in the query is a better solution
t31 is Sdirectly
Note: Performing the icalculation
than having a formula
n
av column.
th
r n e
c. Group them
u
data
t o us ID and Order Date and display all the fields.
a on Order
Move(k Order_ID e and Order Date to the Group Fields section. Make sure
R
Athey are n s
U M l i ceat the same level.
IT K d. Create the following summaries. Can you use the Report Wizard to create the
V N summaries?
NA Because this is a single query report, you can use the Report Wizard.
Column Summary
line_total sum
line_total % Total

e. Specify the following labels and widths.

Column Label Width


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

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-38 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 10 (continued)


f. Use the Gray template and finish the Wizard.
In the Template tab choose and apply the template. Finish and run the
report.
g. In the Data Model, alter the position of columns in the G_ORDER_ID group
so that ORDER_DATE is above ORDER_ID, and change the break order on
ORDER_DATE so that it is sorted in descending order.
Click on ORDER_DATE and drag it above ORDER_ID; be careful not
to drag it outside the group.
Open the Property Inspector for ORDER_DATE and change the Break
Order property to Descending.
h. Run both the paper and Web layouts to test the report (do not reenter the
Wizard).
i. Save the report as p10q1.rdf and close it. r a ble
2. Open report p9q3.jsp. n s fe
- t r a
on
a. Create columns to show the percentage of the total per sales representative
n
for PROD_TOTAL and CUST_TOTAL. a
svertical
In the Data Model, select Summary Column in h
) a
the toolbar and
click inside the group G_PRODUCT. This om ฺ
createsdaenew summary.
l ฺ c
inew column ui and name it
Open the Property Inspector for the a
m ent G
PCT_PROD. g
In the Summary section i t 3 1@ the
select S ud % of Total.
tfunction
a v n this
The Source is PROD_TOTAL.
arn use
Reset at G_PRODUCT.
m
(
Compute e to
ku at sG_NAME.
A R Summary
Select en Column in the vertical toolbar and click inside the
M l i c
U group G_CUSTOMER. This creates a new summary.
T K
V NI Open the Property Inspector for the new column and name it
N A PCT_CUST.
In the Summary section select the function % of Total.
The Source is CUST_TOTAL.
Reset at G_CUSTOMER.
Compute at G_NAME.
b. Update the layout. Make all the new summaries four characters wide.
Reenter the Wizard to update the layout. Display the new columns and
ensure each has a width of four.
c. Save the report as p10q2.jsp.
d. Run the Web layout.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-39 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 10 (continued)


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
a ble
f e r
Include a summary of the salary column in the report. a n s
b. Use the Beige template and finish the Wizard. n -t r
o
n the highest
c. Modify the report to list employees by salary, beginningawith
paid in each department. ha s
Edit the query and add ORDER BY EMPLOYEES.SALARY
)
m ideฺ
l ฺ c o u
DESC.
d. To display the ranking, add a columnacall i RANK G in the group
G_EMPLOYEE_ID.
m
g de n t
1 @ tu G_EMPLOYEE_ID.
Create a summary column
n i t3 inistheSgroup
Name it Rank. av th
r n e
Select them
u
a
function
t o us
Count.
(k siseEMPLOYEE_ID.
The Source
R n
AResetliatceG_DEPARTMENT_NAME.
M
Ue. Use the Report Wizard to display the rank, giving it a width of 2.
T K
V NI f. Run the paper layout to test.
N A g. Save the report as p10q3.rdf.
4. Open report p10q1.rdf to display the highest and lowest orders at the end of the
report.
a. In the Data Model, add the columns necessary to list the maximum order
total and the corresponding ORDER_ID, as well as the minimum order total
and the corresponding ORDER_ID.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-40 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 10 (continued)


Hint: You need one formula column and two summaries and two
placeholders. You can import the code for the formula column from the file
p10q4.txt.
Display the Data Model for the report.
Create two summary columns at the report level :
Name Function Source Reset At
CS_Max Maximum SumLineTotalPerORDER_ID Report
CS_Min Minimum SumLineTotalPerORDER_ID Report

Also at report level create two placeholder columns. Name them


CP_Maxid and CP_Minid. This is where the ORDER_IDs of the highest
and lowest orders will go. r a ble
Create a formula column in the G_ORDER_ID group and nameaitns
fe
CF_GetIds. n - tr
Return number 1 (although it does not really matter a noyou return if
what
the formula column is a character type). h a s
The PL/SQL formula is the following: om
) eฺ
function CF_GetIdsFormulaaireturn lฺc GuNumber id is
begin m
g de n t
@
i t3 is Stu
1
if :SumLine_TotalPerOrder_Id
n = :CS_Max then
:CP_Maxid
n v th
a :=e :ORDER_ID;
end if; a r us
u m t o
R (k :SumLine_TotalPerOrder_Id
if
s e = :CS_Min then
n
U MA end l e
ic:CP_Minid := :ORDER_ID;

IT K if;
V N return (1);
NA end;
b. Use the Report Wizard to add the new columns to the layout. Display the
maximum order total, the maximum ORDER_ID, the minimum order total,
and the minimum ORDER_ID.
Display columns CS_Max, CS_Min, CP_Maxid, and CP_Minid. Give
them more meaningful labels.
c. Run the paper layout to test. Scroll down to the last page to see the new
columns.
d. Save the report as p10q4.rdf and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-41 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11


This practice session contains:
• Opening an existing report to add header and trailer pages
• Distributing a report to various destinations
• Modifying an existing report to add a repeating frame to the header section
displaying order information.
• Opening an existing report and adding flexible lines
Introduction
In this practice session, you use reports created in earlier practice sessions.The aim is to
familiarize you with the different layout sections and regions of a report, and to use
report bursting. You also add flexible lines to a frame.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-42 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11 (continued)


1. Open report p10q1.rdf. Modify the report as follows:
a. Create a header section.
Open the Paper Layout view of the Report Editor. Select Header Section
from the horizontal toolbar or choose View > Layout Section > Header
from the menu. Make sure that you are editing the Body region, not the
Margin.
Display the monitor.jpg file as fixed boilerplate in the Body region.
Select Insert > Image from the menu to insert the file. Move and resize it.
Add a rectangle boilerplate object. Give it fill color.
Select the Rectangle tool from the vertical toolbar. Make the rectangle
large enough to fit the image inside.
Select Fill Color from the vertical toolbar.
Place the image on top of the rectangle. Center the two objects. r a ble
Hint: Use the Layout option from the menu. n s fe
- t r a
Select the rectangle and select Layout > Send To Back from
n on menu.
the
a
Select the image, press the [Shift] key, and select the rectangle.
s
Select Layout > Alignment from the menu. In the
) h a dialog box select Align
to Each Other and then Align Center both om ฺ
e and vertically.
horizontally
d
l ฺ c u i
Click OK.
m ai t G
Include today’s date in the top @ g portion
right d e nof the margin.
Select Edit Margin from i S tu toolbar. Select Insert > Date and
1 horizontal
t3the
Time from the menu.
n
av Select i s
thTop-Right as the placement of the date field.
r n e
Select anym
u t o us for the date. Click OK.
ofathe formats
b. Add a(kreport title
e in the body region.
R n s
U MAUse Arial
l i cebold as the font and 20 as the size.
I T K Click the Text tool from the vertical toolbar and click in the layout area.

A VN Enter the text and click outside the text object.


While the text object is selected, choose font and size from the stylebar.
N

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-43 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11 (continued)


c. Add a trailer section that displays today’s date with the text “End of Report”
on one line, and “Report run on: ” on the second line in the body region.
Select a larger font.
Hint: Copy and paste the date from the Margin Area of the header section of
the report.
Select Trailer Section from the horizontal toolbar, or Select View >
Layout Section > Trailer from the menu. Make sure that you are editing
the Body region.
Click the text tool from the vertical toolbar and click in the layout area.
Enter the text and click outside the text object.
While the text object is selected, select font and size from the stylebar.
Select Edit Margin from the horizontal toolbar. Now select Header
Section. r a ble
Select the f_date1 field and then select Edit > Copy from the menu. n s fe
- t r a
Select Trailer Section from the horizontal toolbar. Deselect
n on Margin.
Edit
Select Edit > Paste from the menu and move the fieldato the desired
place. h a s
d. Save the report as p11q1.rdf. m ) eฺ
o uisiddifferent?
e. Run the Paper Layout. Run the Web a ilฺc What
layout. G
The paper layout has the header g mand trailer
e n t sections, the Web layout
@ d
does not.
v n this it31 Stu
a
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-44 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11 (continued)


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.
Open the Paper Layout view of the Report Editor. Select Header Section
from the horizontal toolbar, or choose View > Layout Section > Header
from the menu. Make sure that you are editing the Body region.
Select the Report Block tool from the vertical toolbar and click in the
Layout area. In the Report Block Wizard, select a tabular layout.
Select the group G_ORDER_ID and give a print direction down.
Select the fields ORDER_ID, ORDER_DATE, and
SumLinetotalPerOrder_Id.
b. Add “Executive Summary” as boilerplate text in the margin region of the
header section. r a ble
From the horizontal toolbar, choose Edit Margin. Select the Textatool n sfe
and create the boilerplate text. n - tr
o
nfile.
c. Set the distribution for the header section to an HTMLCSS a
s for the Header
In the Object Navigator, open the Property Inspector h
) eฺa
Section. Select the Distribution property.oIn
c m the Distribution
i d Dialog box
i l ฺ
set the Distribution ID to any stringaidentifier, u
G DESNAME to the
filename that you want, and@
m n t
g de to HTMLCSS.
DESFORMAT
1 Stu to a PDF file.
t3 mainissection
d. Set the distribution for ithe
n
av e open
In the Object Navigator,
r n th the Property Inspector for the Main
Section. Select
u m t o us
a the Distribution property. In the Distribution Dialog box
R (kDistribution
set the
s e ID, DESNAME, and DESFORMAT fields. Make
Asure the n
ceoutput format is PDF.
U M l i
I T K e. Run and test the report using the Distribute facility in Reports Builder.
A VN Select File > Distribute.
f. Look at the output generated for both file formats.
N
Locate the files in your file system having the filenames that you
specified in the DESNAME field. Double-click each of them to look at
the output.
g. Save the report as p11q2.rdf and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-45 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11 (continued)


3. Open report p11q3.rdf. Modify the report to burst on repeating data, based on
warehouse ID, and distribute a PDF report for each warehouse.
a. In the Paper Layout view of the Report Editor, select the outermost repeating
frame and delete it.
Invoke the Paper Layout view of the Report Editor. Locate the repeating
frame R_G_WAREHOUSE_ID in the Object Navigator. The repeating
frame is now selected in the Paper Layout. With focus on the Paper
Layout, delete the repeating frame. Be sure you do not delete the frame
from the Object Navigator as this will delete all the objects within the
frame as well.
b. Set the property for the main section of the report to burst on each warehouse
ID.
Select the Main Section node in the Object Navigator. Double-click the r a ble
object icon to display the Property Inspector or select Tools > Property n s fe
- t r a
Inspector from the menu.
n on
Locate the Repeat On property and select G_WAREHOUSE_ID
s a from
the drop-down list.
) ha
c. Define the distribution for the report. Generate o ma PDF d e ฺ for each
file
c i
warehouse, using the warehouse name
m aiaslฺ a unique
t G uidentifier for each PDF
file, such as rptBejiing.pdf.
@ g den
31 s Sfortuthe Main section. In the Distribution
Select the Distributionitproperty
n
Dialog box set the
r n e thi ID, DESNAME, and DESFORMAT
avDistribution
u
a
t o us
fields. Usemwarehouse_name in the DESNAME field, for example:
(k se
rpt&<warehouse_name>.pdf.
R
Make sure the output format is PDF.
n
U MASelect
d. Activate
l cethe distribution.
iFile
I T K > Distribute from the menu.
e. Save the report as p11q3.rdf.
A VN f. Look at the output generated for several of the warehouses.
N
Locate the files in your file system, for example, rptBeiging.pdf,
rptBombay.pdf and double-click several of them to look at the output.
4. Open report p11q4.rdf.
a. Use the Report Wizard to increase the width of PRODUCT_DESCRIPTION
to 30.
b. Add a flexible line vertically between the PRODUCT_NAME and
PRODUCT_DESCRIPTION fields.
Select the line tool from the vertical toolbar. Create a line between the
fields. If you want to ensure that the line is vertical, press the [Shift] key
while drawing. In the Property Inspector, set Line Stretch with Frame to
R_G_PRODUCT_ID.
c. Run the Paper Layout to test.
d. Save the report as p11q4.rdf.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-46 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11 (continued)


5. Open and run report p2q10.rdf.
a. Using the Paper Design view, compare the output with s11q5a.rdf
from the \Soln directory. What is different? Change the report so that
it looks like s11q5a.rdf.
Both are master detail reports. But in s11q5a.rdf the groups are
intermixed.
b. Fully expand the Paper Layout node for p2q10.rdf.
Select the Paper Layout node for p2q10.rdf. Then select Expand All
in the Vertical toolbar.
c. Open the Paper Layout and move the window to the right. Make sure it
doesn’t obscure the Object Navigator window.
d. Move the F_EMPLOYEE field down 2 inches. It should not be enclosed by
any frame. r a ble
Select Flex Off and Confine Off in the Horizontal toolbar. Click a n
and sfe
drag the F_EMPLOYEE field down 2 inches. Notice where n -
thetrfield is
being placed in the object hierarchy. a no
e. Resize the R_G_EMPLOYEE frame so that it only h a s
encloses the F_SALARY
and F_JOB_ID fields. m ) eฺ
o
a ilฺc Guid In the Paper Layout,
In the Object Navigator, select R_G_EMPLOYEE.
resize the frame. g m ent
t 3
f. Resize the M_G_EMPLOYEE_GRPFR
i 1@ Studframe so that it encloses the
R_G_EMPLOYEE a v n thframe.
repeating is
n se select M_G_EMPLOYEE_GRPFR. In the
arNavigator,
to uthe frame.
In the Objectm
Paper ( u eresize
kLayout,
g. A
Move c ns
R theeF_DEPARTMENT_NAME and F_DEPARTMENT_ID fields to
U M the right.
l i
I T K
A VN Click and drag the fields to the right.
h. Create a new repeating frame in the free space. Set the Line color attribute to
N
No line.
Select Repeating Frame form the Vertical toolbar. Click and drag an
area in the space previously occupied by F_DEPARTMENT_ID and
F_DEPARTMENT_NAME.
Using the Line Color palette, set the line color to No Line.
Note: Ensure that the new repeating frame R_1 is at the same level as
M_G_EMPLOYEE_GRPFR. Use the Object Navigator to verify this.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-47 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 11 (continued)


i. Link the repeating frame to the G_EMPLOYEE group.
Open the Property Inspector for the new repeating frame and set the
Source property to G_EMPLOYEE.
j. Move the F_EMPLOYEE field inside the repeating frame R_1.
k. Save the report as p11q5a.rdf and run the paper layout. What happens?
A run-time error occurs as the F_EMPLOYEE field is at the wrong
hierarchy level, meaning not enclosed by the right parent object.
l. Fix the layout hierarchy error.
Select F_EMPLOYEE, the from the menu select Layout > Bring to
Front.
The field is now enclosed by R_1.
m. Rearrange the column headers.
Click and drag the column headers to match the column positions. fera
ble
n. Run the paper layout. a n s
The two data groups are now intermixed. n -t r
o
o. Close the report. Save as p11q5a.rdf.
s an
h a
) eฺ
o m
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-48 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 12


This practice session contains:
• Creating a break report with continuation pages displaying limited information
• Modifying properties for object Web support
Introduction
Sometimes detail records get separated from their master header. You ensure that this
does not happen.
All paper layout objects support Web features. You will create a report that takes you to
a PDF document with a simple click using a hyperlink.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-49 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 12


1. Create a new break report showing each customer and the relevant orders.
a. Create a group above master detail report. Use the query p12_1.sql to
create the report.
In the Report Wizard, select the Group Above report style and use
Import SQL Query.
b. Select Name as the group field and display all the customer data in the break
group. Create a sum for the quantity.
The break group should contain all the fields from the CUSTOMERS
table. Create totals by using the Sum function on the quantity column.
c. Modify the width for the fields listed below:
Column Label Width
name Name: 20 a ble
f e r
street_address Address: 10 ans
n - t r
city City: 10
a no
state_province State / Province: 10 h a s
) ฺ
postal_code Zip: 5 ฺcom ide
a il G u
country_id Country: m
g 2den t
@
1 Stu6
credit_limit
n i
Credit t3Limit:is
a v
n What t h
d. Run the paperm arlayout.
u se do you see?
Some(k e to master records print without their detail order
ofuthe customer
A R enson the same page.
information
K Ue.M Ensurelicthat no customer data displays on a page without details.
N I T Open the Property Inspector for the repeating frame and set the Page
V
NA Protect property to Yes.
f. Save the report as p12q1.rdf.
g. Run the paper layout again to test.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-50 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 12 (continued)


2. Create a new tabular report.
a. Define the SQL query as:
select last_name, first_name, hire_date
from employees
Display all fields. Choose the Wine template.
b. In the Margin region of the report’s Main Section, delete the company logo.
Resize the margin to 1.75 inches. Insert the image dinner1.bmp. Create a
rectangle around it and give it a solid fill. Move the rectangle behind the
image to create the effect of a colored border around the image.
In the Paper Layout, select Edit Margin. Select the Your Company, Inc.
logo and delete it.
Select the margin rectangle. Using the central handle on the top edge,
size the margin to 1.75 inches. r a ble
Then from the menu, select Insert > Image and browse for n s fe
- t r a
dinner1.bmp. Click OK.
n on
From the vertical toolbar, select Rectangle.
s a
Click and drag a rectangle around the image. Give
) a
h a solid fill. From
it
the menu, select Layout > Send to Back. om d e ฺ
c i
c. When you click on the image in HTML
m ailฺoutput
t G u want to open a local
you
.pdf file named mousse.pdf.
@ g den
Open the Property Inspector
i tu image and set the hyperlink
t31 isforSthe
n
av e th
property to mousse.pdf.
r n
d. Save the report
u m t o us
a as p12q2.rdf and generate a file in paginated HTMLCSS
R (kOpensthe
format. e file in your browser and test the hyperlink.
n
U MASave the
l i cereport. Select File > Generate to File > Paginated HTMLCSS.
IT K Start your browser, open the file, and click on the image.
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-51 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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 link file to a report
• Ensuring that all details of a master are printed on the same page
Introduction
Modify a mailing label report to ensure you fill the printed page with label records. You
then restrict the number of labels that are printed on each page.
You add a link file to display a company logo by dynamically referencing a file at run
time.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-52 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 13


1. Open report p4q4.rdf.
a. Modify the layout so that the mailing labels are 2 inches wide and 1 inch
high. Use the Layout option on the menu. Ensure that the customer names are
printed in alphabetical order across the page.
Open the Paper Layout view of the Report Editor and select the
repeating frame. From the menu, select Layout > Size Objects. Select
Custom for both width and height and enter the size in the fields. You
can also drag and resize the repeating frame in the Paper Layout.
Add an ORDER BY clause to the query to sort the labels on
cust_last_name.
b. Give each label a solid fill.
Select Fill Color from the vertical toolbar and select a color.
c. Make the boilerplate object 1.8 inches wide and center it horizontally andfera
ble
vertically in the repeating frame. a n s
Select the boilerplate object in the Paper Layout and choose n -t r
Layout >
n o
Size Objects from the menu. Select Custom for the width
s a and No Change
for the height. Enter the width in the field below.
) ha
m ideframe
Select both the boilerplate object and theorepeating ฺ and choose
c
lฺ Align u to Each Other, and
Layout > Alignment from the menu.
m aiSelectt G
then Align Center, both horizontally
@ g dand e nvertically.
d. Add spacing between the i 1 .25
t3labels: S u between each column of labels
tinch
n
v between
across the page; .5ainch s
thi each row of labels down the page.
a r n e
s and open its Property Inspector. Set Horiz.
Select them
u
repeating
t o uframe
Space(kBetween e Frames to .25 and Vert. Space Between Frames to .5.
e. A R n s
e layout to test. Save the report as p13q1.rdf.
Run thecpaper
U M l i
2.K Continue with report p13q1.rdf.
I T
A VN a. Modify the report so that only six labels are printed on each page.
Select the repeating frame and open its Property Inspector. Set
N
Maximum Records per Page to 6.
b. Run the paper layout to test. Save the report as p13q2.rdf and close it.
3. Open p10q1.rdf.
a. On the operating system, copy the file summitlo.tif to a file
logo.tif.
Ask your instructor for help if needed.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-53 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 13 (continued)


b. Delete the logo in the margin area and create a file link in its place to display
the contents of logo.tif.
Select Edit Margin from the horizontal toolbar. Select the logo
boilerplate and press [Delete]. Select the File Link tool from the vertical
toolbar and create an external boilerplate object in the margin region
where the logo was. Set the following properties:

Property Value
Name B_logo
Source File Format Image
Source Filename logo.tif
a ble
f e r
c. Run the paper layout. a n s
d. On the operating system, copy any other .tif file to logo.tif.n -t r
o
e. Rerun your report.
s an
f. Save the report as p13q3.rdf.
) ha
4. Continue with report p13q3.rdf.
c o m ideฺ
ilฺ onGthe
a. Ensure that all items of one order areaprinted u same page.
Select Edit Margin from the
m n
g detoolbar.
horizontal
t Open the Property
1 @ t u
v n it3 frame
Inspector for the repeating
i s S R_G_ORDER_ID and set the property
r n a e th
Page Protect to Yes.
b. Save the report us
ma as p13q4.rdf and close it.
( ku se to
A R en
U M l ic
IT K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-54 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
Introduction
In this practice, you will create a Web report by adding dynamic report data to an
existing HTML page. You will also customize the Web report by using JSP tag
attributes.

a ble
f e r
an s
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-55 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 14


1. Create a new Web report by adding dynamic content to an existing Web page.
a. Open the file mywebpage.htm in Reports Builder.
b. Define a data model using the Data Wizard. Import the query p14q1.sql.
Use DEPARTMENT_ID and DEPARTMENT_NAME as the group fields.
Include a sum of the salaries.
Display the Data Model view of the Report Editor. Right-mouse-click in
the Data Model painter area and select Data Wizard from the menu.
Select SQL Query on the Data Source page.
Import the query p14q1.sql.
Copy department_id and department_name from the Available
Fields area to the Group Fields area. Be sure both columns are at the
same level (Level 1).
Select the salary column and click Sum >. r a ble
Click Finish to complete the Data Wizard. n s fe
- t r a
c. Save the report as p14q1.jsp. n
nosource
d. Create a report block and add it to the Reports JSP. The aWeb code has
s
ha Left style and include
a place holder for your report block. Choose the Group
)
m idandeฺdisplay in the down
a title “Salaries by Department”. Include allogroups
c
m ailฺof Name
direction. Display all fields. Use a label
t G ufor
DEPARTMENT_NAME and@ Title e n Select the predefined Beige
g for dJOB_ID.
template.
n i t31 is Stu
Display the Weba
n v view
Source th of the Report Editor by double-clicking on
the objectm r
a for the
icon e
usWeb Source in the Object Navigator.
u t o
Scroll(kthroughethe code until you locate the placeholder “Insert your
A R block
report c e nshere”.
K UM With lyouri cursor in that position, select Insert > Report Block from the
N IT menu.
A V Select the style Group Left and enter Salaries by Department in the title
N
field.
Select the group G_department_id and click Down >.
Select the group G_Employee and click Down >.
Copy all the columns from the Available Fields area to the Displayed
Fields area.
On the labels page, make the appropriate changes.
Select the Beige template. Click Finish.
e. Run the Web layout to test. Save the report.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-56 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 14 (continued)


2. Customize report p14q1.jsp using JSP tag attributes.
a. Display the salary and summary values with an appropriate currency format.
Display the Web Source view of the Report Editor. Locate the rw:field
tag for F_SALARY and add the formatMask attribute:
<rw:field id="F_salary" src="salary"
nullValue="&nbsp;" formatMask="$999,999.00">.
Locate the rw:field tag for F_SumsalaryPerdepartment_id and add the
same format mask attribute:
<rw:field id="F_SumsalaryPerdepartment_id...
"formatMask="$999,999.00">
Locate the rw:field tag for F_SumsalaryPerReport and apply the same
formatMask attribute.
b. Run the Web layout to test. Did you remember to format the report r a ble
summary? Save the report as p14q2.jsp. n s fe
- a
tr
no n
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-57 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
Introduction
Using XML you can build fully functional reports or partial reports that can serve as a
customization file.
You will run an XML file and apply an XML definition to an existing report.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-58 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 15 (continued)


1. Run an XML report definition.
a. Open p15q1.xml using Wordpad. Examine the code. What type of report
definition is this? What goes on in this file?
It is a full XML report definition with both a fully functional data model
and layout. It builds a two query group above report. It creates a data
link between the two queries and a summary column in the master
group. It uses the template rwbeige.tdf, but overrides the formatting
for the F_SAL field through a formatting exception.
b. Execute p15q1.xml using the Run Paper Layout option in Reports Builder.
Open p15q1.xml in Reports Builder and select Program > Run Paper
Layout from the menu or use the Run Paper Layout icon from the
toolbar.
2. Apply run-time customizations. r a ble
a. Open p15q2.rdf. Run the paper layout. n s fe
- t r a
b. What type of report is this? Investigate the data model, the paper
n on layout, and
the report sections. a
s Header
It is a simple tabular report. There is nothing inhthe
) a and Trailer
sections. There are no summary fields, and omno udata
d ฺ
eformatting.
l ฺ c i
c. Open p15q2.xml. Examine the code.
m ai Whatt goes
G on in this XML definition
file? @ g de n
It has a data source that i 1 S tufrom what is in the p15q2.rdf
t3is different
report. The dataa
n
isvgoing to s
thbei formatted in the header section. In the
main section r n s e
ait has auformatting specification for the SALARY column in
u m t o
R (k section.
the main
se to p15q2.rdf using the RWRUN command and send
d. A e n
Apply p15q2.xml
U M the output
l ic to a PDF file.
I T K
A VN Specify the following command in the Command Prompt window:
N RWRUN report=p15q2.rdf customize=p15q2.xml
destype=file desformat=PDF desname=myreport.pdf
userid=<username>/<password>@<database>
e. Examine the newly created report output. What do you see?

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-59 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
Introduction
In this practice session, you create bind and lexical parameters to restrict records in the
report. You add lists of values to select valid values at run time.
You then create your own default parameter form and customize it to include extra text
and graphics.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-60 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 16


1. Open report p13q3.rdf.
a. Modify the data model and add the following columns from the
CUSTOMERS table. Create a new group for the customer information above
the G_ORDER_ID group.
Column Label Width
cust_first_name ||’ ‘|| cust_last_name Name 30

cust_email Email 20

Create a reference to a bind parameter P_CUSTOMER in the query to restrict


orders to the parameter value you input at run time.
Note how Reports creates the parameter automatically.
Add the following to the WHERE clause of the query: r a ble
n s fe
AND customers.customer_id =:p_customer
- t r a
b. Run and test the report with valid customer IDs.
n on
Choose any number in the range 101 to 170.
c. Save the report as p16q1.rdf. Do not close it. ha
sa
2. Continue with report p16q1.rdf. m ) eฺ
o
lฺc Guid in the
a. Add a list of values to select any valid a iCUSTOMER_ID
CUSTOMERS table that has@ an g order in
t
m ethenORDERS table. Do not allow
1
3 The
users to enter any otheritvalue. t u d
n i s Slist should display customer names, not
CUSTOMER_ID a
n v h that each customer name appear only
numbers. tEnsure
r e
a even uif sthe customer has several orders.
once in themlist,
(
In the u
k Object e to
Navigator, expand the Data Model node and the User
R n s
U MA Parameters
l i ce node.
I T K Open the Property Inspector for the P_CUSTOMER parameter and

A VN make sure that the datatype is Number.


In the parameter Property Inspector, select List of Values.
N
In the dialog box, choose Select Statement.
Make sure that the Restrict List to Predetermined Values check box is
selected.
Select the Hide First Column check box.
Enter the following statement in the Enter Query area:
select unique c.customer_id, c.cust_first_name ||‘
'|| c.cust_last_name Name
from customers c, orders o
where c.customer_id = o.customer_id

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-61 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 16 (continued)


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 employee’s last name.
In the Object Navigator, expand the Data Model node. Double-click the
User Parameters node to create a parameter.
Select the parameter name P_1 and change it to P_ORDER.
Open the parameter Property Inspector.
Make sure that the datatype is Character and increase the width to 50.
Enter an Initial Value: r a ble
n s fe
ORDER BY employees.last_name
- t r a
In the Data Model, open the query Property Inspector and onadd the
following lexical reference to the end of the query: a n
&P_ORDER h a s
m ) eฺCode two or three
b. Add a static list of values for the parameteroP_ORDER.
alternative ORDER BY clauses. Allow a G utoidbe entered at run time.
ฺc clause
ilany
Display the Property Inspector gfor
t
m theeparameter
n P_ORDER and select
1 @ t u d
List of Values.
v n it3 is S
r n e th Values and enter other ORDER BY
In the dialog boxachoose Static
clauses inmthe s for example:
a Valueufield;
ORDER u t o
(k BY semployees.last_name
e
A R
ORDERce n employees.job_id
BY
K UM For eachli value, remember to select Add>> to add the value to the list.
N IT Clear the Restrict List to Predetermined Values check box.
A V c. Run the paper layout to test.
N
Select an ORDER BY clause from the list.
Enter your own ORDER BY clause.
Delete the initial parameter value.
d. Save the report as p16q3.rdf and close it.
4. Continue with report p16q2.rdf.
a. Create a default parameter form.
Include a Title message but not a Hint message.
Display the P_CUSTOMER parameter.
Select Tools > Parameter Form Builder from the menu.
Enter your own Title message. Delete the Hint message.
Select P_CUSTOMER.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-62 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 16 (continued)


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.
No formal solution.
c. Add a format mask to the field displaying line_total.
Open the Property Inspector for F_LINE_TOTAL. In the Format Mask
property, select one of the masks, such as $<N,NNNN.00>.
d. Run the paper layout to test. Select a customer from the list.
e. Save the report as p16q4.rdf and close it.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-63 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
Introduction
In this practice session you open existing reports to add graphs using the Graph Wizard.
You reenter the Graph Wizard to change the characteristics of a graph. You will also
add and customize a graph in a Web report.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-64 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 17


1. Open report p17q1a.jsp.
a. Run the paper layout to become familiar with the report.
b. Rename SumCust_totalPersales_rep_id to Total_Sales (a shorter, more
meaningful name looks better in a chart).
Display the Data Model and open the Property Inspector for
SumCust_totalPersales_rep_id to change the name. Alternatively,
change the summary field name in the Object Navigator > Data Model >
Groups node.
c. Use the Graph Wizard to create a bar chart.
In the Paper Layout, select Insert > Graph from the menu and enter the
following properties on the Wizard pages:

Graph Type Bar a ble


f e r
Graph Subtype Bar ans
n - t r
Position at the end of the report
a no
Category sales_rep_id h a s
m ) eฺ
o
ilฺc Guid
Data total_sales
m a t sales_rep_id from the
In the layout page of the Graph g Wizard, e n
drag
t
Groups section to the iBars 3 1@ S
section.tud
a
d. Run the paper layoutv nto test.thResize
is the graph in the Paper Layout, if
necessary.mar
n se
to u
ku assep17q1.jsp.
e. Save (report
A
2. ReenterRthe Graphen Wizard to change the characteristics of the graph created in the
U M l i c
I T K previous exercise.
V N In the Paper Layout view, make sure that the graph is selected; otherwise you
NA will create a new graph.
Select Graph Wizard from the right-mouse menu.
a. Give the graph the following characteristics:
Enter the following properties in the Wizard pages:

Title Order Total per Sales Rep


Graph Type Horizontal Bar
Graph Subtype Bar

Click OK.
b. Run the paper layout to test.
c. Save report to p17q2.jsp.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-65 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 17 (continued)


3. Continue with report p17q2.jsp.
a. Run the Web layout. What do you see?
There is no graph displayed in the Web output because you have not yet
added it to the Web source.
Also, an error message displayed: Cannot find cursor containing column
"SumCust_totalPersales_rep_id" because the name of the summary
column was changed in the Data Model but not in the Web source.
b. Update the Web source with the correct column name.
Display the Web Source view. Locate the reference for <rw:field
id="F_SumCust_totalPersales_rep_id"...>. Edit the source
attribute for this field to src="Total_Sales".
c. Run the Web layout again to test.
d. Add a graph to the Web source. Position the graph at the beginning of thefera
ble
report. a n s
Display the Web Source view. Scroll down the code and positionn r
-t your
o
cursor just before the “Data Area Generated by Reports
s a nDeveloper”.
Select Insert > Graph from the menu and enterhthe
) a following properties
on the Wizard pages:. om deฺ
a ilฺc Gui
Graph Type Bar gm e n t
Graph Subtype i t 3 1@ Stud
Bar
a v n this
Category
m arn usesales_rep_id
Data (ku e to total_sales
R
A licen s
U MTitle Order Total per Sales Rep
I T K
V N
NA On the layout page of the Graph Wizard, be sure to drag sales_rep_id
from the Groups field to the Bars field.
e. Run the Web layout to test. Save the report as p17q3.jsp.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-66 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 17 (continued)


4. Open report p9q3.jsp.
a. Use the Graph Wizard to create a pie chart for the data group G_PRODUCT.
Invoke the Graph Wizard with the focus on the Paper Layout.
Display the Paper Layout view of the Report Editor. Select Insert >
Graph from the menu, and enter the following properties on the Wizard
pages:

Graph Type Pie


Graph Subtype Pie
Graph Position Once per Name
Data Group G_PRODUCT
a ble
Category product_id f e r
ans
Data prod_total n - t r
a no
On the layout page of the Graph Wizard, be sure h a s
to drag product_id
from the Groups field to the Slices field. om
) eฺ
a
b. In the Paper Layout, ensure that the graph G uid beneath the product
ilฺcis positioned
group. g m ent
3 1@andSdrag
If necessary, select theitchart tudit below the product group frame.
You must enableaFlex v n Mode.
t h s not forget to turn it off again when you
iDo
have finished.
m arn use
(
c. Run the to and test the report.
kupaperselayout
d. A R the ereport
Save n as p17q4.jsp.
5. U M l i c
Continue with report p17q4.jsp.
I T K
V N a. Add a bar graph to the Web source for the data group G_PRODUCT. Use the
NA same data group, category, and value settings as in the previous exercise.
Hint: You want to insert the graph just before the termination of the
rw:foreach tag for the group G_NAME.
Display the Web Source view. Locate the <rw:foreach...> tag for the
G_NAME group. You can use Edit > Find and Replace from the menu to
help you locate G_NAME. Scroll down in the code until you come to the
corresponding termination tag </rw:foreach>. The indented nature of
the code will help you identify the correct tag.
With you cursor just before the tag, select Insert > Graph from the
menu.
Select a chart type of Bar. Use the table from the previous exercise to set
the other values in the Wizard.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-67 and/or its affiliates.
2010, Oracle
SQL Star International Limited
Practice Session Solutions: Lesson 17 (continued)
b. Run the Web layout to test. Ensure that a graph displays for each sales
representative.
c. Resize the graph to a width of 800 and a height of 450.
Display the Web Source view. Locate the rw:graph tag. Add width and
height settings to the attribute list: <rw:graph id="graph“
src="G_PRODUCT" groups="PRODUCT_ID“
dataValues="PROD_TOTAL" width="800" height="450">
d. Save the report as p17q5.jsp. Run the Web layout to test.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-68 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
Introduction
In this practice session, you use an existing matrix report to investigate the different
methods of displaying the cell values and the implications. You use an existing SQL
query to create a nested matrix report. You then add row- and column-level summaries
le
to the report and display zeros for null values.
fe rab
If you have time, include the product names instead of the product IDs and rotatea n s
the
t r
names.
non-
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-69 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 18


1. Open report p4q6.jsp.
a. How many repeating frames do you have?
There are two repeating frames, R_G_NAME and R_G_PRODUCT_ID.
b. Change the properties of the cell object to display zero for a null value.
Open the Property Inspector for F_SumTOTAL_VALUE and set Value
if Null to 0.
c. Run the paper layout to test the report.
All cells without a value now display 0.
d. Close the report without saving it.
2. Create a new report, importing the query p4q6.sql from your working
directory.
Select File > New > Report from the menu, or open a new report in the Object
Navigator. Use the Report Wizard. r a ble
a. Select the following settings: n s fe
- tra
no n
Report Style Matrix
s a
Query Import Query p4q6.sqla
) h eฺ
Matrix Row Fields Level 1 - monthco m id
Level 2m ailฺ t Gu
- name
@ g den
Matrix Column Fields
i t31product_id
S tu
Matrix Cell Fieldsnav
n s
thi of total_value
Sum
r e
Matrix k u ma to us Sum of (Sum of total_value)
Totals
R ( se
A e n
K licthe labels and widths for the following fields:
Ub.M Change
N I T
V
NA Field
name
Label
Customer
Width
10

product_id Product 5

month Month 4

SumTotal_value Total 5

All Summaries Total: 5

Select a template and finish the Wizard.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-70 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 18 (continued)


c. Increase the width of the Main Section of the report to 17 inches.
Open the Property Inspector for the Main Section of the paper layout.
Set the Width property to 17.
d. Save the report as p18q2.jsp. Run the paper layout.
e. Which summaries were created?
SumTOTAL_VALUEPerName
SumTOTAL_VALUEPerPRODUCT_ID
SumTOTAL_VALUEPerReport
These are the row, the column, and the report summaries.
f. Use the Data Model view to create summaries for each month and for the
level month and product.
In the Data Model, click the Summary Column button in the tool palette
and click inside the cross product group G_SumTOTAL_VALUE. fera
ble
Repeat the steps for the second summary column.
- tr ans
no n
a
Use the following settings for the two summary columns:
s
h a
) eฺ
Property Value o m
Name a
SumMonth ilฺc Guid
g m ent
Product Order
i t 3 1@ S tud
G_MONTH
Function a v n thSum is
Sourceum
arn use SumTOTAL_VALUE
( k se to
A R
Reset Aten G_MONTH
U M l i c
I T K
V N Property Value
NA Name SumMonthProduct
Product Order G_MONTH G_PRODUCT_ID
Function Sum
Source SumTOTAL_VALUE
Reset At G_PRODUCT_ID

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-71 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 18 (continued)


g. Use the Paper Layout view to create the fields. You must expand the
appropriate repeating frame.
Select and expand R_G_MONTH. You must enable Flex Mode. Do not
forget to disable it again when you have finished.
Select the Field tool from the vertical toolbar.
Create a field below F_SumTOTAL_VALUE. Position the field in the
R_G_MONTH and the R_G_PRODUCT_ID repeating frames.
Set the following properties:

Property Value
Name F_SumMonthProduct
Source SumMonthProduct a ble
f e r
ans
Select the Field tool from the vertical toolbar. n - t r
Create a field below F_SumSumTOTAL_VALUEPerNAME. a no Position
the field in the R_G_MONTH repeating frameh a
but
soutside any other
repeating frames. m ) eฺ
c o id
Set the following properties: ailฺ Gu
m ent
@ tudg
Property i t 3 1Value S
v n h i s
Name
a rna use tF_SumMonth
( kumse to
Source SumMonth
R
A licen
M
Uh. Run the paper layout to test the report.
I T K
N i. Save the report as p18q2.jsp. Do not close it.
V
NA 3. Continue with the report from the previous exercise.
a. Add zeros for null values in the cells.
Open the Property Inspector for F_SumTOTAL_VALUE and set Value
if Null to 0.
b. Ensure that the report shows only three product columns on each page.
Open the Property Inspector for R_G_PRODUCT_ID and set Maximum
Records per Page to 3.
c. Format all numeric data to be right aligned.
Use the style bar.
d. Add commas and two decimal places where appropriate.
Use the style bar.
e. Run the paper layout to test the report.
f. Save the report as p18q3.jsp and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-72 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 18 (continued)


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.
Use the right mouse button and click Edit Query.
The query in the SQL Query Statement dialog box should read:
SELECT C.CUST_FIRST_NAME || ' ' || C.CUST_LAST_NAME
Name,
I.PRODUCT_ID,
SUM(I.UNIT_PRICE * QUANTITY TOTAL_VALUE),
TO_CHAR (O.ORDER_DATE, 'MM/RR') MONTH,
P.PRODUCT_NAME PRODUCT
r a ble
FROM CUSTOMERS C, ORDER_ITEMS I, ORDERS O,
n s fe
PRODUCT_INFORMATION P
- t r a
WHERE I.PRODUCT_ID LIKE '1%‘
n on
AND O.CUSTOMER_ID = C.CUSTOMER_ID s a
AND I.ORDER_ID = O.ORDER_ID a
) h eฺ
AND P.PRODUCT_ID = I.PRODUCT_ID m
co uid
i l ฺ
a || t'G' ||
GROUP BY C.CUST_FIRST_NAME
g m e n
C.CUST_LAST_NAME, @ d
I.PRODUCT_ID, n i t31 is Stu
av e th
TO_CHARrn(O.ORDER_DATE, 'MM/RR'),
a
m to u
P.PRODUCT_NAME s
b. InR ( k u
the Paper s e view, delete the product_id field and insert a boilerplate
Layout
A e n
U M objectlitoc display the product name. Rotate this object by 90 degrees.
I T K Note: You may have to expand the R_G_PRODUCT_ID frame and the
A VN outermost frame. Watch out for frequency errors.
N Select F_PRODUCT_ID and press [Delete].
Select the Text tool from the vertical toolbar and create a text object in
the place of the F_PRODUCT_ID field.
Enter: &PRODUCT.
Select the boilerplate object.
Select the Rotate tool from the vertical toolbar.
Press [Shift] and click the boilerplate object to rotate it by 90 degrees.
Open the Property Inspector for the boilerplate object and set Vertical
and Horizontal Elasticity to Variable.
Open the Data Model view and ensure that the G_PRODUCT_ID group
contains the PRODUCT column by dragging it in there.
c. Run the paper layout. Save the report as p18q4.jsp.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-73 and/or its affiliates.
2010, Oracle
SQL Star International Limited

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
Introduction
In this practice session, you create a format trigger to conditionally flag one of two
paper layouts for the same data. You also conditionally flag some records in a report by
creating and referencing a report-level (local) PL/SQL function. You then move the
code into a new PL/SQL library and alter the reference to use the library function
instead.
ble
If you have time, restrict the number of records processed in a report by creating yourfera
own group filter. a n s
n -t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
NI T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-74 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 19 (continued)


1. Create a new report, using p19q1.sql.
a. Display the records in two different layouts, showing different columns in
each.
b. Create a Group Above layout using the following columns from the query:
Select Group Above as the report style in the Report Wizard.
Import the SQL Query from file p19q1.sql.
Select customer_id as the group field. Do not display order_status. Select
Labels and other properties as you wish.
Group Column
G_CUSTOMER_ID customer_id
G_ORDER_ID order_id
a ble
f e r
order_date
ans
order_mode n - t r
a no
order_total
h a s
m ) eฺ
o uidfrom the query:
a ilฺc columns
c. Create a Tabular layout using the following G
In the Paper Layout view, select g m
the e n
Report
t Block tool from the vertical
3
toolbar or using Insertit>
@ Block
1Report S tud from the menu.
a v
Select the G_order_id
n group
t h s click the Down button. Display the
iand
followingm arnSelect
fields. u e and other properties as you wish.
sLabels
( ku se to
A R en
Column
K UM lic
order_id
N I T
V order_date
NA order_total

d. Create a user parameter, user_type, that has two possible values: Sales
Representative and Sales Clerk.
In the Object Navigator, select the User Parameters node and click the
Create icon.
Open the Property Inspector for the parameter. Enter USER_TYPE in
the Name property.
Ensure the Datatype property is set to Character.
Create a static list of values containing Sales Representative and
Sales Clerk.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-75 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 19 (continued)


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.
To create a format trigger on the M_G_CUSTOMER_ID_GRPFR
group, select the frame in the first layout, open the Property Inspector
and select the Format Trigger property. An alternative way of creating a
format trigger is to select the group in the Object Navigator, right-click
and select the PL/SQL Editor menu option.
function M_G_CUSTOMER_ID_GRPFRFormatTri return
BOOLEAN is
begin
if :user_type = 'Sales Representative' then
r a ble
return(true);
n s fe
else
- t r a
return(false);
n on
end if;
s a
end; a
) h eฺ
c m
Create a format trigger on the M_G_ORDER_ID_GRPFR1
o uid group frame
in the second layout with the reverse l ฺ
ailogic:t G
function M_G_ID_GRPFR1FormatTri m
g den return BOOLEAN is
@
begin
n i t31 is Stu
if :user_type
r n av e= t'Sales
h Clerk' then

u m a
return(true);
t o us
R (k se
else
M en
A licreturn(false);
K U end if;
I T
A VN end;
Note: You can implement the same logic using the Conditional
N
Formatting property in the Property Inspector for both the group
frames.
To test the result, display the USER_TYPE parameter in the margin of the
report.
Display the Paper Layout view and select Edit Margin. Create a field. In
the Property Inspector, specify the source as USER_TYPE.
Make sure that you can enter a parameter value at run time.
Select Tools > Parameter Form Builder from the menu and select
USER_TYPE from the Parameter list. Click OK to create the Paper
Parameter Form.
Test the report by changing the User Type parameter on the Runtime
Parameter Form.
f. Save the report as p19q1.rdf.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-76 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 19 (continued)


2. Continue with the previous report.
a. Modify the report so that the Tabular (Sales Clerk) layout displays an extra
column that indicates, with an asterisk, those orders that have an order status
of 5.
Create a new Program Unit, by using the Program Units node in the
Object Navigator. Create a function called ASTERISK:
function asterisk(ostatus number)
return varchar2 is
begin
if ostatus = 5 then
return('*');
else
r a ble
return('');
n s fe
end if;
- t r a
end;
n on
In the Data Model view, create a formula column in the
s a detail group
G_ORDER_ID.
) ha
Open the Property Inspector and alter the o m
following
d e ฺproperties for the
c i
column CF_ASTERISK:
m ent ailฺ Gu
g d
Name
i t 3 1@ StuDatatype Width
CF_ASTERISK avn t h is Character` 1
m arn use
Click(kPL/SQL to to open the PL/SQL editor, and call the
u eFormula
A R ensfunction from the formula.
ASTERISK
K lic CF_asteriskFormula return varchar2 is
UM function
N I T begin
V
NA return(asterisk(:order_status));
end;
In the Paper Layout view, increase the width of the R_G_ORDER_ID
repeating frame in the second layout to allow room for another field.
Create a field inside the repeating frame, rename it F_CF_ASTERISK,
and source it to CF_ASTERISK.
b. Remember to change user type to Sales Clerk during testing.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-77 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 19 (continued)


c. Move the function code into a new PL/SQL library named p19lib.pll.
In the Object Navigator, select the PL/SQL Libraries node and click the
Create icon to create a new library.
Open the library node and click and drag the ASTERISK function into
the Program Units node below the library.
Save the PL/SQL library as a file with the name P19LIB.PLL.
Delete the report-level ASTERISK function.
To attach the library to the report, click the Attach Library node in the
Object Navigator. Click the Create button. In the Attach Library dialog
box, use the Browse button to locate the .pll file. Click the Attach button.
In the warning dialog box, click Yes to remove the path for the attached
library.
Recompile the formula column, CF_ASTERISK. r a ble
d. Run the report. n s fe
- t r a
n on
The report that was previously calling the report-level function will now
call the external function.
s a
e. Save the report to p19q2.rdf. a
) h eฺ
3. Continue with the previous report. m
co spacing
a i l
a. Modify the same layout to display additionalฺ G uidbetween every two
records. g m ent
In the Data Model view,i t 3create tud column in the G_ORDER_ID
1@ aSsummary
avn total
group to keep a running
rn use thisof records.
m a
( k se to Function
Name u Source Reset At
A R n
KU lice
M COUNT_ORD COUNT order_id Report

N IT In the Paper Layout view, increase the height of the repeating frame for
V
NA the second layout. Remember to switch Flex mode on, so that you can
increase the repeating frame and the group frame together.
Open the repeating frame Property Inspector and change the Vertical
Elasticity to Variable.
Select the rectangle tool and click and drag an area inside the repeating
frame, below the fields. Make sure the rectangle is transparent: no fill,
no line.
In the Object Navigator, rename the rectangle to B_space and create the
following format trigger:
function B_spaceFormatTrigger return boolean is
begin
if mod(:count_ord,2) = 0 then return(TRUE);
else return(FALSE);
end if;
end;
b. Save the report as p19q3.rdf and close it.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-78 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 19 (continued)


If You Have Time
4. Open report p19q1.rdf.
a. Write your own group filter to restrict the number of customers displayed,
depending on the value of a parameter that you enter at runtime.
Hint: You need to create two parameters, to keep track of how many records
have been processed, compared to the cutoff number of records required.
Make sure that you can enter the cutoff parameter at run time.
In the Object Navigator, open the Data Model node, and select the User
Parameters node select the Create icon to create the first parameter.
Select the Create icon to create a second parameter.
Rename the parameters P_COUNT_CUST and P_CUTOFF.
Give P_COUNT_CUST an initial value of 0.
r a ble
Open the G_CUSTOMER_ID group Property Inspector.
n s fe
Set Filter Type to PL/SQL
- t r a
Select PL/SQL Filter to open the PL/SQL editor. n on
Enter the following code: s a
function G_CUSTOMER_IDGroupFilter a
) h ereturn boolean
m ฺ
is
i l ฺ co uid
begin m a t G
:p_count_cust := @ g de
:p_count_cust n + 1;
3 1
it <= S t u
if :p_count_cust
v n h i s :p_cutoff then
return(TRUE);
a r na se t
elsem
u t o u
( k se
A Rreturn(FALSE);
e n
U M end l ic if;
I T K end;

A VN Display the Paper Parameter Form and include a parameter form field
N PF_cutoff along with descriptive text.
b. Test the report several times by changing the cutoff parameter at run time.
c. Save the report as p19q4.rdf.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-79 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 20


This practice session contains:
• Building a report containing conditional highlighting
• Modifying a Web report with conditional highlighting
• Executing a detail report from a master report
• Writing to a temporary table from a report
Introduction
In this practice session, you highlight values based on conditional PL/SQL code.
You build a master report that enables you to call a detail report and generate a separate
PDF file for each detail report.
If you have time, you add report-level triggers to an existing report to write messages to
a temporary table at various stages of report execution.
a ble
Write PL/SQL functions as local PL/SQL (report-level), and reference the code in asf e r
condition within the relevant object trigger in the report. - t r an
n on
s a
a
) h eฺ
m
co uid
i l ฺ
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
U M l ic
I T K
V N
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-80 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20


1. Open report p9q3.jsp.
a. Display the column CUST_TOTAL in the customer group as red, bold italics
if its value is 10,000 or more.
Hint: Check the Help system for the SRW.SET <attributes> or use
conditional formatting.
Mask Attribute Suggested Value
SRW.SET_TEXT_COLOR Red
SRW.SET_FONT_WEIGHT SRW.BOLD_WEIGHT
SRW.SET_FONT_STYLE SRW.ITALIC_STYLE

You can copy the code from the file p20q1a.txt.


Open the PL/SQL editor and create a function to apply the format fera
ble
attributes. Click the Tools >PL/SQL Editor menu option. In the ans
Program Unit dialog box, click the New button, specify the n -
nametr of the
a
function, select the Function option button and click OK. no
function FIELD_MASK return boolean h a s
is
m ) eฺ
begin o
srw.set_text_color('red'); a ilฺc Guid
g m ent
srw.set_font_weight(srw.bold_weight);
i t 3 1@ Stud
srw.set_font_style(srw.italic_style);
return(TRUE); a v n this
end; m arn use
kupattern
b. Alter(the e to color of those records where the customer total is 5,000
and
A
orRless. ens
U ic the Help system for the SRW.SET <attributes> or use
M Hint:lCheck
IT K
V N conditional formatting.
NA Attribute Suggested Values
Fill pattern Crisscross, sandpaper
Foreground fill color Yellow
Background fill color Green

You can import the file p20q1b.txt.


Open the PL/SQL editor and create a function to apply the format
attributes.
function RECORD_MASK return boolean is
begin
srw.set_foreground_fill_color('yellow');
srw.set_background_fill_color('green');
srw.set_fill_pattern('crisscross');
return(TRUE);
end;
Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-81 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20 (continued)


c. Write the necessary format triggers.
Create a format trigger on the F_CUST_TOTAL field to call the
function.
function F_CUST_TOTALFormatTrigger return
boolean is
begin
if :cust_total >= 10000 then
return(field_mask);
else
return(TRUE);
end if;
end;
r a ble
Create a format trigger on the R_G_CUSTOMER repeating frame tofe
call the function. a n s
n -t r
function R_G_CustomerFormatTrigger return o
boolean is s an
begin ) ha
if :cust_total <= 5000ฺcthen o m ideฺ
return(record_mask); m ail t Gu
else @ g den
i t31 is Stu
returnn(TRUE);
end if;r n av e th
end;ma
u t o us
d. Save k report
(the seas p20q1.jsp.
A R e n
U M Run the
e. l icpaper layout.
T2.K Continue with the same report.
I
A VN a. Run the Web layout for the report. Is there formatting on the CUST_TOTAL
N column?
There is no formatting in the Web layout. The format triggers that you
created in the previous exercise were applied to the paper layout objects
only.
b. Modify the Web source so that the column CUST_TOTAL in the customer
group displays as red, bold italics if its value is 10,000 or more.
Display the Web Source view.
Locate the rw:field tag for F_CUST_TOTAL. Use Edit > Find and
Replace and search for F_CUST_TOTAL.
Add the formatMask attribute to the rw:field tag and set its value to
F_CUST_TOTALFORMATTRIGGER:
<rw:field id="F_Cust_total" src="Cust_total"
nullValue="&nbsp;"
formatTrigger="f_cust_totalformattrigger">
c. Save the report as p20q2.jsp.
d. Run the Web layout to test.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-82 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20 (continued)


3. Execute a detail report from a master report.
a. Create a simple tabular report called MGR_MASTER. The report should
query last names and employee IDs for those employees who are managers.
Display all fields. You can use the query:
SELECT distinct manager.last_name Manager,
manager.employee_id
FROM employees worker, employees manager
WHERE worker.manager_id = manager.employee_id
Create a new tabular report using the Report Wizard. Enter the SQL
query above. Display all fields and select labels and template as desired.
b. Save the report as mgr_master.rdf.
c. Create another tabular report, the detail report, and name it EMP_RPT. The
report should return department number, employee name, and salary for afera
ble
specific manager. The manager_id will be passed to EMP_RPT by ans
MGR_MASTER. n - tr
Create a new tabular report using the Report Wizard. a no the SQL
Define
query: h a s
m ) eฺ
SELECT department_id, o uid salary
first_name ||' '|| last_name a ilฺc Employee,
G
FROM employees g m ent
WHERE manager_idit3=1:mgr_no
@ tud
v
Display all fieldsaand is Sand template as desired.
nselectthlabels
m arnas emp_rpt.rdf
d. Save the report u se and close it.
e. Write(k u t o
the codeeto execute the detail report. For each manager returned,
A R
MGR_MASTER
c e ns should invoke the detail report, EMP_RPT, pass it the
K UM manager’s
li employee_id, and produce a report in PDF format containing
N IT information about the employees working for that manager. Use the
A V manager’s employee_id to create an output filename for each manager:
N
MGR_<employee_id>.PDF.
Hint: You can write the code in the group filter.
Open the Property Inspector for the group G_MANAGER. Set the Filter
Type property to PL/SQL. Select the PL/SQL Filter property to open the
PL/SQL editor. Create the following function:

function G_ManagerGroupFilter return boolean is


begin
SRW.RUN_REPORT ('report=emp_rpt.rdf
batch=yes
destype=file
desformat=PDF
desname='||'MGR_'||:employee_id||'.pdf
mgr_no='||to_char(:employee_id));
return (TRUE);
end;
Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-83 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20 (continued)


f. Compile the PL/SQL code and close the window.
g. Run the paper layout for MGR_MASTER to test. Access the file system and
locate the output for the detail reports. View two or three of the output files.
h. Save mgr_master.rdf and close it.
If You Have Time
4. Open report p10q1.rdf
In this report, you use report triggers to create a temporary table at the start of
report execution, and you insert rows into the table at various stages of the
execution.
a. Write a trigger that creates a temporary table to hold the date and userid each
time the report is run. The table should contain three columns: one date
r a ble
column, one character column of width 10, and one character column ofsfe
width 80. - t r an
CREATE TABLE RUNREPORT n on
s a COMMENTS
(DATE_RUN DATE, USER_RUN VARCHAR2(10), a
) h eฺ
VARCHAR2(80))
m
co Triggers
In the Object Navigator, expand the iReport
a l ฺ G uid node, and double-
click the Before Report PL/SQL g m
icon to n
e t the PL/SQL editor.
open
Create the following function:
i t 3 1@ Stud
function BeforeReport
a v n this return boolean is
begin
a rn use
m
u e to
srw.do_sql('CREATE
k TABLE RUNREPORT
(
A R (DATE_RUN
c e ns DATE, USER_RUN VARCHAR2(10),
M COMMENTS
li
KU return(true);
VARCHAR2(80))');

N IT
V exception
NA when srw.do_sql_failure then null;
end;

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-84 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20 (continued)


b. The same trigger should also insert the current date, userid, and “Starting
Report” into this table.
INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, 'Starting Report')
Hint: Think about how you code the single quotes.
Add the following code:
function BeforeReport return boolean is
begin
srw.do_sql('CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))');
r a ble
srw.do_sql('INSERT INTO RUNREPORT
n s fe
(DATE_RUN, USER_RUN, COMMENTS)
- t r a
VALUES (SYSDATE, USER,
n on
''Starting Report'')');
s a
srw.do_sql(‘COMMIT’); a
) h eฺ
return(TRUE); m
co uid
i l ฺ
mathe ewindow.tG
end;
c. Compile the PL/SQL code and g
close n
d. Save the report as p20q4.jsp.
i t 3 1@ Stud
a
e. Run the paper layout. v n this
f. Using SQL*Plus,
m arn verify
u se that your table exists and was populated
u
(k se
successfully. t o
g. R n
ALog onlictoeSQL*Plus (in Microsoft Windows, select the SQL*Plus icon in the
U M
I T K Oracle group) using the same userid as you used for Reports.

A VN h. Display all records in the RUNREPORT table.


N SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-85 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20 (continued)


i. Try running the report more than once. When you run the report a second
time, the table already exists and Reports Builder raises an exception. Make
the necessary change to your code so that the report runs even when the table
exists.
You need two PL/SQL blocks so that, if the table already exists, the
record is inserted after the exception has been handled.
Add the following code:
function BeforeReport return boolean is
begin
begin
srw.do_sql('CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN
r a ble
VARCHAR2(10),
n s fe
COMMENTS VARCHAR2(80))');
- t r a
exception
n on
when srw.do_sql_failure then
s a
null; a
) h eฺ
end; m
co uid
i l ฺ
ma ent G
begin
@ g
srw.do_sql('INSERT
d INTO RUNREPORT
1 t u
it3 is S USER_RUN, COMMENTS)
(DATE_RUN,
v n
a VALUES th(SYSDATE, USER, ''Starting
r n e
m
Report'')');
u
a
t o us
R (k se srw.do_sql(‘COMMIT’);
M A licen return(TRUE);
K U end;
N I T end;
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-86 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 20 (continued)


j. Write a trigger that inserts a record with the comment “Printing another
page” whenever it begins a new page.
In the Object Navigator, expand the Report Triggers node, and double-
click the Between Pages PL/SQL icon to open the PL/SQL editor.
Or, if the editor is already open, change the Name to Between Pages.
Create the following function.

function BetweenPage return boolean is


begin
srw.do_sql('INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
''Printing another page'')'); r a ble
n s fe
srw.do_sql(‘COMMIT’);
- t r a
return(TRUE);
n on
end;
s a
) h
k. Write a trigger that inserts a record with the comment a “Report completed”
when the report finishes. om uide ฺ
l ฺ c
In the Object Navigator, expand the
m aiReportt GTriggers node and double-
click the After Report PL/SQL @ n
gicon todeopen the PL/SQL editor.
Or, if the editor is already
i 1
t3 open, S tu the Name to After Report.
change
n
av function:
Report the following thi s
m arn use
(
function e to
ku sAfterReport return boolean is
A R en
K U M lic
begin
srw.do_sql('INSERT INTO RUNREPORT
N I T (DATE_RUN, USER_RUN, COMMENTS)
V
NA VALUES (SYSDATE, USER, ''Report Completed'')');
srw.do_sql(‘COMMIT’);
return(TRUE);
end;
l. Save the report as p20q4l.jsp. Generate the output to a PDF file. Verify
the results in SQL*Plus.

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-87 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 21


This practice session contains:
• Constructing a URL to run a report on the Web
• Creating an entry in the key map file
Introduction
You publish your reports using OracleAS Reports Services in the Oracle
Application Server. This practice session consists of paper-based questions to test your
understanding of OracleAS Reports Services.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-88 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 21


1. You created a report called SalaryByDept.jsp that displays the salary
information for a particular department value by accepting a runtime parameter
p_deptno. You need to deploy the report on the Web using a URL.
Component Description
Web server neptune
domain name world
port 8889
alias for the directory path salarydata

The report should be executed by repserver4, the output should be in


HTMLCSS format, and go directly to OracleAS Reports cache. Access the datafe byra
ble
connecting to the Employee database using a username of scott, a password a n s of
tiger, and EmpDB as the database connect string. Construct the URL n r
-tto run the
o
report using the Reports servlet.
s an
http://Computer_Name:port_number/salarydata/
) ha
rwservlet?report=salarybydept.jsp&server=repserver4
c o m ideฺ
&userid=scott/tiger@EmpDB&p_deptno=30
m ailฺ t Gu
&destype=cache&desformat=HTMLCSS
@ g den
2. So that you do not have to enter
i t31suchisa S tuURL each time you run the
long
n
av a ekeythentry in the cgicmd.dat key map file entry
SalaryByDept report, create
r n
u m a
t o us
located under <ORACLE_HOME>\reports\conf.
a. Name(k the key e
salary. Be sure to include the runtime parameter
R n s
U MAsalary: ice report=SalesByDept.jsp
p_deptno
l in the key entry.

I T K server=repserver4

A VN destype=cache desformat=HTMLCSS userid=scott/


N tiger@EmpDB p_deptno=%1
b. Reconstruct the URL to run the report using the key. Pass a value of 30 for
p_deptno.
http://neptune.world.com:8889/salarydata/
rwservlet?salary&30

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-89 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 21


3. In addition to using a URL, what are the other methods for requesting a report?
RWCLIENT command, OracleAS Portal, SRW.RUN_REPORT, and the
Event-Driven Publishing API
4. What is the JSP runtime architecture used for?
The JSP runtime architecture runs the Web layout.
5. Which two facilities can be used to monitor OracleAS Reports Services?
Oracle Enterprise Manager and Reports Queue Manager

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-90 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Overview: Lesson 22


This practice session contains:
• Generating and interpreting report trace information
• Modifying a report to make it more efficient
Introduction
Report performance is always an issue. Reports Builder offers a few tools that allow you
to measure performance. In this practice you will use them and interpret the results.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-91 and/or its affiliates.
2010, Oracle
SQL Star International Limited

Practice Session Solutions: Lesson 22


1. Name four main areas to investigate when tuning reports.
The Data Model, the Paper Layout, Web Layout and JSP report definitions,
and run-time arguments.
2. What is the name of the font mapping file?
uifont.ali
3. Generate and interpret Reports Runtime Trace information.
a. Open report p19q4.rdf. From the menu select Program > Tracing.
b. In the Runtime Trace Settings dialog box specify p19q4.txt as the trace file
and select the All check box under Trace Settings.
c. Select OK to close the dialog box.
d. Run the paper layout. Paginate through the report in the Paper Design view.
e. Open p19q4.txt and look at the results. Where does this report spend
time? r a ble
The time is spent on the layout and formatting of the report. n s fe
- t r a
f. Repeat the same steps for report p22q2b.rdf. Specify p22q2.txt
n on as the
trace file. Compare the result. How do you explain this? a
The statistics for p22q2.rdf also show that time h a sis spend formatting
the report. The figures are a bit higher because m ) of the
e ฺ dynamic
c o i d
customized formatting of the F_ORDER_MODE
m ailฺ t Gu and
F_ORDER_TOTAL fields.@g d e n
There is also a group filter
n i Stu
t31 onisG_ORDER_ID. The predefined ‘Last’
filter is inefficient
n v th all records to be retrieved from the
aas it causes
database.ma r us e
u t o
(k stoeimprove performance.
4. Make a suggestion
a. A R
Open the n p12q1.rdf and generate Reports Trace information. Look
ereport
M l i c
U at the time statistics.
T K
V NI b. Examine the Data Model. What could you possibly do to make the report run
N A faster?
Set the Break Order property for all columns except the NAME column
to None, thus avoiding forcing (unnecessary) extra sorting.
c. Implement your change and regenerate the time statistics. Did things
improve?

Oracle
Unauthorized reproduction Reports Developer
or distribution prohibited.10g: Build Reports
Copyright© A-92 and/or its affiliates.
2010, Oracle
SQL Star International Limited

B
Table Descriptions
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Overall Description
The sample company portrayed by the Oracle Database 10g Sample Schemas operates
worldwide to fill orders for several different products. The company has several divisions:
• The Human Resources division tracks information on the company’s employees and
facilities.
• The Order Entry division tracks product inventories and sales of the company’s products
through various channels.
• The Product Media division maintains descriptions and detailed information on each
product sold by the company.
• The Shipping division manages the shipping of products to customer.
Each of these divisions is represented by a schema. In this course, the user has access to the
objects in all of these schemas.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports B-2


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Overall Description (continued)

HR Human Resources

OE Order Entry

a ble
QS PM s f e r
- t r an
non
Queued Product a
s
Shipping Media ) ha ฺ
l ฺ c om uide
m ai t G
The Oracle Database Sample Schemas are a@ d e n schemas. This set of schemas is
setgof interlinked
aimed at providing a layered approachitto 31complexity:
S tu
• A simple schema (Human n
n
av e HR)
Resources,
s
thi for introducing basic topics.
• A second schema (Order
r s for dealing with matters of intermediate complexity. A
a Entry, uOE)
u m t o
multitude of data
R (ktypes siseavailable in this schema.
• The Online ACatalog c n subschema is a collection of object-relational database objects
e(OC)
U M l i
I T K
built inside the OE schema.
VN• A schema dedicated to multimedia data types (Product Media, PM)
NA • A set of schemas gathered under the main schema name QS (Queued Shipping) to
demonstrate Oracle Advanced Queuing capabilities.

Oracle Reports Developer 10g: Build Reports B-3


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Human Resources (HR)
In the company’s human resource records, each employee has a unique identification number,
e-mail address, job identification number, salary, and manager. Some employees earn a
commission in addition to their salary, which is also tracked. When an employee switches jobs,
the company records the start date and end date of the former job, the job identification number,
and department.
The company also tracks information about jobs within the organization. Each job has an
identification number, job title, and a minimum and maximum salary range for the job. Some
employees have been with the company for a long time and have held different jobs within the
company. When an employee switches jobs, the company records the start date and end date of
the former job, the job identification number, and the department.
The sample company is regionally diverse, so it tracks the locations of not only its warehouses
r a ble
but also of its departments. Each of the company’s employees is assigned to a department.
n s feEach
t r
department is identified by a unique department code and a short name. Each department
- a is
onstreet address,
associated with one location. Each location has a full address that includesnthe
a
postal code, city, state or province, and country code.
h as
) country
For each country where it has facilities, the company records
o mthe
d e ฺ name, currency
symbol, currency name and the region in which the a c
ilฺ resides
county i
u geographically.
m ent G
g
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle Reports Developer 10g: Build Reports B-4


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Human Resources (HR) (continued)

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports B-5


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Human Resources (HR) Row Counts

SQL> select count(*) from countries;


COUNT(*)
----------
25

SQL> select count(*) from departments;


COUNT(*)
----------
27

a ble
SQL> select count(*) from employees;
f e r
COUNT(*)
ans
---------- n - t r
o
107
s an
) ha
SQL> select count(*) from jobs;
c o m ideฺ
COUNT(*) a ilฺ Gu
---------- g m e n t
19
i t 3 1@ Stud
a v n this
SQL> select count(*)
m arnfrom
u e
sjob_history;
COUNT(*) ( ku se to
----------AR en
M
U 10 l i c
I T K
VN
NA SQL> select count(*) from locations;
COUNT(*)
----------
23

SQL> select count(*) from regions;


COUNT(*)
----------
4

Oracle Reports Developer 10g: Build Reports B-6


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Order Entry (OE)
The company sells several categories of products, including computer hardware and software,
music, clothing, and tools. The company maintains product information that includes product
identification numbers, the category into which the product falls, the weight group (for shipping
purposes), the warranty period if applicable, the supplier, the status of the product, a list price, a
minimum price at which a product will be sold, and a URL address for manufacturer
information.
Inventory information is also recorded for all products, including the warehouse where the
product is available and the quantity on hand. Because products are sold worldwide, the
company maintains the names of the products and their descriptions in several different
languages.
The company maintains warehouses in several locations to facilitate filling customer orders. le
Each warehouse has a warehouse identification number, name, and location identification rab
e
number. nsf
t r a
Customer information is tracked in some detail. Each customer is assigned an -
onidentification
number. Customer records include name, street address, city or province, a n
country, phone
numbers (up to five phone numbers for each customer), and postal
s
hacode. Some customers order
through the Internet, so e-mail addresses are also recorded. m )
Because e ofฺlanguage differences
c o i d
among customers, the company records the NLS language
m ailฺ andt G u
territory of each customer. The
company places a credit limit on its customers g
@ to limit the
d e namount they can purchase at one
time. Some customers have account managers,
i t 31 swhom
S tu we monitor. We keep track of a
customer's phone numbers. In this a n hi know how many phone numbers a customer
vday, wetnever
r n e
a trackuofsall of them. Because of the language differences of our
might have, but we try to keep
customers, we identify m to and territory of each customer.
kuthe language
( e
When a customerA c nsorder, the company tracks the date of the order, the mode of the
Rplacesean
order, K UMshippingli mode, total amount of the order, and the sales representative who helped
status,
IT the order. This may be the same individual as the account manager for a customer, it may
place
N
Vbe different, or, in the case of an order over the Internet, the sales representative is not recorded.
NA In addition to the order information, we also track the number of items ordered, the unit price,
and the products ordered.
For each country in which it does business, the company records the country name, currency
symbol, currency name, and the region in which the county resides geographically. This data is
useful for tracking customers living in different geographic regions around the world.
Product Media (PM)
The company stores multimedia and print information about its products in the database.
Examples of such information are:
• Promotional audio and video clips
• Product images and thumbnails for web publishing
• Press release texts
• Print media ads
• Other promotion texts and translations

Oracle Reports Developer 10g: Build Reports B-7


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Order Entry (OE) and Product Media (PM)

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports B-8


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Order Entry (OE) and Product Media (PMP Row Counts
SQL> select count(*) from customers;
COUNT(*)
----------
319

SQL> select count(*) from inventories;


COUNT(*)
----------
1112

SQL> select count(*) from orders;


COUNT(*)
---------- a ble
f e r
105
ans
n - t r
o
an
SQL> select count(*) from order_items;
COUNT(*)
ha s
----------
m ) eฺ
665 ฺc o i d
m ail t Gu
@ g den
SQL> select count(*) from product_descriptions;
COUNT(*)
n i t31 is Stu
----------
r n av e th
8640
u m a
t o us
R (k se
SQL> select
M A count(*)
l i c en from product_information;
K U
COUNT(*)
I T
VN
----------
NA 288

SQL> select count(*) from warehouses;


COUNT(*)
----------
9

SQL> select count(*) from online_media;


COUNT(*)
----------
9

SQL> select count(*) from print_media;


COUNT(*)
----------
4

Oracle Reports Developer 10g: Build Reports B-9


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports B-10


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions
Queued Shipping (QS)
The sample company has decided to test the use of messaging to manage its proposed B2B
applications. The plan calls for a small test that will allow a user from outside the firewall to
place an order and track its status. The order must be booked into the main system. Then,
depending on the location of the customer, the order is routed to the nearest region for shipping.
Eventually, the company intends to expand beyond its current in-house distribution system to a
system that will allow other businesses to provide the shipping. Therefore, the messages sent
between the businesses must also travel over HTTP and be in a self-contained format. XML is
the perfect format for the message, and both the Advanced Queuing Servlet and Oracle Internet
Directory provide the appropriate routing between the queues.
After the orders are either shipped or back ordered, a message needs to be sent back to
appropriate employees to inform them of the order's status and to initiate the billing cycle. Itaisble
f
critical that the message be delivered only once and that there be a system for trackingsand er
reviewing messages to facilitate resolution of any discrepancies with the order. -tra
n
n
no server and a
For the purpose of this test application, the company utilizes a single database
a
single application server. The application provides a mechanismh a
for sexamining the XML
m ) eฺ from outside the
messages as well as looking at the queues. To demonstrate connectivity
o d
a ilฺc service
firewall, both the generation of a new order and customer
G uireporting are performed using
m
g adqueue,
queues. The new order application directly enqueues e t
n while the customer service
@ tu
queries require XML messaging to dequeue
ni t31 a queue.
sS
The users associated with this n
r av e tare:
application hi
• QS (Queue Shipping) a
u m t o us
• QS_ES (Eastern(k Shipping)
A R
• QS_WS (Western e n se
Shipping)
U M(OverseaslicShipping)
I T K
• QS_OS

A VN• QS_CS (Customer


• QS_CB Billing)
(Customer Service)
N
• QS_ADM (Administration), and
• QS_CBADM (Customer Billing Administration)

Oracle Reports Developer 10g: Build Reports B-11


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Table Descriptions

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports B-12


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

C
Creating Web
b le
Layout Templates
sfe
r a
t r an
on -
a n
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating Web Layout Templates
This appendix explains how to create a Web layout template for Oracle Reports Builder.
You can use templates to define common characteristics and objects that you want to apply to
multiple reports. For example, you can define a template that includes the company logo and
sets fonts and colors for selected areas of a report.
To create an Oracle Reports Web Layout template:
1. Create a template file (.tdf file).
2. Create an HTML file that describes the layout.
3. Update the Web Template description file (rwTemplates.xml).
4. Test the new template.
5. Deploy the template in Oracle Reports and Oracle Application Server.
6. Add the template to the template library.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports C-2


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
To create a Web layout template in Oracle Reports, you need three files:
1. A paper layout template (.tdf file) that is used to register the template in reports and
to make the relationship between the HTML and the CSS file in the
rwTemplates.xml file. It can also be used as a paper template.
2. A Web layout template (.html file) that is used to create the layout of the template
(default header and footer, position of the data area)
3. A Cascading Style Sheet (CSS) file that is used to define the HTML font of the different
parts of a report.

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
TDF file i t 3
HTML
1@CSSStud
a v n tfile h is HTML file
r n e
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports C-3


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 1: Create a template file (.tdf)

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
First, create a Reports template file:
i t 3 1@ Stud
1. In Oracle Reports Builder, choose
a v n File t h>isNew > Template.
2. In the Object Navigator, a rnunderuTemplates,
s e your new template name is displayed.
3. Specify a namekfor m to in the Property Inspector, for example MyCompany.
u youretemplate
(
Note: ThisR
A c e ns by Oracle Reports to create the relationship between the HTML
name is used
andU M files. li
CSS
K
4.ITSave the file as MYCOMPANY.tdf in the $ORACLE_HOME/reports/templates/
N
N AV directory.
You have now created a template. You can edit this template for paper reports by using the
Report Wizard.

Oracle Reports Developer 10g: Build Reports C-4


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 2: Create an HTML file that describes the layout
In an HTML editor, such as Macromedia Dreamweaver, create an HTML page that will define
the areas of your Web layout template.
1. Add the JSP header and taglib, then add the rw:report tag to reference the report
environment:

a ble
f e r
2. Put all your generic HTML below the following HTML tags:
ans
n - t r
a no
h a s
m ) eฺ
3. The <rw:style> tag is used to create the link between
l ฺ othe
u id and the CSS that we
c template
i
ma entfile:
created and references into the rwTemplates.xml
g
G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
ARgeneric
4. Put allMyour l i c enHTML, such as the company logo in the <BODY> tag:
K U
I T
VN
NA

5. Specify the <rw:dataArea> tag, where the Wizard will insert the report block:

Oracle Reports Developer 10g: Build Reports C-5


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 2: Create an HTML file that describes the layout (continued)
6. Specify all your generic HTML, such as copyright and contact information before the
</BODY> tag

7. Close the report reference tag

a ble
f e r
8. Save this document in the $ORACLE_HOME/reports/templates/ directory. ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports C-6


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 3: Update the Web layout template description file
The Web layout template description file rwTemplates.xml is located under
$ORACLE_HOME/reports/templates. This file references Oracle Reports templates with
their associated styles.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports C-7


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 3: Update the Web layout template description file (continued)
1. In the rwTemplates.xml file, add a new <webTemplate> tag entry file to register your
new template.
You add the <webTemplate> tag between the <webTemplates> </webTemplates> tags.
This tag associates the paper layout template, Web layout template and CSS files. The
code displays a sample <webTemplate> tag for the MyCompany template.

a ble
f e r
ans
n - t r
a no
Attribute Value
h a s
id references the name of the module in them ) etemplate
Reports ฺ file, for
o
example, mycompany.tdf. Thisilฺiscnot theuname id of the file, but
ma Navigator.
the name that you see in thegObject n t G
cssFile references the namet3
@ tfile
of1the CSS u de
that Report Wizard will place in
n i s S
the <LINK> a
r n v
tag.
e thi
classSet m
references
u t o us id into the current XML file. The classSet
a the classSet
R (k the
makes serelationship between each field type and the CSS Class.
A e n
htmlFile
U ic
M references
l the file name of the HTML template, for example
K
NIT
myCompany.html.
V
NA

Oracle Reports Developer 10g: Build Reports C-8


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 3: Update the Web Layout Template Description File (continued)
2. If you have a specific CSS file with new class names, you need to add a new classSet
entry in the rwTemplates.xml file. The classSet tag contains all the class name (css)
for each field type. You add the <classSet> tag between the <classSets> </classSets> tags.

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
Name Value
i t 3 1@ Stud
TableStyle nclassthname
specifies the
a v is of the <table> tag
ColumnHeader arn theusclass
specifies
m
e name of the <th> tag used for the column header
RowHeader ( e tothe class name of the <th> tag used at the row header in
ku specifies
A c ns reports
R ematrix
K UM
CellText
li
specifies the class name of the <td> tag used for alphanumeric data
I T
VNCellNumber specifies the class name of the <td> tag used for numeric data.
NA CellDate specifies the class name of the <td> tag used for date data
TotalText specifies the class name of the <th> tag used for the summary empty
cells
TotalNumber specifies the class name of the <td> tag used for the summary non
empty cells
GroupAboveHeader specifies the class name of the <th> and <caption> tags used for the
group above section

3. After adding the <webTemplate> and <classSet> entries, save the rwTemplates.xml
file and restart Reports Builder.

Oracle Reports Developer 10g: Build Reports C-9


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 4: Test the new Web layout template
1. Create a new report using the Report Wizard, and choose the TDF file you created, for
example, MyCompany.tdf template.

a ble
f e r
ans
n - t r
a no
h a s
m ) eฺ
o
a ilฺc Guid
g m ent
i t 3 1@ Stud
a v n this
m arn use
u eyoutosee the new report with your template code. The Report
2. When you clickkFinish,
(
R the
Wizard replaces
A e s <rw:style> and <rw:dataArea > tags with the generated code.
nempty
UM li c
IT K
V N
NA

Oracle Reports Developer 10g: Build Reports C-10


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 5: Deploying the new Web layout template
You should configure Reports Builder to make sure that all associated elements such as images
and CSS files are in the correct place on the file system

Location Description
$ORACLE_HOME/reports/docroot/ Default root directory of Oracle
Reports Builder
$ORACLE_HOME/reports/docroot/images Default image directory of Oracle
Reports Builder
$ORACLE_HOME/reports/docroot/css Default CSS directory of Oracle
Reports Builder
While deploying a Web report on the Oracle Application Server, you need to make sure thatraall ble
f e
t r ansserver.
the associated elements such as images and CSS files are in the correct location on the
on -
a n
a s
m ) h eฺ
i l ฺ co uid
g ma ent G
i t 3 1@ Stud
a v n this
m arn use
( ku se to
A R en
K UM lic
N I T
V
NA

Oracle Reports Developer 10g: Build Reports C-11


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited
Creating a Web Layout Template
Step 6: Add the Web Layout Template to the Oracle Reports Template Library
If you want your new template to always display in the Predefined Templates list on the
Template page of the Report Wizard, you can add it Oracle Reports Template Library.
You can register your template file as a predefined template by inserting an entry in the
Oracle Reports preferences file and storing the template and (optional) image in the correct
template directory.
Note: This is an optional step.

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports C-12


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

Glossary

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

A
API (Application Program Interface) Data Model view Displays a structural
A language and message format used by representation of the data in a report.
an application program to communicate The objects do not appear in the report
with the operating system or some other output, but the structure determines the
control program such as a database layout style, and the data objects provide
management system or communications the values that appear in the layout
protocol. objects.

C database (1} A set of dictionary tables


and user tables that are treated as a unit. a ble
check box An interface element,
(2) (Oracle Express) A single file f e r
appearing as a small square, that a user
an s
can toggle on or off. (possibly accompanied by extension
n - t r
a no
files) that contains objects that organize,
store, and manipulate data. In Express,
column (1) A vertical space in a
h a s
examples of such objects are variables,
database table that represents a particular
m ) eฺ
dimensions, formulas, models, and
domain of data. A column has a column o
name (e.g., ENAME) and a specific data a ilฺc Guid
programs.
type (e.g., CHAR). For example, in a g m ent
table of employee information, all of3the
i t uadquery,
1@ Stdata
by
source A source for data returned
including database objects
employees' names would constitutev n one is
h
rna use t
column. A record group column
a
such as tables, views, synonyms,
snapshots, and queries stored as views.
represents a databaseu m column.o
t
(2} A data model
R (k objectscreated
e
A
automatically for e
each
c ncolumn dialog box A partial screen or window
U M l i that prompts you to enter information
IT K
expression in a query's SELECT list, or
necessary to complete an operation.
N created manually to perform summaries,
N AV formulas, or act as a placeholder.
E
CORBA (Common Object Request editor A work area in which you
Broker Architecture) A language- perform a specific set of tasks, such as
independent distributed object model creating a program unit or designing an
specified by the Object Management application.
Group.
EJB (Enterprise Java Beans) In Java,
D a component architecture for the
data model A relational model that development and deployment of object
defines what data should be fetched from oriented, distributed, enterprise-level
the database, what values should be applications.
computed, and how data should be
ordered in a report. Reports Builder enabled An interface element state that
objects that define the data model are means that a menu item, button, and so
queries, groups, columns, parameters, on, can be used in the current context.
and links.

Oracle Reports Developer 10g: Build Reports Glossary-2


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

F Markup Language. A tag-based ASCII


language used to specify the content and
field (1) An interface element in which
links to other documents on Web servers
you enter, edit, or delete data. (2) A
on the Internet. End users with Web
layout object that defines how the data
browsers view HTML documents and
for a specific query column appears.
follow links to display other documents.
foreign key A value or column in one
table that refers to a primary key in HTTP (HyperText Transfer Protocol)
another table. Acronym for HyperText Transfer
Protocol. The protocol used to carry
format mask A setting that defines the Web traffic between a Web browser
computer and the Web server being
appearance of the value of a field. For
example, a format mask is used to accessed.
a ble
specify the display of currency amounts f e r
Hyperlink A reference/link from one
an s
and dates.
document to another document or
n - t r
format trigger A PL/SQL function that a no
another place in the same document. A
allows you to dynamically change the
h a s
Web browser usually displays a
formatting attributes of an object. m ) eฺ
hyperlink in some distinguishing way,
o
formula column A user-created column a ilฺc Guid
such as different color, font, or style.
When users activate hyperlinks by
that gets its data from a PL/SQL g m ent
clicking on them with a mouse, the
t
function or expression, a SQL statement,
i 3 1@ Studbrowser displays the target of the link.
or a combination of these. avn t h is
a rn use I
m toenclose
(ku andscontrol
frame A layout object used to icon A graphic representation of a
other layoutRobjects e the
nand positioning of window or tool.
A
formatting, c e
frequency,
K UMobjects lsimultaneously.
several
i
image A bitmapped object that can be
N IT stored and loaded into an application.
V
NA G The client cannot modify an imported
image.
group (1) In Reports Builder, a data
model object that is created intranet An internal TCP/IP network,
automatically to contain all the columns access to which is restricted (via a
selected by a query, or created by the firewall) to individuals inside the
user to modify the hierarchy of the data company or organization. An intranet
appearing in a report; it is used primarily provides similar services within an
for creating breaks in a report, as well as organization to those provided by the
for resetting computations. (2) An object Internet, but is not necessarily connected
that is composed of several other to the Internet. A common example of an
objects. intranet is when a company sets up one
or more Web servers on an internal
H
network for distribution of information
HTML (Hypertext Markup or applications within the company.
Language) Acronym for Hypertext

Oracle Reports Developer 10g: Build Reports Glossary-3


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

J M
Java A computer language that margin An optional report region that
supports programming for the Internet in appears at the top and bottom of each
the form of platform-independent logical page in a report section: Header,
"applets." Main, and Trailer. The margin may
include any layout object, but typically
JAR Acronym for Java ARchive. A file contains boilerplate and fields for page
used for aggregating many files, such as numbers, page totals, grand totals, and
Java class files, images, and other files current date and time.
into one file.
O
J2EE (Java 2 Platform, Enterprise
Edition) An environment for object (1) An item that can be placed on
a ble
the layout. The following are examples f e r
developing and deploying enterprise
an s
of objects: rectangle, line, ellipse, arc,
applications in Java consisting of a set of
n - t r
polygon, polyline, rounded rectangle,
services, application programming
interfaces, and protocols that provide for a no
freehand, graph, text, symbol, and text
developing multitiered, Web-based a s
field. (2) In an Oracle database, an
h
applications. m ) eฺ
instance of an object type. An object can
o
ilฺc Guid
be a row in an object table, or the portion
a
JDBC (Java Database Connectivity)An g m ent
of a row contained in a column object in
industry standard for database and
i t 3 1@ Stud
a relational table.

a v n a this Object Navigator A hierarchical


Java platform connectivity providing

arn use
call-level API for SQL-based database
browsing and editing interface that
access. m o
R (ku se t enables you to locate and manipulate
A
JSP (JavaServer e n An extension
Page)
c
application objects quickly and easily.
theM
to U li
servlet functionality that enables a Features include:
K
IT simple programmatic interface to Web · A hierarchy represented by
V N pages. JSPs are HTML pages with indentation and expandable nodes.
NA special tags and embedded Java code The top-level nodes show module
that is executed on the Web or types, database objects, and built-in
application server providing dynamic packages, enabling tasks such as
functionality to HTML pages. JSPs are creating, editing, renaming, and
actually compiled into servlets when deleting objects.
first requested and run in the server's · A find field and icons, enabling
JVM. forward and backward searches for
any level of node or for an individual
L item in a node
layout The area of an editor in which
you can create, modify, position, or
delete objects.

Oracle Reports Developer 10g: Build Reports Glossary-4


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

report requests, the secured server, and


· Icons in the horizontal toolbar any OracleAS Reports Services printer
replicating common File menu used to print report output.
functions
OracleAS Reports Services The runtime
Oracle Application Server A strategic environment for Reports Developer
platform for network application applications. OracleAS Reports
deployment. By moving application Services executes, distributes, and
logic to application servers and publishes your reports for enterprise
deploying network clients, organizations wide reporting. Using OracleAS Reports
can realize substantial savings through Services to deploy your reports results in
reduced complexity, better gains of flexibility, time savings, and
manageability, and simplified processing capacity.
a ble
development and deployment. Oracle
f e r
Application Server provides the only P an s
business-critical platform that offers n - t r
easy database Web publishing and
a no
Paper Design view Displays output for
paper reports and allows you to make
complete legacy integration while
h a s
many commonly required, simple
transitioning from traditional client-
m ) eฺ
modifications to the layout, such as
o
server to network application
architectures. ilฺc Guid
spacing, formatting fields,color, and
a
g m ent
editing text, without having to open the
Oracle Developer Suite Combines t31
@ tud Paper Layout view.
n i i s S
n v
leading Oracle application development
a into ae t h Paper Layout view Displays the layout
and business intelligence rtools
a Built uons objects in a paper report and allows you
single, integrated u m
product. t o
(k suchsaseJava and
Internet standards
R
to make many modifications to any
XML,M the i c en a complete and
Asuitelprovides layout object. All layout objects have
K U productive development
highly
properties that you can modify using the

N IT environment for building applications


Property Inspector. The hierarchy of the
V layout objects is determined by the data
NA for Oracle Application Server and the
Oracle database.
model.

Paper Parameter Form view Displays


<Oracle_Home> An alternate name for
the layout of the Parameter Form that, at
the top directory in the Oracle directory
runtime, allows user input of parameter
hierarchy on some directory-based
values in the Runtime Parameter Form.
operating systems. An environment
variable that indicates the root directory
PDF (Portable Document Format) A
of Oracle products.
file format (native for Adobe Acrobat)
for representing documents in a manner
Oracle AS Portal An HTML-based
that is independent of the original
development tool for building scalable,
application software, hardware, and
secure, extensible HTML applications
operating system used to create the
and Web sites. OracleAS Reports
documents. A PDF file can describe
Services uses OracleAS Portal to control
documents containing any combination
end user access to reports published on
the Web by storing information about

Oracle Reports Developer 10g: Build Reports Glossary-5


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

of text, graphics, and images in a device- reports cache A component of OracleAS


independent and resolution independent Reports Services that stores completed
format. jobs

PL/SQL Oracle's proprietary extension REP file A file that contains a single
to the SQL language. Adds procedural report definition in binary format. .REP
and other constructs to SQL that make it files are used solely to run reports; you
suitable for writing applications. cannot edit a .REP file.

Property Inspector Reports Builder (rwbuilder) An Oracle


A window that enables you to view, Reports executable that starts Reports
locate, and set the properties of the Builder to enable report developers to
currently selected object(s) in the Object create and maintain report definitions.
a ble
Navigator, Report Editor, and Template
Reports CGI (rwcgi) An Oracle Reportssf e r
Editor.
executable, also known as the Common
- t r an
Every Reports Builder object such as
Gateway Interface (CGI) n oro n
Reports
query, group, frame, parameter, etc. has a and
Web Cartridge, thatstranslates
associated properties that can be viewed a
) ha J2EE
delivers information between either a
using the Property Inspector. The m ฺ Container for
c o
Web Server or
i d e
Property Inspector features are:
ilฺ OC4J,
example,
a G u and the Reports Server,
expandable and collapsible nodes, in-
place property editing, search features,
m
g enabling
e t
nyou to run a report dynamically
3 @
1 Stu d
from your Web browser.
i t
multi-selection, and complex property
n this
dialogs. a v
a rn use Reports Client (rwclient) An Oracle

kumse to
Q Reports executable that provides a
(
R SELECT command line interface to send a
query AA SQL n statement that
e want to retrieve report to a remote Reports Server.
U M the datalicyou
specifies

N IT K
from one or more tables or views of a Report Editor The Reports Builder
V database. window that provides different views to
NA help you handle the data objects and
R layout objects for Web and paper
RDF file A file that contains a single reports. The views are: Data Model
report definition in binary format. RDF view, Paper Layout view, Paper Design
files are used to both run and edit view, Paper Parameter Form view, and
reports. Web source view.

record One row fetched by a SQL Reports Engine A component of


SELECT statement. OracleAS Reports Services that fetches
data from the data source, formats the
repeating frame A layout object used to report, send output to cache, and notifies
display rows of data that are fetched for the Reports Server that the job is ready.
a group.
Reports Queue Manager (rwrqm)A
Windows utility that maintains
timestamp and status information about

Oracle Reports Developer 10g: Build Reports Glossary-6


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

reports jobs that are managed by the typically to access a database or perform
Reports Server. e-commerce processing. Servlets provide
an alternative to CGI (Common
Reports Runtime (rwrun) An Oracle Gateway Interface) scripts. Because they
Reports executable that runs a report are written in Java, servlets are portable
using the OracleAS Reports Services in- between servers and operating systems.
process server. The Reports Servlet and JSP are
components of OracleAS Reports
Reports Server (rwserver) An Oracle Services that process custom (JSP)
Reports executable that enables running report tags and deliver information
reports on a remote server. A component between the Oracle HTTP Server and the
of OracleAS Reports Services that Reports Server.
processes client requests, including user
a ble
authentication, scheduling, caching, and SQL A standard interface for storing f e r
report distribution. Use rwclient to ans
and retrieving information in a relational
send a report to the Reports Server. n
database. SQL is an acronym for - t r
Structured Query Language.
a no
Reports Servlet (rwservlet) An Oracle a s
SQL file A file that contains a query
h
Reports executable that translates and ) eฺ
stored in text (e.g., ASCII or EBCDIC)
m
o
delivers information between either a
ilฺc Guid
format.
a
Web Server or a J2EE Container for
example, OC4J, and the Reports Server, @g SQL
m escriptn t A file containing SQL
enabling you to run a report dynamically
i t 3 ud that you can run to perform
1 Ststatements
from your Web browser. avn t h is database administration quickly and
m arn use easily. Several SQL scripts are shipped
row One set of field
( k u et
values inoa table; for with Oracle products.
example, the
A c ns table EMP.
Rfieldserepresenting one
U M
employee in thel iexample SQL statement A SQL instruction to

N IT KRuntime Parameter Form A screen or


Oracle. A SELECT statement is one type
of SQL statement.
V
NA window appearing optionally at runtime
in which a user can modify print options style sheet HTML extensions that
and parameters prior to report execution. provide powerful formatting flexibility
in HTML documents. To view an
RTF (Rich Text Format) A Microsoft HTML document that takes advantage of
standard for encoding formatted text and style sheets, display it in a browser that
graphics. supports style sheets.

S syntax The orderly system by which


commands, qualifiers, and parameters
SELECT statement A SQL statement are combined to form valid command
that specifies which rows and columns to strings.
fetch from one or more tables or views.
T
servlet A Java application that runs in a
Web server or application server and table A named collection of related
provides server-side processing, information, stored in a relational

Oracle Reports Developer 10g: Build Reports Glossary-7


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

database or server, in a two-dimensional V


grid that is made up of rows and
columns. view (1) In Reports Builder, a work area
in which you perform a specific set of
tabular A default layout displaying tasks, such as defining a report data
labels at the top of the page and rows of model, layout, or Parameter Form. (2) A
data underneath the labels. virtual table whose rows do not actually
exist in the database, but which is based
template A skeleton definition on a table that is physically stored in the
containing common style and standards, database.
and can include graphics. A template
provides a standard format to enable W
quick and easy development of Web browser A program that end users
a ble
professional standard look-and-feel utilize to read HTML documents and f e r
reports. programs stored on a computer (servicedans
by a Web server). n - t r
Template Editor A work area in which a no
you can define objects and formatting a
Web server A server
h sprocess (HTTP
properties for your templates. It is ) atea ฺWeb site that
daemon) running
m
similar to the Paper Layout view of the sends o
lฺcout Webu id in response to
pages
a i G
Report Editor. You can create, delete,
and modify objects (e.g., page numbers, g n t from remote Web
mHTTPerequests
t 3
text, and graphics) in the margin area.
i 1@ Stud
browsers.

v n this Web source view Displays the HTML /


You cannot create and delete objects in
a
m arn use
the body area, but you can modify the JSP source for a report. You can use this
(ku se t o
properties of body objects in the view to add dynamic content to a Web
A R
Property Inspector.
e n page using the Report Block Wizard and
UAnM li c the Graph Wizard. Experienced Java
IT K
tool iconic button used to create and developers can edit the Web source
V N manipulate objects in an application. directly in this view.
NA tool palette A collection of tools. window A rectangular area of the
desktop that contains an application.
toolbar A collection of iconic buttons Each window has an area where you can
that perform product commands. Usually interact with the application. Windows
aligned horizontally along the top, or can be opened, resized, moved, reduced
vertically down the side of a window. to an icon, or enlarged to fill the entire
desktop.
U
wizards Provide an easy step-by-step
URL (Uniform Resource Locator) A interface for commonly performed tasks.
URL, a form of URI, is a compact string The wizards in Reports Builder are:
representation of the location for a
· Report Wizard: Guides you through
resource that is available through the
the steps to create a basic paper or
Internet. It is also the text string format
Web report. Each page of the wizard
clients use to encode requests to
Oracle Application Server.

Oracle Reports Developer 10g: Build Reports Glossary-8


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

asks you for information to help you X


create your initial report. XML Extensible Markup Language: A
· Data Wizard: Helps you quickly metalanguage using SGML to define and
define or modify a query for a structure data. Reports Builder supports
multiquery data models. XML output to enable Web publishing
· Graph Wizard: Adds a variety of as well as electronic data exchange with
charts and graphs, including true 3- third-party applications. You can also
dimensional graphs. Implemented in use XML to build report definitions that
Reports Builder with the Oracle BI can be merged with other report
graph bean. definitions at run time or can be run
· Report Block Wizard: Enables you to separately.
add data to a static HTML page.
a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Oracle Reports Developer 10g: Build Reports Glossary-9


Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.
SQL Star International Limited

a ble
f e r
ans
n - t r
o
s an
) ha
c o m ideฺ
m ailฺ t Gu
@ g den
n i t31 is Stu
r n av e th
u m a
t o us
R (k se
M A licen
K U
N I T
V
NA

Unauthorized reproduction or distribution prohibited. Copyright© 2010, Oracle and/or its affiliates.

You might also like