You are on page 1of 480

Oracle iDS Reports:

Build Internet Reports

Volume 2 • Student Guide


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

40031GC11
Production 1.1
June 2001
D32797
Author Copyright  Oracle Corporation, 2000, 2001. All rights reserved.

Christian Bauwens This documentation contains proprietary information of Oracle Corporation. It is


provided under a license agreement containing restrictions on use and disclosure
and is also protected by copyright law. Reverse engineering of the software is
Technical Reviewers prohibited. If this documentation is delivered to a U.S. Government Agency of the
Soley Celik Department of Defense, then it is delivered with Restricted Rights and the
following legend is applicable:
Ruth Delaney
Restricted Rights Legend
Laurent Dereac
Use, duplication or disclosure by the Government is subject to restrictions for
Brian Fry commercial computer software and shall be deemed to be Restricted Rights
software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS
Ursula Hovy 252.227-7013, Rights in Technical Data and Computer Software (October 1988).

Andrey Ivkin This material or any portion of it may not be copied in any form or by any means
without the express prior written permission of Oracle Corporation. Any other
Sarah Jones copying is a violation of copyright law and may result in civil and/or criminal
penalties.
Paul Narth
If this documentation is delivered to a U.S. Government Agency not within the
Martin Pamplin Department of Defense, then it is delivered with “Restricted Rights,” as defined in
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Frank Rovitto The information in this document is subject to change without notice. If you find
Raza Siddiqui any problems in the documentation, please report them in writing to Education
Products, Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores,
Hiroyuki Sugiyama CA 94065. Oracle Corporation does not warrant that this document is error-free.

Oracle is a registered trademark and all references to Oracle and Oracle products
Publisher are trademarks or registered trademarks of Oracle Corporation.
Shane Mattimoe All other products or company names are used for identification purposes only
and may be trademarks of their respective owners.
Contents
.....................................................................................................................................................

Contents
Preface
Profile xvii
Related Publications xviii
Typographic Conventions xix

Introduction
Course Objectives I-3
Course Content I-5

Lesson 1: Introduction to Oracle Reports


Overview 1-3
What Is Business Intelligence? 1-5
Enterprise Reporting 1-7
What Is Report Builder? 1-11
Report Builder Components 1-13
Getting Started in the Oracle Reports Interface 1-17
Navigating Around the Oracle Reports Main Menu 1-19
Customizing Your Oracle Reports Session 1-21
Oracle Reports Environment Variables 1-25
Oracle Reports Help Options 1-27
Introducing the Course Application 1-29
Summary 1-31
Practice Session Overview: Lesson 1 1-33
Practice Session: Lesson 1 1-34

Lesson 2: Designing and Running Reports


Overview 2-3
Designing Reports 2-5
Design Considerations 2-9
Retrieving and Sharing Data 2-17
Running a Report 2-19
Viewing the Report Output 2-21
Summary 2-31
Practice Session Overview: Lesson 2 2-33
Practice Session: Lesson 2 2-34

.....................................................................................................................................................
Oracle iDS Reports: Build Internet Reports iii
Contents
.....................................................................................................................................................

Lesson 3: Report Builder Concepts


Overview 3-3
Report Executables 3-5
Report Builder Components 3-9
Object Categories 3-13
Summary 3-23
Practice Session Overview: Lesson 3 3-25
Practice Session: Lesson 3 3-26

Lesson 4: Creating Reports Using the Report Wizard


Overview 4-3
Invoking Report Builder and the Report Wizard 4-5
Creating a Tabular Report Using the Wizard 4-7
Creating Other Report Styles 4-23
Previewing Report Output in a Web Browser 4-33
Web-Enable a Report Using the Web Wizard 4-35
Summary 4-37
Practice Session Overview: Lesson 4 4-39
Practice Session: Lesson 4 4-40

Lesson 5: Enhancing Reports in the Live Previewer


Overview 5-3
What Is the Live Previewer? 5-5
Modifying a Report in the Live Previewer 5-7
Summary 5-21
Practice Session Overview: Lesson 5 5-23
Practice Session: Lesson 5 5-24

Lesson 6: Managing Report Templates


Overview 6-3
Using the Report Templates 6-5
Modifying a Template 6-7

.....................................................................................................................................................
iv Oracle iDS Reports: Build Internet Reports
Contents
.....................................................................................................................................................

Adding Web Links to a Template for Report HTML Output 6-13


Predefining Your Own Templates 6-15
Summary 6-19
Practice Session Overview: Lesson 6 6-21
Practice Session: Lesson 6 6-22

Lesson 7: Report Storage Methods


Overview 7-3
Storage Methods and Requirements 7-5
Documenting Your Reports 7-9
File Portability 7-11
Converting Report Definitions 7-15
Practice Session Overview: Lesson 7 7-18
Practice Session: Lesson 7 7-19

Lesson 8: Enhancing Reports Using the Data Model: Creating Queries


and Groups
Overview 8-3
Describing the Report Data Model 8-5
Modifying Properties of a Query 8-7
Changing the Group Structure 8-13
The Group Hierarchy 8-15
Ordering Data in a Group Hierarchy 8-17
Filtering Data in a Group 8-21
Adding New Data 8-23
Using Ref Cursor Queries 8-27
Oracle8 Objects in Report Builder 8-29
Using Data Links to Structure Data 8-35
Efficiency Issues: Multiple- or Single-Query Hierarchy 8-41
Summary 8-43
Practice Session Overview: Lesson 8 8-45
Practice Session: Lesson 8 8-46

.....................................................................................................................................................
Oracle iDS Reports: Build Internet Reports v
Contents
.....................................................................................................................................................

Lesson 9: Enhancing Reports Using the Data Model: Creating Columns


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

Lesson 10: Enhancing Reports Using the Layout Model


Overview 10-3
Viewing the Layout Model 10-5
Designing Multipanel Reports 10-9
Recognizing Layout Objects 10-13
The Layout Model Layers 10-15
Creating Layout Objects 10-21
The Layout Model Tools 10-23
Report Bursting 10-25
Creating Variable Length Lines 10-31
Interacting with a Report Using a Button 10-33
Creating Explicit Anchors 10-35
Summary 10-39
Practice Session Overview: Lesson 10 10-41
Practice Session: Lesson 10 10-42

Lesson 11: Modifying Common Layout Properties


Overview 11-3
Modifying Layout Object Properties 11-5
Modifying Common Layout Properties 11-7

.....................................................................................................................................................
vi Oracle iDS Reports: Build Internet Reports
Contents
.....................................................................................................................................................

Sizing Objects 11-9


Layout Object Relationships 11-11
Using Format Triggers 11-23
Layout Object Properties for Web Support 11-25
Summary 11-27
Practice Session Overview: Lesson 11 11-29
Practice Session: Lesson 11 11-30

Lesson 12: Modifying Specific Layout Properties


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

Lesson 13: Creating and Using Report Parameters


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

.....................................................................................................................................................
Oracle iDS Reports: Build Internet Reports vii
Contents
.....................................................................................................................................................

Lesson 14: Embedding a Chart in a Report


Overview 14-3
Creating and Embedding a Graphics Chart in a Report 14-5
Embedding an Existing Chart in a Report 14-9
Using a Chart Hyperlink 14-11
Summary 14-13
Practice Session Overview: Lesson 14 14-15
Practice Session: Lesson 14 14-16

Lesson 15: Enhancing Matrix Reports


Overview 15-3
The Matrix Data Model 15-5
The Matrix Layout Model 15-7
Creating Matrix Summaries 15-9
Creating the Simple Matrix Report Manually 15-11
Building a Matrix with Group Report 15-13
Building a Nested Matrix 15-15
Summary 15-23
Practice Session Overview: Lesson 15 15-25
Practice Session: Lesson 15 15-26

Lesson 16: Coding PL/SQL Triggers in Reports


Overview 16-3
Types of Triggers in Reports 16-5
Using Report Triggers 16-7
Using Data Model Triggers 16-11
Using Layout Model Triggers 16-15
Writing Common Code 16-25
Summary 16-27
Practice Session Overview: Lesson 16 16-29
Practice Session: Lesson 16 16-30

.....................................................................................................................................................
viii Oracle iDS Reports: Build Internet Reports
Contents
.....................................................................................................................................................

Lesson 17: Building a Web Report


Overview 17-3
High-Quality Web Publishing 17-5
Report Builder Web Scenarios 17-9
Publishing Web Reports 17-11
Enhancing Reports for the Web 17-15
Summary 17-31
Practice Session Overview: Lesson 17 17-33
Practice Session: Lesson 17 17-34

Lesson 18: Using the Report Builder Built-In Package


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

Lesson 19: Customizing Reports at Run Time


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

.....................................................................................................................................................
Oracle iDS Reports: Build Internet Reports ix
Contents
.....................................................................................................................................................

Lesson 20: Maximizing Performance Using Reports Services


Overview 20-3
Why Use Remote Services? 20-5
Reports Services Web Architecture and Configuration 20-9
Reports Services Clustering 20-13
Making a Request to Run a Report 20-15
Viewing and Scheduling Reports in the Queue Manager 20-27
Summary 20-35
Practice Session Overview: Lesson 20 20-37
Practice Session: Lesson 20 20-38

Lesson 21: Building Reports: Efficiency Guidelines


Overview 21-3
Tuning Oracle Reports 21-5
Different Development and Run-Time Environments 21-19
Developing Reports to Run in Different GUIs 21-21
Building Reports to Run in Different Languages 21-23
Practice Session Overview: Lesson 21 21-28
Practice Session: Lesson 21 21-29

Appendix A: Solutions
Practice Session Overview: Lesson 1 A-2
Practice Session Solutions: Lesson 1 A-3
Practice Session Overview: Lesson 2 A-7
Practice Session Solutions: Lesson 2 A-8
Practice Session Overview: Lesson 3 A-12
Practice Session Solutions: Lesson 3 A-13
Practice Session Overview: Lesson 4 A-15
Practice Session Solutions: Lesson 4 A-16
Practice Session Overview: Lesson 5 A-21
Practice Session Solutions: Lesson 5 A-22
Practice Session Overview: Lesson 6 A-26
Practice Session Solutions: Lesson 6 A-27
Practice Session Overview: Lesson 7 A-30

.....................................................................................................................................................
x Oracle iDS Reports: Build Internet Reports
Contents
.....................................................................................................................................................

Practice Session Solutions: Lesson 7 A-31


Practice Session Overview: Lesson 8 A-33
Practice Session Solutions: Lesson 8 A-34
Practice Session Overview: Lesson 9 A-39
Practice Session Solutions: Lesson 9 A-40
Practice Session Overview: Lesson 10 A-45
Practice Session Solutions: Lesson 10 A-46
Practice Session Overview: Lesson 11 A-52
Practice Session Solutions: Lesson 11 A-53
Practice Session Overview: Lesson 12 A-55
Practice Session Solutions: Lesson 12 A-56
Practice Session Overview: Lesson 13 A-58
Practice Session Solutions: Lesson 13 A-59
Practice Session Overview: Lesson 14 A-62
Practice Session Solutions: Lesson 14 A-63
Practice Session Overview: Lesson 15 A-66
Practice Session Solutions: Lesson 15 A-67
Practice Session Overview: Lesson 16 A-71
Practice Session Solutions: Lesson 16 A-72
Practice Session Overview: Lesson 17 A-77
Practice Session Solutions: Lesson 17 A-78
Practice Session Overview: Lesson 18 A-80
Practice Session Solutions: Lesson 18 A-81
Practice Session Overview: Lesson 19 A-87
Practice Session Solutions: Lesson 19 A-88
Practice Session Overview: Lesson 20 A-90
Practice Session Solutions: Lesson 20 A-91
Practice Session Overview: Lesson 21 A-93
Practice Session Solutions: Lesson 21 A-94

Appendix B: Table Descriptions and Data


Summit Sporting Goods Database Diagram B-2
S_CUSTOMER Description B-3
S_CUSTOMER Data B-4
S_DEPT Description and Data B-8

.....................................................................................................................................................
Oracle iDS Reports: Build Internet Reports xi
Contents
.....................................................................................................................................................

S_EMP Description B-9


S_EMP Data B-10
S_ITEM Description B-13
S_ITEM Data B-14
S_ORD Description and Data B-16
S_PRODUCT Description B-17
S_PRODUCT Data B-18
S_REGION Description and Data B-22
S_TITLE Description and Data B-23
Oracle8 Objects: Types, Tables B-24

Appendix C: Frequently Asked Questions


Frequently Asked Questions C-2
Frequently Asked Questions and Answers C-3

Appendix D: Oracle Rdb Overview


What Is Oracle Rdb? D-2

Appendix E: Introduction to Query Builder


What Is Query Builder? E-3
The Query Builder Window E-7
Building a New Query E-9
Datasource Components E-11
Refining a Query E-13
Viewing and Saving Queries E-17
Including Additional Tables E-19
Relationships E-23
Selecting Rows with Conditions E-29
Operators E-31
Entering Multiple Conditions E-33
Changing Conditions E-35
Defining Columns Using an Expression E-37
Defining Columns Using a Function E-39

.....................................................................................................................................................
xii Oracle iDS Reports: Build Internet Reports
Contents
.....................................................................................................................................................

Appendix F: Object Features in Oracle 8i


Overview F-3
New Oracle8 Datatypes F-5
Creating Oracle8 Objects F-11
Referencing Objects F-19
Displaying Oracle8 Objects in the Object Navigator F-21
Summary F-29

Appendix G: Using the Layout Editor


Overview G-3
Why Use the Layout Editor? G-5
How to Access the Layout Editor G-7
Components of the Layout Editor G-9
Creating and Modifying Objects in the Layout G-11
Formatting Objects in the Layout G-19
Coloring Objects and Text G-21
Importing Images and Drawings G-25
Summary G-27

.....................................................................................................................................................
Oracle iDS Reports: Build Internet Reports xiii
Contents
.....................................................................................................................................................

.....................................................................................................................................................
xiv Oracle iDS Reports: Build Internet Reports
................................
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Design a matrix Data Model
• Design a matrix Layout Model
• Modify a matrix structure
• Create and modify matrix summaries
• Create a matrix with group report
• Create a nested matrix report

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
Matrix or cross product reports show cells of information that relate to values
appearing across the top and down the left side of the report.
In an earlier lesson, you created a matrix report using the Report Wizard. In this
lesson, you modify the Data Model and layout objects to enhance your matrix reports.

Objectives
After completing this lesson, you should be able to do the following:
• Design a matrix Data Model
• Design a matrix Layout Model
• Modify a matrix structure
• Create additional matrix summaries
• Create a matrix with group report
• Create a nested matrix report

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-3
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

The Matrix Data Model

2
4

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Cross product group 3 Cell group


2 Row and column groups 4 Cell column is the source of a
cross product summary that
becomes the cell content

......................................................................................................................................................
15-4 Oracle iDS Reports: Build Internet Reports
The Matrix Data Model
.....................................................................................................................................................

The Matrix Data Model


Introduction
To maintain and enhance the structure of a matrix report, you must understand the
Data Model objects and their interdependency.

What Does the Wizard Create?


The Data Model opposite is the matrix report created in an earlier lesson. It
demonstrates the structure of a simple Matrix report.

Simple Matrix Style The wizard creates three basic data groups:
• One row of record values (Department)
• One column of record values (Job Title)
• One group of cells, where each cell contains data related to each row and column
combination.
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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-5
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

The Matrix Layout Model

1 2 3

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Repeating frame for rows 3 Matrix object, the


(Down direction) intersection of the two
repeating frames
2 Repeating frame for
columns (Across)

......................................................................................................................................................
15-6 Oracle iDS Reports: Build Internet Reports
The Matrix Layout Model
.....................................................................................................................................................

The Matrix Layout Model


Introduction
Although the supplied templates create good-looking, professional report output, they
do not help to explain the 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 layout where each outer
object is slightly larger than its contents.

What Does the Wizard Create?


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

Simple Matrix Style The wizard creates the following objects:


• One repeating frame with print direction of Down to hold the row values
• One repeating frame with print direction of Across to hold the column values
• A field for the summary of the cell values; the source is SumSalary, which resides
in the cross product group
• Fields for the row and column values, as well as for the row, column, and report
summaries if applicable
• A matrix object that corresponds to the cross product group; this object intersects
the row and column repeating frames, and contains the cell field

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-7
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Creating Matrix Summaries

1 2

3
®

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Product Order = G_DEPT 3 Product Order =


G_DEPT G_TITLE
2 Product Order = G_TITLE

......................................................................................................................................................
15-8 Oracle iDS Reports: Build Internet Reports
Creating Matrix Summaries
.....................................................................................................................................................

Creating Matrix Summaries


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

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 Report Builder evaluates the groups in
the cross product for a summary.
Product Order also defines the frequency of a summary, formula, or placeholder
column in a cross product group. That is, the column has one value for each
combination of values in its Product Order groups.
The Product Order list of values provides all possible group combinations.
In the matrix report:
• F_SumSalPerDEPT has one value for each department (G_DEPT).
• F_SumSalPerTITLE has one value for each job title (G_TITLE).
• F_SumSALARY, the matrix cell, has one value for each combination of G_DEPT
and G_TITLE, so the Product Order is G_DEPT G_TITLE.
Source Column Reset At Product Order
F_SumSALPerDEPT G_DEPT G_DEPT
F_Sum_SALPerTITLE G_TITLE G_TITLE
F_SumSALARY G_TITLE G_DEPT G_TITLE

The Reset At option has the same effect as in other report styles. When you create
summaries with the wizard, each summary resets for each occurrence of the group. For
example, the department summary resets for each department. If you want the
summary values to accumulate throughout the report, change Reset At to a higher
level, such as Report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-9
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Creating the Matrix Manually

• Using the Data Wizard:


– Select the Matrix query check box
– Step through the wizard
• Entirely manual:
– Select the SQL query tool
– Create extra groups
– Create the cross product group

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-10 Oracle iDS Reports: Build Internet Reports
Creating the Simple Matrix Report Manually
.....................................................................................................................................................

Creating the Simple Matrix Report Manually


You may want to create the matrix report manually. You can use the Data Wizard or
you could do everything entirely manually.

Using the Data Wizard


1 In the Object Navigator, create a new report and select Build a new report
manually from the dialog box.
2 In the Data Model view, click the Data Wizard button or select Tools—>Data
Wizard.
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 layout.

Building Entirely 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 SQL Query 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 layout.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-11
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

The Matrix with Group Data Model

1
4
5

Copyright  Oracle Corporation, 2000. All rights reserved.

The Matrix with Group Layout

1 2 3 4

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-12 Oracle iDS Reports: Build Internet Reports
Building a Matrix with Group Report
.....................................................................................................................................................

Building a Matrix with Group Report


A matrix with group report consists of a break group that contains a simple matrix
structure. For each break value, different row and column values might apply. In a
single query Data Model, each matrix contains only the applicable rows and columns
for the break value.

The Data Model


The Data Model 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.

The Layout Model


The Matrix with Group style is identical to the matrix style except for the addition of a
repeating frame that surrounds the entire matrix layout and corresponds to the break
group in the Data Model.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-13
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Building a Nested Matrix

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-14 Oracle iDS Reports: Build Internet Reports
Building a Nested Matrix
.....................................................................................................................................................

Building a Nested Matrix


Introduction
The nested matrix style, which you create with the wizard by adding an extra level in
the Rows tab, has some specific features. This section briefly describes the Data
Model and Layout Model, pointing out the differences from the Matrix with Group
style. It also explains how summaries evaluate the extra group level of a nested matrix.

What Is in the Nested Matrix Data Model?


The wizard creates the same objects 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.

Creating the Cross Product Group


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.

How to Re-create 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 Re-create 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.

Differences Between a Nested Matrix and a Matrix with Group


• Matrix with Group Data Model: The cross product group is the child of a parent
break group at a level above and outside the cross product.
• Nested Matrix Data Model: The cross product contains three or more groups, one
or more levels of break group and two dimensional groups to form rows and
columns.
Note: You can mix these styles. That is, you can create a Matrix with Group report
where the matrix has several nested levels within it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-15
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Nested Matrix Layout

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-16 Oracle iDS Reports: Build Internet Reports
Building a Nested Matrix
.....................................................................................................................................................

What Is in the Nested Matrix Layout Model?


The wizard creates the same objects as for a simple matrix structure. It also creates the
following objects:
• One repeating frame for each additional break group, nested within the same
overall matrix structure
• One matrix object for each additional break group
The exact appearance depends on whether the extra level is in the Row or in the
Column tab. The diagram opposite 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 palette
in the Layout Model only.

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

How to Create the Matrix Object


1 Make sure that the two related repeating frames intersect each other correctly.
2 Select both repeating frames [Shift]-Click.
Note: If you do not select both frames, you receive an error message:
REP-3100: Matrix must include at least 1 Down and 1 Across
repeating frame.
3 Select Insert—>Layout Matrix.
4 Move the matrix object back through the layout layers until it is behind the cell
field (Arrange—>Move Backward). This step is not necessary to make the report
run, but it is useful to see the cell field if the matrix has a solid fill.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-17
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Creating Matrix Summaries

F_SumSALARY F_SumSALPerDEPT

F_Sum_REG_NAME

F_SumSALPerTITLE

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-18 Oracle iDS Reports: Build Internet Reports
Building a Nested Matrix
.....................................................................................................................................................

Creating Nested Matrix Summaries


The wizard creates nested summaries in the cross product group.
If you create or alter a nested summary, you must set the Product Order correctly.
Always test the report output very carefully to ensure that the summaries are
displaying exactly the value you expect.

Setting the Product Order


The Product Order indicates the way in which Report Builder evaluates a summary.
Product Order also determines the position (frequency) of the summary if you use the
reenterable wizard.
The diagram opposite shows three summary fields created by the wizard:
• F_SumSALPerTITLE: Total salary for each column of job title. Displayed once
for each title.
• F_SumSALPerDEPT: Total salary for each department row nested within a
specific region row. Displayed once for each combination of region/department.
• F_SumSALARY: The cell value. Displayed once for each combination of region/
department/title.
Field Name Reset At Product Order
F_SumSALPerTITLE G_TITLE G_TITLE
F_SumSALPerDEPT G_DEPT_NAM G_DEPT_NAME
E
F_SumSALARY G_DEPT_NAM G_REG_NAME G_TITLE
E G_DEPT_NAME

The diagram also shows a fourth summary, F_Sum_REG_NAME, which you might
want to create yourself to produce a subtotal for each region.
1 Create another summary in the cross product group.
2 Create a layout field and place it as shown in the diagram, in the
R_G_REG_NAME repeating frame (use the Object Navigator to identify it). The
following table shows the property settings.
Field Name Reset At Product Order
F_Sum_REG_NAME G_REG_NAME G_REG_NAME

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-19
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Displaying Zeros

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-20 Oracle iDS Reports: Build Internet Reports
Building a Nested Matrix
.....................................................................................................................................................

Displaying Zeros in Cells with No Value


The field that displays each cell of the matrix is sourced to a summary column, such as
SumSalary.
If there is no value for a particular row/column combination, the summary column is
null and therefore the cell is displayed as a blank field.
You can very simply change the blank to zero or any default value you choose.
To display zeros, open the property palette for either the cell field or the SumSalary
summary column and set the Value if Null property to zero.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-21
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Summary

• Create matrix reports with the wizard


• Consider creating or modifying a template with
extra spacing
• Data and layout reflect cross product structure
• Matrix-specific:
– Cross product group
– Product Order property
– Matrix layout object

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-22 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
Letting the Wizard and Template Work for You
Use the wizard to create your matrix, even if you need to modify it later. Allowing the
wizard to create the initial Layout Model 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
Layout Model.
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 Layout Model 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
• Layout Model: Matrix object

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-23
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Practice 15 Overview

• 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 columns per page
• Displaying more meaningful column information
and rotating the text

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-24 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 15
.....................................................................................................................................................

Practice Session Overview: Lesson 15


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
external 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 iDS Reports: Build Internet Reports 15-25
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

Practice Session: Lesson 15


1 Open report p4q6.rdf.
aUse the Report Wizard to apply a template file to the report. The file
corpmat.tdf should be located in your working directory. The new
template gives you spaces between the layout objects to make it easier to see
the different objects in the Layout editor.
b How many repeating frames do you have?
c Change the properties of the cell object to display zero for a null value.
d Run and test the report.
e Close the report without saving it.
2 Create a new report, importing the external query p4q6.sql from your working
directory.
a Select the following settings:
Report Style Matrix
Query (Import file p4q6.sql)
Matrix Row Fields Level 1 - Month
Level 2 - Name
Matrix Column Fields Product_id
Matrix Cell Fields Sum of total_value
Matrix Totals Sum of the cell field

......................................................................................................................................................
15-26 Oracle iDS Reports: Build Internet Reports
Practice Session: Lesson 15
.....................................................................................................................................................

b Change the labels and widths for the following fields:


Field Label Width
NAME Customer 10
PRODUCT_ID Product 5
MONTH Month 4
SUMTOTALVALUE Total 5
All Summaries Total: 5

Use corpmat.tdf as the template.


c
d Save the report as p15q2.rdf. Run the report on the Web.
e Which summaries were created?
f Use the Data Model editor to create summaries for each month and for the
level month and product.
g Use the Layout editor to create the fields. You will have to expand the
appropriate repeating frame.
h Run and test the report using the Live Previewer.
i Save the report as p15q2.rdf. Do not close it.
3 Continue with the report from the previous exercise.
a Add zeros for null values in the cells.
b Make sure that the report shows only three product columns on each page.
c Format all numeric data to be right aligned.
d Add commas and two decimal places where appropriate.
e Run and test the report using the Live Previewer.
f Save the report as p15q3.rdf and close it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 15-27
Lesson 15: Enhancing Matrix Reports
.....................................................................................................................................................

If You Have Time


4 Open the report as p15q3.rdf.
a Make the necessary changes in the Data Model editor to include the product
name.
b In the Layout Model editor, 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 Save the report as p15q4.rdf and close it.
d Run and test the report on the Web using a format of PDF or HTMLCSS.

......................................................................................................................................................
15-28 Oracle iDS Reports: Build Internet Reports
................................
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Describe the different types of triggers
• Describe sample uses of triggers
• Write and reference common code
• Create a PL/SQL library

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
This lesson identifies different trigger types and creates conditional trigger code to
control report output. It also explains how to improve productivity and maintenance by
sharing and reusing commonly referenced code.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the different types of triggers
• Describe sample uses of the different types of triggers
• Write and reference common code
• Create and reference a PL/SQL library

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-3
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Types of Triggers in Reports

• Report:
– Five triggers
– Report Triggers node in Object Navigator
• Data Model:
– Formula (column)
– Filter (group)
– Parameter validation
• Layout:
Format trigger on most objects

Copyright  Oracle Corporation, 2000. All rights reserved.

Trigger Code

Parameter
Boolean:
true
boolean false

Column
Character
Number
Number
Date

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-4 Oracle iDS Reports: Build Internet Reports
Types of Triggers in Reports
.....................................................................................................................................................

Types of Triggers in Reports


Introduction
You can code PL/SQL in a variety of triggers in a report to provide conditional or
additional processing at run time. This lesson discusses examples of each type of PL/
SQL trigger.

The Three Trigger Types


• 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.
• 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 palette 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 layout objects (excluding anchors). Each trigger fires
as the layout object is processed.
– Access format triggers in the property palette of a layout object.
Note: Report Builder does not allow data manipulation language (DML)
commands—INSERT, DELETE, UPDATE—in layout format triggers.

Trigger Code
When you create a trigger such as a report trigger or a PL/SQL formula, the Program
Unit editor supplies a template for the function block, giving the basic syntax that you
require.
You can change the name of the function.
The value that you return must match the return data type in the function declaration.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-5
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Using Report Triggers

Before
Parameter F
Form

1 2 If readonly=yes 3

F
If > 1 page
After Between After
Before page1 page2
Parameter Pages Report
Report
Form
F F

Copyright  Oracle Corporation, 2000. All rights reserved.

1 If After Parameter Form returns FALSE, the cursor returns to the


run-time parameter form. If the run-time parameter form is not
displayed, control returns to the calling program.
2 If READONLY=Yes, Report Builder implicitly sets the read-only
transaction (SET TRANSACTION READONLY) after the Before
Report Trigger fires.
3 If READONLY=Yes, Report Builder implicitly ends the
read-only transaction (COMMIT) after the final page and before
the After Report Trigger fires.

......................................................................................................................................................
16-6 Oracle iDS Reports: Build Internet Reports
Using Report Triggers
.....................................................................................................................................................

Using Report Triggers


Introduction
Report triggers enable you to execute PL/SQL functions at specific times during the
execution and formatting of your report. These triggers enable you to:
• Customize the formatting of your report
• Perform initialization tasks
• Access the database
Report triggers must return a boolean value—true or false.

Accessing the Report Triggers


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 line),
parameter form is suppressed 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, or
parameter form is suppressed user-entered); create temporary
tables; insert into tables to be
queried
Before Report Before a report executes; after Carry out initialization
queries are parsed, but before procedures
records are fetched
Between Pages Before each page is formatted, Carry out customized page
except the first page; in formatting; insert or update
Previewer, fires only once for values in tables
each page, even if you revisit the
page
After Report After you exit the Previewer, or Clean up initial processing, such
after report output is sent to its as deleting temporary tables
destination; fires on success only

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-7
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Using Report Triggers


• After Parameter Form
– Example: Build dynamic WHERE clause
FUNCTION AfterPForm RETURN BOOLEAN IS
BEGIN
IF :p_customer IS NULL THEN
:p_where_clause := ’ ’;
ELSE
:p_where_clause := ’where id >= :p_customer’;
END IF;
RETURN(TRUE);
END;

• Query syntax:
SELECT
SELECT ID,
ID, NAME
NAME
FROM
FROM CUSTOMER
CUSTOMER
&p_where_clause
ORDER
ORDER BY
BY NAME
NAME
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-8 Oracle iDS Reports: Build Internet Reports
Using Report Triggers
.....................................................................................................................................................

Creating a Dynamic WHERE Clause


Use the After Parameter Form report trigger to build a dynamic WHERE clause
depending on the value of a bind parameter that the user enters at run time.
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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-9
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Using Data Model Triggers

• Group Filter
– Restrict records in a group
– Perform PL/SQL for each record
FUNCTION G_empGroupFilter RETURN BOOLEAN IS
BEGIN
IF :name = ’Operations’ AND :salary > 3000 THEN
RETURN(my_function);
ELSE
RETURN(TRUE);
END IF;
END;

• PL/SQL filters result in all records being fetched


®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-10 Oracle iDS Reports: Build Internet Reports
Using Data Model Triggers
.....................................................................................................................................................

Using Data Model Triggers


Introduction
This section gives examples of:
• Using a PL/SQL group filter
• Validating a parameter value

Using a PL/SQL Group Filter


Use a group filter when you want to do the following:
• 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.
Report 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.

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 palette for the G_emp group.
2 Change Group Filter to PL/SQL.
The PL/SQL Filter property appears.
3 Select the PL/SQL Filter property to open the PL/SQL editor.
4 Enter the code. This filter code must return a boolean value of true or false.
Note: It is more efficient to use a WHERE clause in a query when possible. You
cannot use a WHERE clause in this case, because you want to process all records and
call the function for some.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-11
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Using Data Model Triggers

Parameter Validation
• Example: Do not allow report output to be sent
directly to a printer
FUNCTION DESTYPEValidTrigger RETURN BOOLEAN IS
BEGIN
IF :DESTYPE = ’Printer’ THEN
RETURN(FALSE);
ELSE
RETURN(TRUE);
END IF;
END;

• You cannot reassign values to parameters or


columns in this trigger
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-12 Oracle iDS Reports: Build Internet Reports
Using Data Model Triggers
.....................................................................................................................................................

Validating a Parameter Value


Both system parameters and user parameters have a Validation Trigger property in
which you can write a PL/SQL function to validate the value of the parameter.
The trigger code must return a boolean 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.

Example To prevent report output from being sent directly to a printer, test the value
of the DESTYPE system parameter.
1 Open the property palette for the DESTYPE parameter.
2 Select Validation Trigger to open the PL/SQL editor.
3 Enter the code and make sure that the value Printer has an initial capital.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-13
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Using Layout Triggers

Format triggers:
• Exist on most layout objects
• Can suppress an entire layout section (master
group frame): No records fetched
• Can suppress the display of individual records
(repeating frame): All records fetched

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-14 Oracle iDS Reports: Build Internet Reports
Using Layout Model Triggers
.....................................................................................................................................................

Using Layout Model Triggers


Introduction
Most layout objects contain a format trigger; it is one of the common properties of a
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 Layout for a Query


Because Report Builder 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.

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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-15
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Displaying a Text String in Place of


Column Headings

Dept: 10
Dept: f_deptno
Name Salary

Name Salary
No employees in
1 this department
Dept: 40
No employees in
this department

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Boilerplate text: Position behind column heading frame, or


position below and create collapsible anchor to column heading
2 Column heading frame does not display; suppressed by format
trigger

......................................................................................................................................................
16-16 Oracle iDS Reports: Build Internet Reports
Using Layout Model Triggers
.....................................................................................................................................................

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

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);
end if;
end;
5 Either code the reverse logic in the format trigger of the boilerplate text item
created in step 2 or ensure that the column heading frame has a solid fill.
Note: You should code format triggers at the highest possible level of the layout
hierarchy. The format trigger on the column headings frame suppresses all objects
enclosed by the frame. Do not duplicate code unnecessarily by coding the same trigger
on all individual objects in the frame; this can cause increased processing and
maintenance overheads.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-17
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Dynamically Altering the Display of


Records

Employee Details
Employee Details
Ngao 08-MAR-90 2500
f_name f_date f_salary Biri 07-APR-91 1100
Magee Employee 1000
14-MAY-90 Details
f_name f_date
Ngao 08-MAR-90
Biri 07-APR-91
2 Magee 14-MAY-90

1 3

Copyright  Oracle Corporation, 2000. All rights reserved.

1 One repeating frame is positioned behind the other or positioned


below with collapsing anchor
2 Report output run by payment clerks
3 Report output run by other employees

......................................................................................................................................................
16-18 Oracle iDS Reports: Build Internet Reports
Using Layout Model Triggers
.....................................................................................................................................................

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

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);
else
return(false);
end if;
end;
Note: User_type can be a column or parameter that is initialized at run time.
4 Either code the reverse logic on the other repeating frame or ensure that the top
repeating frame (containing salary) has a solid fill.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-19
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Dynamically Hiding Fields

Employee Details
Employee Details
Ngao 08-MAR-90 2500 1
f_name f_date f_salary
Biri 07-APR-91 1100
Magee Employee 1000
14-MAY-90 Details

Ngao 08-MAR-90
Biri 07-APR-91
Magee14-MAY-90

2
®

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Report for payment clerks shows all fields


2 Report for other employees shows gap where salary is hidden

......................................................................................................................................................
16-20 Oracle iDS Reports: Build Internet Reports
Using Layout Model Triggers
.....................................................................................................................................................

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 iDS Reports: Build Internet Reports 16-21
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Inserting Spacing Between Groups of


Records

f_1 f_2 f_3

1 2

3 4

FUNCTION
FUNCTION spacing
spacing RETURN
RETURN BOOLEAN
BOOLEAN IS
IS
BEGIN
BEGIN
IF
IF MOD(:count_column,
MOD(:count_column, 3)
3) == 00 THEN
THEN
RETURN(TRUE);
RETURN(TRUE);
ELSE
ELSE
RETURN(FALSE);
RETURN(FALSE);
END
END IF;
IF;
END;
END;
®

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Transparent rectangle 3 Summary column name


(created in Data Model)
2 Repeating frame, Vertical 4 Format trigger on
Elasticity = Variable transparent rectangle

......................................................................................................................................................
16-22 Oracle iDS Reports: Build Internet Reports
Using Layout Model Triggers
.....................................................................................................................................................

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

Example
1 Create a transparent rectangle inside the repeating frame to increase spacing
conditionally at run time.
2 In the repeating frame property palette, 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 opposite page.
Note: You can vary the number of records in each group dynamically at run time by
creating a parameter.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-23
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Writing Common Code

At Report level:
• Object Navigator, Program Units
• Menu: Program—>PL/SQL Editor
In a library:
• Object Navigator, PL/SQL Library
• File—>New: Create new library
• File—>Open: Add to existing library
• Attach library to report

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-24 Oracle iDS Reports: Build Internet Reports
Writing Common Code
.....................................................................................................................................................

Writing Common Code


Introduction
If you use the same program unit in several places in a report, or in multiple reports,
consider writing the code once as a report-level program unit, or in a PL/SQL library,
and then call the program unit when you require it in your PL/SQL trigger code; this
enables you to maintain the code in one place.
Even if you do not use the code many times, consider writing anything other than very
simple PL/SQL blocks at report level to simplify maintenance.
Remember that you can also code stored procedures and functions in the database; you
must decide whether server-side or client-side 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.

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 or more report definitions, which enables you to reference the same code in
multiple reports.
To attach a library to a report, open the report definition, select the Attached Libraries
node in the Object Navigator, and add each library that you need in the report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-25
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Summary

Trigger types:
Report, Data Model, Layout
Examples:
• Building a dynamic WHERE clause
• Validating a parameter value
• Dynamically altering record display
• Suppressing null fields
Common code:
• Report-level program units
• PL/SQL libraries
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-26 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
Using PL/SQL Triggers
Select the most applicable type of trigger for your requirement.
Report-level triggers fire once for each of the five events during the report execution.
Data Model triggers can affect which records are processed and how they are
processed.
Layout triggers affect the way in which objects are formatted.

Writing Common Code


Use report-level program units or PL/SQL libraries for common code requirements to
improve productivity and maintenance.

Objects That Must Return a Value


The following table is a reminder of the Report Builder triggers that must always
return a value, and the values that are acceptable.
Trigger Type Valid Values Result if False
Report trigger True, False Abort execution
Group filter True, False Do not process record
Validation trigger True, False Return to parameter form
Format trigger True, False Do not format object
PL/SQL Formula (col- Computation: Character, N/A
umn) Number, Date

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-27
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Practice 16 Overview

• Creating a format trigger to display different


layouts conditionally
• Creating and using a report-level PL/SQL function
• Creating and using an external PL/SQL library
• Creating a PL/SQL group filter

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
16-28 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 16
.....................................................................................................................................................

Practice Session Overview: Lesson 16


This practice session contains:
• Creating a format trigger to display different layouts conditionally
• Creating and using a report-level PL/SQL function
• Creating and using an external PL/SQL library
• Creating a PL/SQL group filter

Introduction
In this practice session, you create a format trigger, or use conditional formatting to
display one of two layouts for the same data, depending on a parameter value at run
time. 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 iDS Reports: Build Internet Reports 16-29
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

Practice Session: Lesson 16


1 Create a new report, using p16q1.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 CUSTOMER_ID
G_ID ID
DATE_ORDERED
DATE_SHIPPED
PAYMENT_TYPE
TOTAL

c Create a Tabular layout using the following columns from the query:
Column
ID
DATE_ORDERED
DATE_SHIPPED
TOTAL

d Make sure that only the Group Above layout is displayed when you Select a
destination of Screen, and only the Tabular layout is displayed when you select
a destination of Preview.
To test the result, display the DESTYPE parameter in the report.
Make sure that you can enter a parameter value at run time.
Hint: As an alternative to coding format triggers, you can also use conditional
formatting.
e Save the report as p16q1.rdf.

......................................................................................................................................................
16-30 Oracle iDS Reports: Build Internet Reports
Practice Session: Lesson 16
.....................................................................................................................................................

2 Continue with the previous report.


Modify the report so that the Tabular (Preview) layout displays an extra
a
column that indicates, with an asterisk, those orders that were shipped more
than 15 days after the order date.
b Remember to change destination to Preview during testing.
c Move the function code into a new PL/SQL library named p16lib.pll.
d Call the external function from your report, instead of calling the report-level
function.
e Save the report to p16q2.rdf. Test it using the Live Previewer.
3 Continue with the previous report.
a Modify the same layout to display additional spacing between every two
records.
b Save the report as p16q3.rdf and close it.

If You Have Time


4 Open report p16q1.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 run time.
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.
b Save the report as p16q4.rdf. Test the report several times by changing the
cutoff parameter at runtime.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 16-31
Lesson 16: Coding PL/SQL Triggers in Reports
.....................................................................................................................................................

......................................................................................................................................................
16-32 Oracle iDS Reports: Build Internet Reports
................................
Lesson 17: Building a Web Report
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Discuss Web output formats and features
• Describe static and dynamic Web reporting
• Enhance a report for the Web
• Publish a report on the Web

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
The Web has become the quickest and easiest way to provide information within
business organizations. In this lesson, you take a report and give it a complete
makeover to turn it into a rich Web report.

Objectives
After completing this lesson, you should be able to do the following:
• Name output formats and features used in Web reports
• Differentiate between static and dynamic Web reporting
• Enhance a report for the Web
• Publish a report on the Web

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-3
Lesson 17: Building a Web Report
.....................................................................................................................................................

High-Quality Web Reporting

•• HTML
HTML
•• PDF
PDF
•• HTMLCSS
HTMLCSS
•• Page
Page Streaming
• XML

®
®

17-3 Copyright  Oracle


Copyright  Oracle Corporation,
Corporation, 2000.
2000. All
All rights
rights reserved.
reserved.

......................................................................................................................................................
17-4 Oracle iDS Reports: Build Internet Reports
High-Quality Web Publishing
.....................................................................................................................................................

High-Quality Web Publishing


Introduction
Oracle Reports enables you to generate report output in virtually any Web format you
prefer: HTML, HTML with style sheets (HTMLCSS), XML, Portable Document
Format (PDF), and Extensible Markup Language (XML). All these formats are
generated from the same report definition and you can choose your preferred format at
run time.
Report Builder provides a Web preview feature that immediately shows you what the
report will look like in HTML or PDF format as you are editing the report. You can
choose to preview only the current page or all the pages of the report.

HTML Output
Without knowing anything about HTML tags, you can easily create HTML output
from your report. Simply select the HTML output format at run time and it will be
generated for you. You can also customize your HTML code by using Report Escapes
and Web Settings properties.

PDF Output
Oracle Reports has a PDF generator built into it. Simply select PDF output at run time.
As with HTML, PDF files have the capability to launch other applications. One key
usage of this feature is to drill down to another dynamically generated document.

Style Sheet Support


Without style sheet extensions, HTML documents display only basic text formats and
imported images. HTMLCSS documents can include any font size or style,
overlapping objects, lines and rectangles of any color or width, precise object
positioning, pagination, inline image maps. All text is fully searchable and fewer
images have to be downloaded.

HTML Page Streaming


HTML page streaming enables you to display individual pages for your HTML or
HTMLCSS report output without having to download the entire report. From the first
page of the report, you can jump to any page in the rest of the report. For maximum
flexibility, the navigation controls for page streaming are written in JavaScript.

XML Output
XML produces tag-delimited output that defines structured information. It may be
used for exchanging electronic data as well as for publishing via the Web.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-5
Lesson 17: Building a Web Report
.....................................................................................................................................................

High-Quality Web Reporting

• Bookmarks
• Hyperlinks
• Chart Hyperlinks
• Images as URLs
• JavaScript
• Java applet

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-6 Oracle iDS Reports: Build Internet Reports
High-Quality Web Publishing
.....................................................................................................................................................

Bookmarks
Bookmarks provide a hyperlinked table of contents that enable you to easily navigate
to specific parts of the report that pertain to them. They are of the most useful
navigational tools for HTML and PDF output formats. Bookmarks defined in Report
Builder can incorporate data from the database (for example, column values) as well
as static text. The Web Wizard automatically generates bookmarks for you. You can
also manually specify them for any layout object in your report.

Hyperlinks
Like bookmarks, hyperlinks allow you to quickly jump to related information. You
can use them to drill down to more detailed information or call drill-down reports.
Hyperlinks can incorporate data from the database as well as static text. You can
define hyperlinks and hyperlink targets for any layout object in your report.

Chart Hyperlinks
Chart hyperlinks enable you to click a chart value in HTML or PDF output formats to
access more detailed information about that value, or drill down to another report with
that value.

Images as URLs
You can reference image resources as URLs for HTML output. You can define
boilerplate link file objects, columns, and fields as references to image URLs. The
images are displayed when you format a report for HTML output.

JavaScript
JavaScript is a powerful browser scripting language. It is common to find Web pages
with some sort of JavaScript embedded in the page to perform conditional logic or
event trapping.

Java Applets
Java applets are platform-independent programs written in the Java language. They
can be dynamically imported into Web pages or applications as needed. They also
differ from JavaScript in that they can be entire fully funtional applications.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-7
Lesson 17: Building a Web Report
.....................................................................................................................................................

Web Scenarios

• Web Wizard
• Static
• Dynamic

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-8 Oracle iDS Reports: Build Internet Reports
Report Builder Web Scenarios
.....................................................................................................................................................

Report Builder Web Scenarios


The Report Builder Web architecture provides a flexible way to publish information
on the Web. One method of Web publishing is to generate static output and make the
files available to the users. For other reporting needs, dynamic Web reports may be
required.

The Web Wizard


The Web Wizard enables you to quickly and easily add Web functionality to a report.
You should use the Web Wizard to add the basic Web functionality to a report. The
wizard contains a number of pages that let you specify:
• Header and footer HTML files to be added
• Bookmarks to be added
• The type of output format to be generated
• Whether to generate the output immediately

Static Web Reporting


Once you generate the Web output using the Web Wizard, all you have to do is place
the files on a server and link them to a Web page to make them accessible to the users.
If the ouput only needs to be generated once, the Web Wizard may be all you need.
Static Web reporting is also useful in cases where a report is published at regular time
intervals (for example, weekly or quarterly) and reports from previous time periods
remain available indefinitely. Oracle Reports supports static Web reporting with its
Web Wizard, Report Editor, and the Reports Server.

Dynamic Web Reporting


For dynamic Web reporting, you can use the Reports Server in conjunction with the
Reports Web Cartridge or Web CGI. When you click a link, the URL is processed by
the Reports Web Cartridge or Web CGI, and a job request is sent to the Reports
Server. The Reports Server then sends the job to a run-time engine for execution.
When the report output is ready, it can be served back to the Web browser by the Web
server.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-9
Lesson 17: Building a Web Report
.....................................................................................................................................................

Publishing Web Reports

• Full URL request


http://vesuvius_serv/your-cgi-bin/rwcgi.exe?
report=emp_dept.rdf desformat=html destype=
cache server=repsrv60 &<dept_param>

• Key map file (cgicmd.dat,owscmd.dat)


emp_rep1:
emp_rep1: report=emp_dept.rdf
report=emp_dept.rdf desformat=html
desformat=html
destype=cache
destype=cache server=repsrv60 dept_param=%1
server=repsrv60 dept_param=%1

Copyright  Oracle Corporation, 2000. All rights reserved.

"".

......................................................................................................................................................
17-10 Oracle iDS Reports: Build Internet Reports
Publishing Web Reports
.....................................................................................................................................................

Publishing Web Reports


Building the Report
1 Ensure there is a reports source directory to save the reports on the machine where
your Reports Server is located. (The directory can be set in the SOURCE
parameter of the Reports Server configuration file, or in the registry using the
REPORTS60_PATH environment variable).
2 Build the report, and enhance it with bookmarks or hyperlinks where necessary.
3 Save the report as a .rdf or .rep file and copy the report definition to the
reports source directory.
4 Make the report available to the users by providing the URL syntax.

Specifying a Report Request From a Web Browser


You can provide the user with the URL syntax needed to make the report request. The
URL syntax can be presented in two ways, fully or partially.
• Full URL request that generally looks like the following example:
http://vesuvius_serv/your-cgi-bin/rwcgi60.exe?
report=emp_dept.rdf+desformat=html+destype=cache+
server=repsrv60+dept_param=10
In the example, the first line contains the Web server hostname (vesuvius_serv)
and the virtual directory (our-cgi-bin) that contains the CGI executable
(rwcgi60.exe) to be called. The rest of the URL contains arguments to the CGI
program to run the report, such as the module name, destination format, destination
type, the Reports Server hostname, and a value for a run-time parameter.
• Partial URL request using the key mapping file
As you can see from the example above, the URL can become quite long. To get
around this problem, the key map file can be used (cgicmd.dat for Reports Web
CGI, owscmd.dat for the Report Web Cartridge implementation). It holds all the
command lines and a single keyword to refer to each command line. By default, the
key mapping file is located in the <oracle_home>/report60/server
directory.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-11
Lesson 17: Building a Web Report
.....................................................................................................................................................

Publishing Web Reports

• Partial URL request with key mapping


http://vesuvius_serv/your-cgi-bin/rwcgi60.exe?
http://vesuvius_serv/your-cgi-bin/rwcgi60.exe?
emp_rep+10&<dept_param>
emp_rep+10&<dept_param>

• URL as a hyperlink
<A
<A HREF="http://vesuvius_serv/your-cgi-bin/
HREF="http://vesuvius_serv/your-cgi-bin/
rwcgi60.exe?key1>
rwcgi60.exe?key1>
My_report>
My_report> </A>
</A>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-12 Oracle iDS Reports: Build Internet Reports
Publishing Web Reports
.....................................................................................................................................................

Specifying a Report Request From a Web Browser (continued)


For the example above, the map file entry may look like the following:
emp_rep1: report=emp_dept desformat=html destype=cache
server=repsrv60 dept_param=%1
The URL now becomes much more manageable:
http://vesuvius_serv/your-cgi-bin/rwcgi60.exe?emp_rep1+10
You can also add the URL syntax to a Web page as a hyperlink. All the users then
have to do is click the link to run the report. To add the URL to a Web page as a
hyperlink, the syntax looks similar to the following:
<A HREF="http://vesuvius_serv/your-cgi-bin/rwcgi60.exe?key1>
My_report> </A>

Scheduling Reports to Run Automatically


You can automate the report’s execution by using the Reports Server Queue Manager
and schedule the report, regenerating the HTML or PDF output each time.
If you publish your reports on a Portal site as a Portal component, you can schedule
report requests to run automatically and push the result to the site. In this case you also
have the option to retain older outputs of the report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-13
Lesson 17: Building a Web Report
.....................................................................................................................................................

Enhancing Reports for the Web

• Adding bookmarks
• Adding animated GIFs (GIF89a)
• Drilling down between Web reports
• Adding chart hyperlink
• Customizing Page-on-Demand
• Adding JavaScript
• Adding Java applets

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-14 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Enhancing Reports for the Web


Now that you have covered the prerequisites, you will take a look at enhancing a
report for the Web and subsequently publishing it.

The Scenario
You will build a Group Above report that shows order information for each customer,
and then add the following Web features to it:
• Bookmarks
• Drill-down to a detail item report
• Chart hyperlink
• Page streaming
• HTML header
• HTML page separator
• Animated GIF
• Hyperlinks and hyperlink destinations
• JavaScript
• Java applet

The Data for the Report


The query for the master report is:
SELECT c.name,c.city,c.state,c.zip,c.comments,c.credit_rating,
o.id,o.date_ordered,o.date_shipped,
i.product_id,i.price,i.quantity,i.price *i.quantity
item_tot
FROM s_customer c,s_ord o,s_item
WHERE c.id = s.customer_id
AND o.id = i.ord_id
ORDER BY c.name
For the detail report you drill down to, the query is:
SELECT id,name,short_desc
FROM s_product
WHERE id = :par_prodid
ORDER BY id

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-15
Lesson 17: Building a Web Report
.....................................................................................................................................................

Bookmarks

• Prevent “information overload”


• Quick navigation
• Can be set using:
– Field property
– PL/SQL

Copyright  Oracle Corporation, 2000. All rights reserved.

Animated GIFs

Use Link tool and specify URL

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-16 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Creating the Bookmarks


It would greatly benefit the report users if they were able to navigate not only on a
page-by-page basis, but be able to jump to a particular customer’s data. You achieve
this by setting the Bookmark property for the customer name field. Setting bookmarks
causes a frame to appear along the left side of the report output with the data that has
been bookmarked.
The property may be set to a column value (for example, &<name>), in which case
just the data will appear. Alternatively, the property may be set to a value in the form
x#y, where x is an outline number and y is a column value. In this case, the bookmarks
will be rendered with indentation. The outline number that is required needs to be
incremented. The best way to achieve this is to create a summary column in the Data
Model in the same group as the data column you want to bookmark. This summary
column should be defined to count on the column that you want to bookmark and reset
at Report level. The resulting bookmark property would look as follows:
&<cs_name>.#&<name> (where cs_name is the summary column, and name is the
actual column).
In the report, the Web Wizard helps to create the bookmark. The Web Wizard
examines the report definition and recognizes that you are breaking by customer and
then by order. It then offers the name and ordid fields as possible bookmark columns.
In this report you pick the customer name field to serve as a bookmark.

Adding Animated GIFS


A common component in a Web page is the animated GIF file—also known as a
GIF89a image. These are a set of gif images put together in a sequence. They are eye-
catching and generally enhance the appearance of a page. An animated GIF can be
added to the report using the Link file tool. The source of the link file is of the type
Image URL, and the source file name then becomes the URL to the animated GIF.
The screenshot on the opposite page shows that the animated GIF oraani.gif is
located on the Web server specified by the P_image_locn user-defined parameter.
When the report is run on the Web, it will be fetched and put into space reserved for it
by the white box for the link file.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-17
Lesson 17: Building a Web Report
.....................................................................................................................................................

Drill-Down Reporting

• Use parameters in
detail report query
• In master report,
hyperlink to detail
and pass parameter

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-18 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Implementing Drill-Down Web Reports


Drill-down behavior is perhaps the most common requirement of Web reporting. The
customary way of achieving this is by means of a hyperlink. For the report you want to
drill down for a particular order and find out more about the products ordered.
The first thing to do is build the detail report itself. The query to use is listed on a
previous page. It is important to realize that the query must have a parameter, as you
only want detailed information for a particular product ID.
Once the report is written, you create a key mapping file entry such as:
det_prod: report=h:\apps\prod server=repserv60 desformat=html
destype=cache par_prodid=%1
You can now run this report on the Web by entering a URL such as:
http://vesuvius_serv/our-cgi-bin/rwcgi60.exe?
det_prod+100871
By changing the last argument in the URL, the request will be dynamic. Open the
property palette for the PRODID field in the master report and set the Hyperlink
property :
/our-cgi-bin/rwcgi60.exe?det_prod+&<prodid>
It is not necessary to embed the host name, as you are calling this URL from another
URL. When the browser sees this virtual URL for a hyperlink, it appends the current
host.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-19
Lesson 17: Building a Web Report
.....................................................................................................................................................

HTML Header

<html>
<head>
<title>
A simple HTML example
</head>
</title
<body>
...
</body>
</html>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-20 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Implementing Chart Hyperlinking and Drill-Down


Often it is easier to understand a chart than a table of data. The report has a pie chart in
the Header section where each slice represents the quantity of each product sold.
Oracle Reports supports adding a hyperlink to charts that are embedded within a
report. More specifically, the hyperlink can be different for each chart section. This
allows the report user to click a pie slice and drill down to another report to see
detailed information for a particular product.
The report containing the detailed chart must be created first and must be available on
the Reports Server. The detail report has the chart in the Header section. You now set
the chart hyperlink property for the master chart as you did before using the
ampersand notation:
/our-cgi-bin/rwcgi60.exe?det_prod+&<prodid>

Adding an HTML Header


You will include an HTML file header to the report. This will add a title to your
HTML output. The HTML report header page contains the information in the
<HEAD> tag of the HTML output.
You open the property palette of the report and, under the Report Escapes node, set the
Before Report Type property to File. Next you set the Before Report Value property to
header.htm.

Changing the Page Separator


When you view the HTML output in your browser, you will notice a gray line
separating each "page" of your output. This page separator can easily be removed.
Simply remove the After Page Value property in the property palette of the report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-21
Lesson 17: Building a Web Report
.....................................................................................................................................................

Page Streaming

• Reports Server feature


• Generates report as multiple pages on the server,
then downloads the first page plus an HTML
navigation toolbar to the client

• Customizable

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-22 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Adding Hyperlink Destinations and Hyperlinks


You may want to add hyperlinks so that you can click text or images to access a
destination such as external URLs or documents, or a specific destination within the
report. Creating hyperlinks is a two-step process in which you first create the
hyperlink destination or target, and then the hyperlink itself. You will add a
destination within the report and an external destination
In the Layout Model view, locate the date field in the Margin and set the Hyperlink
Destination property to rpt_top. Next create a text object and enter Back to Top. Using
the property palette you set the Hyperlink property to #rpt_top.
In the Layout Model view, locate the newsanchor image, and set the Hyperlink
property to http://www.cnn.com. You also want text to pop up when you drag
your mouse over the image object, so you set the Display Name (HTML) property to
Late breaking news from CNN.

Adding Page Streaming


HTML page streaming or page-on-demand is a feature of the Reports Server. It
enables you to display individual pages in your Web browser without having to
download the entire report. When you run a report on the Web using the Reports
Server, the first page plus a navigation toolbar are sent back to the browser. The page-
on-demand feature can be switched on by simply adding the "pagestream=yes"
argument to the URL or the map file entry.
The code behind this feature can be found in the report-level Page Navigation Control
Value property. You modify the code for the page-on-demand toolbar to display the
total number of pages by adding the following line of code:
<td> of &TotalPages

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-23
Lesson 17: Building a Web Report
.....................................................................................................................................................

JavaScript

• Browser-side scripting language, for example, trap


events (such as mouse, button-click), show alerts,
and so on.
• How?
Add functions to BEFORE REPORT VALUE. Call as
a regular hyperlink:

javascript:showmyalert(’have
javascript:showmyalert(’have aa nice
nice day’)
day’)

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-24 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Adding JavaScript
JavaScript is a powerful browser-side scripting language that you can use for things
such as conditional logic, event trapping, and so on. You will use JavaScript to display
an alert.
First you need to write the JavaScript code and embed it in the Web page.
Traditionally this is embedded at the top of the page. You do this by means of the
Before Report Value report property and set it to:
<HTML>
<HEAD>
<SCRIPT LANGUAGE = "JavaScript">
function showmyalert(themessage)
{alert(themessage);}
</SCRIPT>
</HEAD>
<body dir=&Direction bgcolor="ffffff">
When you run the report this code will be at the top of the report. It calls the JavaScript
function "alert," which pops up a dialog box with user defined text. You call the
JavaScript code from a hyperlink on the customer name field as listed below:
javascript:showmyalert(’Credit Rating: $&<credit_rating>’)

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-25
Lesson 17: Building a Web Report
.....................................................................................................................................................

Java Applet

• Use formula columns (PL/SQL functions) to


produce APPLET tag
• Use Contains HTML property
• Use &ObjectWidth and &ObjectHeight to correctly
size object
• <APPLET CODEBASE="/webcomponents/"
• CODE="TextScrollerApplet.class"
• WIDTH=&objectwidth HEIGHT=&objectheight>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-26 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Adding Java Applets


Java applets are browser-side compiled programs written in the Java language. They
are different from JavaScript and can be entire applications in themselves. The
example shows how to make the customer comment scroll across the screen.
The first thing you need to do is to embed the Java applet in the HTML layout. You do
this by defining a formula column in the Data Model in the g_customer group. Then
you add the following HTML code in the PL/SQL Formula property:
function CF_Japplet_textFormula return Char is
begin
return(’
<APPLET CODEBASE="/demo/"
CODE="Ticker.class"
WIDTH=&objectwidth
HEIGHT=&objectheight>
<PARAM NAME=message VALUE="||:comments||">
<PARAM NAME=textColor VALUE="black">
<PARAM NAME=backgroundColor VALUE="white">
</APPLET>
’);
END;
This function constructs the required HTML string to invoke the applet. The argument
/demo/ is the virtual directory containing the applet, :comments is the bind variable for
the database customer comment field, and the reserved keywords &objectwidth and
&objectheight relate to the size of the screen field we use for the applet to appear in.
You now need to tell Oracle Reports where to display the applet. You do this by
creating a field in the Layout editor and you source it to the formula column you
defined earlier. Because its source contains HTML tags, you need to set the Contains
HTML Tags property to Yes.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-27
Lesson 17: Building a Web Report
.....................................................................................................................................................

Publishing the Report

• Use Web Previewer for reality checks


• Create a map file entry
• Specify the URL

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-28 Oracle iDS Reports: Build Internet Reports
Enhancing Reports for the Web
.....................................................................................................................................................

Publishing the Report


You now have a fully functional Web report with quite a few features that improve its
functionality. All you have to do now is publish the report on the Web.
You create the following map file entry:
key_cus_ord: report=cus_ord desformat=html destype=cache
server=repsrv60 %PT
The URL now becomes:
http://vesuvius_serv/our-cgi-bin/rwcgi60.exe?key_cus_ord

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-29
Lesson 17: Building a Web Report
.....................................................................................................................................................

Summary

• Web report features


• Static versus dynamic Web reporting
• Key map file
• Publishing the report

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-30 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
• Web report features
– Style sheet support
– HTML page streaming
– Hyperlinks
– Bookmarks
– JavaScript
– Java applets
• Static versus Dynamic Web reporting
• Key map file
• Publishing a report

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-31
Lesson 17: Building a Web Report
.....................................................................................................................................................

Practice 17 Overview

• Web report features


• Enhancing a report for the Web
• Publishing a report on the Web

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-32 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 17
.....................................................................................................................................................

Practice Session Overview: Lesson 17


This practice session contains:
• Modifying an existing report, enhancing it for the Web
• Publishing the report on the Web

Introduction
If you use the Web Wizard and change some properties, you can easily prepare a
report for the Web. You will open an existing report and add: bookmarks, hyperlinks,
pagestreaming, animated gifs, and JavaScript.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 17-33
Lesson 17: Building a Web Report
.....................................................................................................................................................

Practice Session: Lesson 17


1 Open your bowser and run web_sol.rdf. The report contains: bookmarks,
hyperlinks, pagestreaming, HTML header, drill down, and JavaScript.
2 Start Report Builder and open web_it.rdf. Your task is to add the Web features
listed above. Save and test your report frequently.
3 Ensure that only two sales representatives print on each page and that the records
print with some space between them.
4 Add bookmarks for the LAST_NAME field.
5 Create a hyperlink to www.oracle.com . Add pop-up text.
a Import oracle.gif and place it in the upper right corner of the
M_G_ID_GRPFR group frame.
b Set the necessary properties for the hyperlink and the pop-up text.
6 Create an internal hyperlink for quick navigation to the top of the report.
a Use the date field in the M_G_ID_GRPFR frame as the hyperlink destination.
b Create boilerplate text inside the R_G_ID repeating frame.
c Set the hyperlink.
7 Add pagestreaming to the report.
8 Add webhead.htm as the report header.
9 Provide drill down reporting to web_drill.rdf. This should be triggered by
the F_NAME field. Don’t forget you need to pass the customer name as a
parameter in the URL.
10 Show the customer credit rating in an alert. This should be triggered by the F_ID1
field. Use the following line of JavaScript:
javascript: showmyalert(’Credit Rating: &<credit_rating>’)
Note: The function itself is part of the HTML report header file.
11 Save the report as p17q1.rdf and run the report in your browser. Test every
Web feature you added.

......................................................................................................................................................
17-34 Oracle iDS Reports: Build Internet Reports
................................
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Describe the package contents
• Output messages at run time
• Execute a drill-down report
• Create and populate temporary tables
• Modify visual attributes dynamically

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
This lesson provides examples of the contents and use of the Report Builder built-in
package. The package contains program units that you can reference in your
PL/SQL code.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the contents of the Report Builder built-in package
• Output messages at run time
• Execute a drill-down report
• Create and populate temporary tables within a report
• Modify visual attributes dynamically at run time

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-3
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Contents of the SRW Package

SRW.SET_BOOKMARK SRW.DO_SQL
SRW.SET_ATTR SRW.RUN_REPORT

SRW.REFERENCE SRW.MESSAGE
SRW.USER_EXIT SRW.TRACE
SRW.SET_MAXROW SRW.PROGRAM_ABORT

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-4 Oracle iDS Reports: Build Internet Reports
Contents of the Report Builder Built-in Package
.....................................................................................................................................................

Contents of the Report Builder Built-in Package


Introduction
The Report Builder built-in package, known as the SRW package, contains
procedures, functions, and exceptions that can help you to do the following:
• Control report execution
• Output messages at run time
• Initialize layout fields
• Perform DDL statements (create or drop temporary tables)
• Call user exits
• 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
PL/SQL area of a report, such as a layout format trigger or a report-level trigger.

Rules
• You can only call the contents of the SRW package from within Report Builder.
Other tools, such as Form Builder, do not recognize this package.
• You must always reference an SRW procedure, function, or exception by
preceding it with the package name, SRW; for example, SRW.MESSAGE or
SRW.DO_SQL.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-5
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Outputting Messages
Warning
WHEN
WHEN <exception>
<exception> THEN
THEN
SRW.MESSAGE(999,
SRW.MESSAGE(999,
’Warning:
’Warning: report
report continues
continues’);
’);

Error
WHEN
WHEN <exception>
<exception> THEN
THEN
SRW.MESSAGE(999,
SRW.MESSAGE(999,
’Error:
’Error: report
report terminated
terminated’);
’);
RAISE SRW.PROGRAM_ABORT;
Exceptions
SRW.INTEGER_ERROR
SRW.INTEGER_ERROR
SRW.NULL_ARGUMENTS
SRW.NULL_ARGUMENTS
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-6 Oracle iDS Reports: Build Internet Reports
Outputting Messages
.....................................................................................................................................................

Outputting Messages
Introduction
The SRW.MESSAGE packaged procedure displays a message with a code and text
string, which you specify. The message is displayed in the following format:
MSG-code: text
The message is displayed in a small dialog box. The user must acknowledge the
message before continuing.

Message Code and Text


You can enter a code number from zero up to ten digits. If you enter a number of fewer
than five digits, the code is displayed with leading zeros.
You can enter a text string to a maximum of 190 characters, excluding the code
number. You can embed extra spaces to display your message neatly in the message
dialog box. Reports does not suppress extra spaces in the message text.

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 Report Builder gives if
you abort a report. Your own error message augments the existing messages.

Causes of Exceptions
Exception Name Cause
SRW.INTEGER_ERROR You entered a code that is not a numeric integer.
SRW.NULL_ARGUMENTS You omitted the code number or text message or
both.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-7
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Executing a Report
1 BLOGGS.LIS 2
xxx xxxxxxx
BLOGGS xxx xxxxxxx

SMITH
SMITH.LIS
JONES
yyy yyyyyyy
yyy yyyyyyy

JONES.LIS

zzz zzzzzzz
zzz zzzzzzz
SRW.RUN_REPORT

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Output from master output


2 Output from detailed report

......................................................................................................................................................
18-8 Oracle iDS Reports: Build Internet Reports
Executing a Nested Report
.....................................................................................................................................................

Executing a Nested Report


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

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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-9
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Executing a Report
Example
SRW.RUN_REPORT
(’Report=EMPS
DESTYPE=FILE
DESNAME=’||:LAST_NAME||’.LIS
BATCH=YES
MGRNO=’||TO_CHAR(:ID));

Exceptions
SRW.RUN_REPORT_FAILURE
SRW.RUN_REPORT_FAILURE
SRW.RUN_REPORT_BATCHNO
SRW.RUN_REPORT_BATCHNO

Function
SRW.GETERR_RUN
SRW.GETERR_RUN
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-10 Oracle iDS Reports: Build Internet Reports
Executing a Nested Report
.....................................................................................................................................................

Example Function Code


FUNCTION MGR_REP RETURN BOOLEAN IS
BEGIN
SRW.RUN_REPORT
(’REPORT=EMPS
DESTYPE=FILE
DESNAME=’||:LAST_NAME||’.LIS
BATCH=YES
MGRNO=’||TO_CHAR(: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 ID to
restrict the EMPS query.

Causes of Exceptions
Report 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


If the detail report fails during execution, you can display information about the cause
by using the SRW.GETERR_RUN function.
Assign the function to a local PL/SQL character variable, which you display using the
SRW.MESSAGE procedure.
...
msg char(150);
...
EXCEPTION
WHEN SRW.RUN_REPORT_FAILURE THEN
msg := SRW.GETERR_RUN;
SRW.MESSAGE (100, msg);
...

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-11
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Executing a Drill-Down Report

1 2

41 Details 42
xxxxxxxxx
xxxxxxxxx
42 Details xxxxxxxxx
SRW.RUN_REPORT xxxxxxxxx

43 Details

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Output from master output


2 Output from detailed report

......................................................................................................................................................
18-12 Oracle iDS Reports: Build Internet Reports
Executing a Nested Report
.....................................................................................................................................................

Calling a Drill-Down Report


You can call the SRW.RUN_REPORT procedure from a button in your master report
and display the detail report in a second previewer window on the screen.

How to Create a Drill-Down Report


1 Create a button in the master report within the repeating frame.
2 Display the button property palette. Under the Button Behavior node, change the
Type property to PL/SQL, and then select the PL/SQL Trigger property to display
the Program Unit editor.
3 Enter the function as described in the previous example. Do not include the
BATCH parameter, because you want to display the detail report interactively in a
second previewer.
4 Compile and close the Program Unit editor.
5 Run the master report.
For reports that you send to a file, do not include the pathname when coding the
DESNAME parameter. Allow the REPORTS60_PATH variable to search the correct
path for the report.

Testing Drill-Down Reports During Development


To test a drill-down report, use the Reports Runtime. Remember that buttons are not
active in the Report Builder Live Previewer.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-13
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Restricting Data

Before Report trigger


SRW.SET_MAXROW(’Q_EMP’,3);

Q_EMP
ID LAST_NAME

1 BLOGGS
G_EMP
2 SMITH
3 JONES
ID
LAST_NAME

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-14 Oracle iDS Reports: Build Internet Reports
Restricting Data
.....................................................................................................................................................

Restricting Data
Introduction
Use SRW.SET_MAXROW to restrict the maximum number of records you want to
retrieve for a specified query. Report 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 Report Builder from retrieving any
records from the database.

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);
EXCEPTION
WHEN SRW.MAXROW_UNSET THEN
SRW.MESSAGE (100,
’Data was fetched before SRW.MAXROW was called’);
RAISE SRW.PROGRAM_ABORT;
WHEN SRW.MAXROW_INERR THEN
SRW.MESSAGE(200, ’Contact someone clever!’);
RAISE SRW.PROGRAM_ABORT;
END;
You must set SRW.SET_MAXROW in the Before Report trigger; that is, after the
query has been parsed but before it has been executed. If you call it after the Before
Report trigger, Report Builder raises the SRW.MAXROW_UNSET exception.
If you handle SRW.MAXROW_INERR, always raise SRW.PROGRAM_ABORT,
because your report has an internal problem and you cannot guarantee the outcome.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-15
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Initializing Fields

Output: logical page


no. = 2
Layout editor

Page: F_NEWPAGE Page: 5

FUNCTION
FUNCTION F_LOGICAL_PAGEFormatTrigger
F_LOGICAL_PAGEFormatTrigger
RETURN
RETURN BOOLEAN
BOOLEAN IS
IS
my_page
my_page number;
number;
BEGIN
BEGIN
SRW.GET_PAGE_NUM(my_page);
SRW.GET_PAGE_NUM(my_page); 2
SRW.SET_FIELD_NUM(0,my_page+3);
SRW.SET_FIELD_NUM(0,my_page+3);
RETURN(TRUE);
RETURN(TRUE);
END;
END;
®

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Create format trigger on F_NEWPAGE field


2 Set field value to my_page+3

......................................................................................................................................................
18-16 Oracle iDS Reports: Build Internet Reports
Initializing Fields
.....................................................................................................................................................

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-95’)
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;
Report Builder ignores the code and does not raise an error.

Why Use SRW.SET_FIELD?


You might want 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
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
opposite.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-17
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Performing DDL Statements

Example
SRW.DO_SQL(’CREATE TABLE SRW_LOG
(RPT_NAME VARCHAR2(40),
REC_NUM NUMBER,
MSG_TEXT VARCHAR2(80))’ );

SRW.DO_SQL(’INSERT INTO SRW_LOG


(RPT_NAME, REC_NUM, MSG_TEXT)
VALUES
(’’PAY_REPORT’’, TO_CHAR(:ID),
:LAST_NAME||’’PAY REPORT RUN’’) ’);

Exception
SRW.DO_SQL_FAILURE
SRW.DO_SQL_FAILURE
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-18 Oracle iDS Reports: Build Internet Reports
Performing DDL Statements
.....................................................................................................................................................

Performing DDL Statements


Introduction
The SRW.DO_SQL packaged procedure executes any specified SQL statement from
within Report Builder.

Why Use SRW.DO_SQL?


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.

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 Report Builder
parses its queries. Therefore, you must create this table in the Before Parameter Form
or After Parameter Form report trigger.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-19
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Setting Format Attributes

Borderwidth
Tuesday, 01 Sep
Fill pattern
Format mask

Printer tray control

Car Policy Define a bookmark

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-20 Oracle iDS Reports: Build Internet Reports
Setting Format Attributes
.....................................................................................................................................................

Setting Format Attributes


Introduction
The SRW.SET_<attributes> packaged procedures apply specified format attributes to
the current layout object: frame, repeating frame, field, or boilerplate object.

Why Use a Format Attribute?


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

Coding a Format Attribute


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 iDS Reports: Build Internet Reports 18-21
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Setting Format Attributes

Visual attributes
SRW.SET_FILL_PATTERN(
SRW.SET_FILL_PATTERN(’solid
’solid’);
’);
SRW.SET_BORDER_WIDTH(250);
SRW.SET_BORDER_WIDTH(250);
SRW.SET_FORMAT_MASK(’Day,
SRW.SET_FORMAT_MASK( ’Day, Month
Month yyyy
yyyy’);
’);

Printer tray control


SRW.SET_PRINTER_TRAY(
SRW.SET_PRINTER_TRAY(’letterhead
’letterhead’);
’);

Defining a bookmark
SRW.SET_BOOKMARK(
SRW.SET_BOOKMARK(’Car
’Car Policy
Policy’);
’);
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-22 Oracle iDS Reports: Build Internet Reports
Setting Format Attributes
.....................................................................................................................................................

’Example
Conditionally set the following attributes if salary equals 2000:
Attribute Value
Background fill color Dark yellow
Fill pattern Sandpaper
Font style Italic
Font face Helvetica
Font weight Extra bold
Text color Dark blue

FUNCTION SAL_MASK RETURN BOOLEAN IS


BEGIN
IF :SALARY > 2000 THEN
SRW.SET_BACKGROUND_FILL_COLOR(‘darkyellow’);
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(‘darkblue’);
END IF;
RETURN(TRUE);
END;

Using Format Attributes in Character Mode Reports


Some attributes are applicable to character environments only; some are for bitmapped
environments only.
If you include a bitmapped attribute and then run the report in character mode, or the
reverse, Report Builder ignores the code and does not cause an error. This enables you
to develop a report for use in a different environment.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-23
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Summary

Package contents:
• Procedures
• Functions
• Exceptions:
• SRW.PROGRAM_ABORT to exit
Examples:
• Drill-down report
• Support for DDL statements
• Conditional layout formatting and display

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-24 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
• The SRW package contains procedures, functions, and exceptions.
Remember that you can raise the exception SRW.PROGRAM_ABORT in your
PL/SQL code to stop report processing at any time.
• The SRW package provides a number of features, including:
– Drill-down reports, using SRW.RUN_REPORT in a button
– 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 iDS Reports: Build Internet Reports 18-25
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Practice 18 Overview

• Building a report containing conditional


highlighting
• Building a drill-down report
• Writing to a temporary table from a report

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-26 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 18
.....................................................................................................................................................

Practice Session Overview: Lesson 18


This practice session contains:
• Building a report containing conditional highlighting
• Building a drill-down 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 separate report from a button in the
previewer.
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 iDS Reports: Build Internet Reports 18-27
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

Practice Session: Lesson 18


1 Open report p8q5.rdf.
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:
Attribute Suggested Values
Text color Red
Font weight SRW.BOLD_WEIGHT
Font style SRW.ITALIC_STYLE

You can import the file p18q1a.txt.


b Alter the pattern and color of those records where the customer total is 5,000 or
less.
Hint: Check the Help system for the SRW.SET <attributes> or use conditional
formatting.
Attribute
Suggested Values
Fill pattern Crisscross, sandpaper
Foreground fill color Yellow
Background fill color Green

You can import the file p18q1b.txt.


c Write the necessary format triggers.
d Save the report as p18q1.rdf.
e Run the report on the Web.
2 Call a drill-down report using a button.
a Continue with the previous report.
b Alter the layout to exclude the customer ID field from displaying in the report.
c Add a button to this report to display a drill-down report when the button is
clicked at run time. The button should be displayed once for every customer
record.
d When the button is clicked, the detail report (p18q2c.rdf) is called with the
customer ID as a parameter.
Hint: Have a look at report p18q2c.rdf to check the name of the parameter.
You can import the file p18q2d.txt.
e Save the report as p18q2.rdf.
f Test the report using the run-time executable and then close the run time.

......................................................................................................................................................
18-28 Oracle iDS Reports: Build Internet Reports
Practice Session: Lesson 18
.....................................................................................................................................................

If You Have Time


3 Open report p9q1.rdf.
In this report, you use report triggers to create a temporary table at the start of
report execution and 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))
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 p18q3.rdf.
e Create the .rep file.
f Run and test the report using the report Runtime. Close the report.
g Using SQL*Plus, verify that your table exists and was populated successfully.
h Log on to SQL*Plus using the same userid as you used for Oracle Reports.
i Display all records in the RUNREPORT table.
SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;
j Try running the report more than once. When you run the report a second time,
the table already exists and Report Builder raises an exception. Make the
necessary change to your code so that the report runs even when the table
exists.
k Write a trigger that inserts a record with the comment “Printing another page”
whenever it begins a new page.
l Write a trigger that inserts a record with the comment “Report completed”
when the report finishes.
m Save and run the report using the Oracle Reports Runtime. Verify the results in
SQL*Plus.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 18-29
Lesson 18: Using the Report Builder Built-In Package
.....................................................................................................................................................

......................................................................................................................................................
18-30 Oracle iDS Reports: Build Internet Reports
................................
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Describe the benefits of XML definitions
• Create XML report definitions
• Apply XML report definitions
• Debug XML report definitions

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
It is 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.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the benefits of using XML report definitions
• Create XML report definitions
• Apply XML report definitions to an existing report
• Debug XML report definitions

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-3
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Why Use XML Report Definitions?

• Apply run-time customizations


• Perform batch updates
• Build fully functional reports
• Product openness

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-4 Oracle iDS Reports: Build Internet Reports
Why Use XML Report Definitions?
.....................................................................................................................................................

Why Use XML Report Definitions?


Introduction
Using XML tags, you can build a full or partial report that can serve as either a
customization file for an existing report or a completely self-contained report. This
new functionality opens many new possibilities for handling the output of data,
making Oracle Reports even more flexible and open.

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, you can add objects to a report’s Data Model.

Batch Updates
Using an XML report definition, you can apply batch updates to existing reports. You
have the option of saving the combined definition to a file. The advantage is that you
can quickly update a large number of reports without having to open each file in the
Report Builder to make the changes.

Building Fully Functional Reports


If you can generate XML tags, you can create a fully self-contained report definition
that can be run by Oracle Reports. Using an XML report definition, you can build
reports on the fly without using Report Builder.

Product Openness
XML support in Oracle Reports provides a mechanism for exchanging data with third-
party applications. It also offers a way to furnish data to tools that accept XML output
for data analysis, and XML is easily displayed on the Web.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-5
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Creating XML Report Definitions

<report>
<report>
• XML tags
<data>
<data> • Partial definition
.. .. .. • Full definition
</data>
</data>
<layout>
<layout>
.. .. ..
</layout>
</layout>
</report>
</report>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-6 Oracle iDS Reports: Build Internet Reports
Creating and Using XML Report Definitions
.....................................................................................................................................................

Creating and Using XML Report Definitions


Introduction
The steps below briefly outline the process of building and using XML report
definitions:
1 Create a full or partial report definition using XML tags. (You can do this manually
with an editor or programmatically.)
2 Store the XML report definition in a location accessible to the Reports Server.
3 Apply the XML definition to another report or run the report by itself.

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"/>
</section>
</layout>
</report>
Every XML report definition, whether full or partial, must contain the required
<report> </report> tag. It indicates the beginning and end of the report and contains
the name and the version number of the Document Type Definition file that is being
used. A full report requires both a Data Model and Layout Model and therefore
requires the <data></data> and <layout></layout> tags and their contents.
The report name attribute in the <report> tag can be different than the name of the
.rdf file. The name attributes in the <field> and <section> tags match the names of
the fields and sections. As a result, the attributes will be applied to the fields and
sections listed.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-7
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Format Modification Example

<report>
<report>
• Empty <data> tag
<data>
<data> • Use of <layout>
</data>
</data> • Use of <field>
<layout>
<layout>
<section>
<section>
<field
<field .../>
.../>
...
...
</section>
</section>
</layout>
</layout>
</report>
</report>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-8 Oracle iDS Reports: Build Internet Reports
Creating and Using XML Report Definitions
.....................................................................................................................................................

Partial Report Definitions


One of the main uses of XML report definitions is to make modifications to an
existing report at run time. The XML report definition enables you to easily change the
Data Model or report formatting without permanently affecting the original report. To
help you understand the kind of modifications that are possible, take a look at some
examples:
• 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"
source="prodid"
lineColor="black"
fillColor="r100g50b50"/>
<field name="f_current_price"
source="price"
lineColor="black"
fillColor="r100g50b50"/>
</section>
</layout>
This XML definition does not add data because the <data> tag is empty. The purpose
is to apply the formatting attributes mentioned on the <field> tags for the fields in the
report’s main section.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-9
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Format Exception Example

<report>
<report>
• Empty <data> tag
<layout>
<layout> • Use of <exception>
<section>
<section> • Use of <condition>
<field
<field ...>
...>
<exception>
<exception>
<condition
<condition .../>
.../>
</exception>
</exception>
</field>
</field>
</section>
</section>
</layout>
</layout>
</report>
</report>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-10 Oracle iDS Reports: Build Internet Reports
Creating and Using XML Report Definitions
.....................................................................................................................................................

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"/>
</exception>
</field>
<field name="f_bonus" source="bonus">
<exception textColor="blue">
<condition source="bonus" operator="gt" operand1="10"/>
</exception>
</field>
</section>
</layout>
</report>
This XML definition adds formatting exceptions to the SAL and BONUS fields.
Notice the use of the <exception> tag. However, the formatting change will only be
applied when the criteria defined in the <condition> tag is met.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-11
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Data Model Modification Example

<report> • Empty <layout> tag


<data> • Use of <dataSource>
<dataSource> • Column aliases
...
</dataSource>
• Bind references
</data>
<layout>
</layout>
</report>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-12 Oracle iDS Reports: Build Internet Reports
Creating and Using XML Report Definitions
.....................................................................................................................................................

Full Report Definition


• Data model modification example:
<report name="ref" DTDVersion="1.0">
<data>
<dataSource name="Q_sal_summary">
<select>
select r.name reg_name,sum(e.salary) totsal
from s_region r,s_dept d,s_emp e
where r.id = d.region_id
and d.id = e.dept_id
and r.id > :region_nr
group by r.name,d.name
</select>
</dataSource>
</data>
<layout>
<section name="header">
<tabular name="Sal_summary" template="corp2.tdf">
<labelAttribute font="Arial"
fontSize="10"
fontStyle="bold"
textColor="white"/>
<field name="f_reg_name"
source="reg_name"
label="Region Name"
font="Arial"
fontSize="10"/>
<field name="f_totsal"
source="totsal"
label="Total Sal"
font="Arial"
fontSize="10"/>
</tabular>
</section>
</layout>
</report>

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-13
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Data Model Modification Example

<report> • Empty <layout> tag


<data> • Use of <dataSource>
<dataSource> • Column aliases
...
</dataSource>
• Bind references
</data>
<layout>
</layout>
</report>

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-14 Oracle iDS Reports: Build Internet Reports
Creating and Using XML Report Definitions
.....................................................................................................................................................

Full Report Definition (continued)


Several things happen in this XML definition file:
– First of all, this XML report definition can run by itself because it has both a
Data Model and a complete 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. All data sources supported by
Oracle Reports (SQL and Express) are valid.
– 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.
– 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
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 if you wanted. This is a
performance issue. If calculations are included in SQL, they are performed
before the data is retrieved rather than performed on the retrieved data by
Oracle Reports.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-15
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Running XML Report Definitions

• Apply to an .rdf or .xml file

RWCLI60 userid=... report=...


customize=....xml server=...
destype=... desformat=...

• One or multiple definitions

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-16 Oracle iDS Reports: Build Internet Reports
Running XML Report Definitions
.....................................................................................................................................................

Running XML Report Definitions


Once you have created your XML report definition, you can use it in the following
ways:
• Apply an XML report definition to a .rdf or .xml file at run time by using the
CUSTOMIZE command line argument or the SRW.APPLY_DEFINITION built-
in.
• Run the XML report by itself by using the REPORT command line argument.
• Perform a batch update by using the RWCON60 executable with the
CUSTOMIZE argument.

Applying One XML Report Definition


The following command line sends a report request to the Reports Server and applies
the XML report definition emp.xml to the employee.rdf file.
rwcli60 userid=scott/tiger@db1 report=employee.rdf
customize=d:\rep6i\custom\emp.xml
destype=file desname=emp.pdf desformat=PDF
server=repsrv1
The equivalent Reports Runtime command line would be:
rwrun60 userid=scott/tiger@db1 report=employee.rdf
customize=d:\rep6i\custom\emp.xml
destype=file desname=emp.pdf

Applying Multiple XML Report Definitions


You can apply multiple XML report definitions to a report at run time by providing an
argument list with the CUSTOMIZE keyword. The following command line sends a
job request to the Reports Server and applies two XML report definitions, emp0.xml
and emp1.xml, to the .rdf file employee.rdf:
rwcli60 userid=scott/tiger@db1 report=employee.rdf
customize="(d:\rep6i\custom\emp0.xml,
d:\rep6i\custom\emp1.xml)"
destype=file desname=emp.pdf desformat=PDF
server=repsrv1

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-17
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Running XML Report Definitions

• Before Form or After Form trigger


•SRW.APPLY_DEFINITION(....xml);
SRW.APPLY_DEFINITION(....xml);

• Run by itself
• Batch updates

RWCON60
RWCON60 source="(...)"
source="(...)"
dest=...
dest=... customize=...
customize=...
batch=yes
batch=yes

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-18 Oracle iDS Reports: Build Internet Reports
Running XML Report Definitions
.....................................................................................................................................................

Applying an XML Definition in PL/SQL


To apply an XML report definition to an .rdf file in PL/SQL, you can use the
Before Form or After Form trigger. When you run the report, the trigger is executed
and the specified XML file will be applied.
The following command line applies XML stored in the file system to a report:
SRW.APPLY_DEFINITION(‘D:\rep6i\custom\emp.xml’);
To apply XML that is stored in the database, 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 the job request with the
REPORT argument. Ensure that the file extension is .xml. Note that you could apply
an XML definition at the same time by using the CUSTOMIZE argument.

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 RWCON60 command.
The following command line applies two XML report definitions to three different
reports and saves the new definitions in the file system:
rwcon60 scott/tiger@db1
stype=rdffile
source="(emp1.rdf,emp2.rdf,staff.rdf)"
dtype=rdffile
dest="(emp1_new.rdf,emp2_new.rdf,staff_new.rdf)"
customize="(d:\rep6i\custom\labels.xml,
d:\rep6i\custom\format_mask.xml)"
batch=yes

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-19
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Debugging XML Report Definitions

• XML parser
• Tracing option
• Using Report Builder

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-20 Oracle iDS Reports: Build Internet Reports
Debugging XML Report Definitions
.....................................................................................................................................................

Debugging XML Report Definitions


The XML Parser
The XML parser catches 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.

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.
rwrun60 scott/tiger@db1 report=D:\rep6i\custom\emp.xml
tracefile=emp.log tracemode=trace_replace traceopt=trace_app

Using Report Builder


It is sometimes useful to open an XML report definition in Report Builder while you
are still working on it. This will allow you to quickly determine if all objects are
created as expected. You could for example use the different editor views to determine
if fields and summaries are created in the correct Data Model group.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-21
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Summary

• Using XML report definitions:


– Run-time customizations
– Batch updates
• Applying XML definitions
• Debugging XML definitions

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-22 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
• Using XML report definitions:
– Run-time customizations
– Batch updates
– Stand-alone reports
• Applying XML report definitions:
– From the command line
– From PL/SQL
• Debugging XML report definitions:
– The XML parser
– The trace option
– Using Report Builder

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-23
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Practice 19 Overview

• Creating an XML report definitions


• Applying a Runtime customization
• Debugging an XML definition

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
19-24 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 19
.....................................................................................................................................................

Practice Session Overview: Lesson 19


This practice session contains:
• Running a report using an XML definition
• Applying an XML report definition to an existing .rdf file
• Debugging an XML 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, apply an XML definition to an existing report, and debug an
XML report definition.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 19-25
Lesson 19: Customizing Reports at Run Time
.....................................................................................................................................................

Practice Session: Lesson 19


1 Run an XML report definition.
Open p19q1.xml using Wordpad. Examine the code. What type of report is
a
this? What goes on in this file?
b Execute p19q1.xml using the Reports Runtime.
2 Apply run-time customizations
a Open p19q2.rdf. Run the report using the Live Previewer.
b What type of report is this? Investigate the data model, the layout model, and
the report sections.
c Open p19q2.xml. Examine the code. What goes on in this XML definition
file?
d Apply p19q2.xml to p19q2.rdf using the RWRUN60 command and send
the output to the screen.
e Examine the newly created report output. What do you see?
3 Debug an XML definition file
a Execute p19q3a.xml using the Reports Runtime. What output do you get?
Close the Previewer window.
b Execute p19q3b.xml using the Reports Runtime. What output do you get?
c Open p19q3b.xml using Wordpad and correct any errors—there are six in
total. Save and test frequently. The output should be identical to
p19q3a.xml.

......................................................................................................................................................
19-26 Oracle iDS Reports: Build Internet Reports
................................
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Objectives

After completiing this lesson, you should be able to


do the following:
• Distinguish between local client and remote
services reporting
• Describe the architecture used to run reports on
the Web
• Describe how a report is processed on the Web
• Differentiate the different methods of invoking a
report
• View and schedule server-side reports using the
Queue Manager
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
In this lesson, you learn how to make report requests to use, control, and monitor
remote Reports Services, and how to view and schedule reports sent from a client to
Reports Services.

Objectives
After completing this lesson, you should be able to do the following:
• Distinguish between local client and remote services reporting
• Describe the architecture used to run reports on the Web
• Describe how a report is processed on the Web
• Differentiate the different methods of invoking a report
• View and schedule server-side reports using the Queue Manager

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-3
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Client Server Architecture

Client reporting:
• All processing and formatting is
done on the client
• Suitable for small and medium
size reports
• Everyone runs the same report
again and again; no sharing
DB

Copyright  Oracle Corporation, 2000. All rights reserved.

Running Reports Using Remote Services

Benefits of Reports
Services (RWMTS60):
• Web support
• Formats, prints reports
on a powerful server RWMTS60
• Eliminates rerunning
reports RWRUN60 RWRUN60 RWRUN60
• Enhances scalability
and performance DB DB

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-4 Oracle iDS Reports: Build Internet Reports
Why Use Remote Services?
.....................................................................................................................................................

Why Use Remote Services?


Introduction
Oracle9i Application Server, Enterprise Edition provides a powerful and intelligent
Reports Services component. It resides on the middle tier on a high performance
server machine that is capable of processing and formatting your reports at high speed
and can return the completed output to the client machine.
Reports Services is a single process, and dynamically manages a set of report run-time
engines. Each Reports Runtime engine is responsible for executing a single report at
any given time; each engine can reside in memory to execute additional report
requests over a period of time.

Running Reports on a Local Client


When you run a report on the client, the client machine has to do all the formatting.
For small to medium-sized reports, this processing might not require much time and
effort. However, for large reports, the length of time needed by the client can be very
inconvenient.
When running reports locally on the client, several users often run the same report on
their own machine; therefore, the report may run many times, which is unnecessary if
the required output already exists.

Benefits of the Reports Services


• When used in conjunction with the Reports Web CGI, or Reports Servlet, the
Reports Services enables you to run reports from a Web browser using standard
URL syntax.
• Reports are formatted on a high-performance NT or UNIX server.
• The Reports Services caches the output in a central repository on the server
machine.
• The Reports Services detects duplicate reports. Users can share output without
rerunning the report.
• You can implement multiple run-time engines for one Reports Services machine.
• You can implement multiple Reports Services on one machine.
• You can use Reports Services clustering for unlimited scalability.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-5
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Report Request Methods

• RWCLI60 command line


• URL syntax
• WebDBPortal
Oracle
• ActiveX control
• SRW.RUN_REPORT

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-6 Oracle iDS Reports: Build Internet Reports
Why Use Remote Services?
.....................................................................................................................................................

Report Request Methods


You can run a report using various request methods. Below is a brief overview of each
method.
• The RWCLI60 command
This enables you to run a report from the command line prompt. RWCLI60 is an
executable that parses and transfers the command line to Reports Services, and is used
in a non-Web architecture.
• URL syntax
This method enables you to run a report from a Web browser. The URL syntax is
converted into a RWCLI60 command line request that is then processed by Reports
Services. You can provide users the URL syntax needed to make the request from their
browsers, or you can add the URL syntax to a Web site as a hyperlink.
• Oracle Portal
Oracle Portal enables you to add a link to an Oracle Portal site that points to a
packaged procedure that contains information about the report request. Authorized
users accessing the Oracle Portal site simply click the link to run the report. This
method makes it more convenient and secure to publish a report on the Web.
• ActiveX Control
It exposes Reports Services through industry-standard ActiveX technology and
enables you to run a report from any ActiveX container. The Report Launcher is an
example of an ActiveX container.
• SRW.RUN_REPORT
This is a packaged PL/SQL procedure that executes a Reports Runtime command.
You can use the SERVER argument to cause the packaged procedure to behave as
though you executed a RWCLI60 command.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-7
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Reports Services Web Architecture and Configuration

Reports Services Web Architecture

Web server

Reports CGI
or Servlet

Reports Server

Runtime Engine
Thin client tier Database tier
Oracle9i Application
Server
®

Copyright  Oracle Corporation, 2000. All rights reserved.

Introduction
Oracle Reports Services can be configured in a number of ways depending on your
requirements. This section explains the Reports Services architecture and discusses the
commands to invoke a report on the remote server.

Web Architecture
When used in a Web environment, the Reports Services architecture consists of
multiple tiers:
• The thin client tier
• The Web server tier
• The Reports Services tier
• The database tier
The range of possible configurations runs from having all of these tiers on one and the
same machine to having each of the tiers on a separate machine.The most common
configurations typically have the tiers spread across three or four machines. The
diagram on the opposite page shows the multi tier concept with the Web server and the
Reports Services tiers on the same machine.

......................................................................................................................................................
20-8 Oracle iDS Reports: Build Internet Reports
Reports Services Web Architecture and Configuration
.....................................................................................................................................................

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-9
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Web Processing

HTTP
Server Reports Services
Web Reports server
Listener
Reports
Web CGI
Instance of of
Instance
Runtime
Instance
Runtime of
Reports Engine
Runtime
Engine
Servlet Engine
Database
Browser

Report Output

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-10 Oracle iDS Reports: Build Internet Reports
Reports Services Web Architecture and Configuration
.....................................................................................................................................................

Processing Reports in a Web Architecture


1 The client requests the report from a Web browser by either entering a URL or
clicking a hyperlink. The Web browser passes the URL to the Web server.
2 To handle the request, the Web server invokes the Reports Web CGI, or Reports
Servlet depending on the configuration.
3 The Reports Web CGI or Servlet parses the request. It converts the request to a
command line that can be executed by Oracle Reports Services and submits it to
the specified server.
4 Reports Services checks its cache for acceptable output and returns the output if
available. If no acceptable output is available, Oracle Reports Services queues the
job request and runs the report when one of its run-time engines becomes
available.
5 The run-time engine retrieves the data from the database.
6 The CGI or Servlet receives the report output from Reports Services and sends it to
the Web server.
7 The Web server sends the report output to the client’s Web browser.

The Non-Web Architecture


The non-Web architecture differs from the Web architecture in that there is no Web
browser or Web server. Report requests are sent to Oracle Reports Services from the
command line (RWCLI60), the Reports Queue Manager, or the Reports Launcher
ActiveX control. When one of the runtime engines becomes available, it executes the
report and Oracle Reports Services is notified that the job has been completed.
Subsequently, the output is sent to its destination.

Web Architecture Versus Non-Web Architecture


From a configuration perspective, enabling Web requests requires that you install
either the CGI or servlet with your Web server but eliminates the need to install any
client software other than a browser. Enabling non-Web requests requires installing
and maintaining software (Net8, and the Reports Thin Client, which comprises the
RWCLI60, the Queue Manager and the Reports Launcher) on each client from which
you send job requests. In this respect, the Web case is clearly the most cost effective.
For flexibility, Oracle Reports Services supports both Web and non-Web requests and
they are not mutually exclusive.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-11
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Reports Services Clustering


Master report server Slave report servers

Multitiered
Multitiered Server
Server
Engine Engine
Engine
Engine

Engine Engine
Multitiered
Engine Server
Engine

Engine Engine
Engine
Engine

Multitiered
Server

Engine Engine
Engine
Engine

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-12 Oracle iDS Reports: Build Internet Reports
Reports Services Clustering
.....................................................................................................................................................

Reports Services Clustering


Introduction
While the introduction of a multitiered server is a benefit in itself, it still only allows
for a single machine to act as the server. In order to scale beyond the bounds of a
single machine, Oracle Reports supports Reports Services clustering.

Scalable Load Management


Oracle Reports Services clustering works as a master-slave configuration. One reports
server is designated to be the master, and all other reports servers are slaves. By
clustering individual reports servers, they act as a single logical, but distributed, report
engine.
When you submit jobs to Oracle Reports Services, they are automatically routed to an
available engine running on any machine within the cluster. If your reporting demands
grow to the extent where performance is degrading, it is simply a matter of adding a
new machine to the cluster to extend the available processing power.
When you add machines to the cluster, Oracle Reports Services automatically
recognizes their existence and starts to issue job requests to them. In case one of the
machines becomes unavailable due to failure or shutdown, Oracle Reports Services
automatically ceases to issue requests. If an engine dies while running a job, the job is
resubmitted using the retry mechanism—there is no guarantee that it will run on the
same slave however.

Optimizing Resources
The master server performs duplicate job and tolerance checks before a job is
allocated. If it receives a duplicate request within a defined time period, the job is
serviced from the cache rather than by reexecuting it.

Running a Report
In a Reports Services cluster, you run a report by specifying
server=master_name in the command line for the client executable. The master
server then assigns incoming jobs to the engines on the slave servers.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-13
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Running a Web Report

URL syntax

http://vesuvius_serv/our-cgi-bin/rwcgi60.exe?
report=emp_dept.rdf+desformat=html+destype=cache+
server=repsrv60+dept_param=10

Key mapCGI
Reports file Key map file : cgicmd.dat
• Reports Web CGI: cgicmd.dat
• Reports Web Cartridge: owscmd.dat

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-14 Oracle iDS Reports: Build Internet Reports
Making a Request to Run a Report
.....................................................................................................................................................

Making a Request to Run a Report


Introduction
Oracle Reports Services supports requests both from Web and non-Web clients. This
section covers how to run a report in both environments.

Running a Web Report


Thanks to the Reports thin client Web interfaces (the Reports CGI or Servlet), 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_serv/our-cgi-bin/rwcgi60.exe?
report=emp_dept.rdf+desformat=html+destype=cache+
server=repsrv60+dept_param=10
In the example, the first line contains the Web server hostname (vesuvius_serv) and
the virtual directory (our-cgi-bin) that contains the CGI executable (rwcgi60.exe)
to be called. The rest of the URL contains arguments to the CGI program to run the
report such as the module name, destination format, destination type, Reports Services
hostname, and a value for a runtime parameter.

The Key Map File


As you can see from the example above, the URL can become quite long. To get
around this problem, the key mapfile cgicmd.dat can be used. It holds all the
command lines and a single keyword to refer to each command line. By default the
key map file is located in the <oracle_home>/report60 directory. For the
example above the mapfile entry may look like the following:
emp_rep1: report=emp_dept desformat=html destype=cache
server=repsrv60 dept_param=%1
The URL now becomes much shorter:
http://vesuvius_serv/our-cgi-bin/rwcgi60.exe?emp_rep1+10

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-15
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................
s

Parameters for RWCLI60

• SERVER = <master_server>
• MODULE|REPORT = <runfile>
• DESTYPE = FILE, PRINTER, MAIL, CACHE,
LOCALFILE, SYSOUT
• DESNAME = <desname>
• DESFORMAT = PDF, DFLT, HTML, HTMLCSS, RTF,
DELIMITED
RWCLI60.EXE
RWCLI60.EXE SERVER=masterserver
SERVER=masterserver MODULE=my_rep.rdf
MODULE=my_rep.rdf
DESTYPE=FILE
DESTYPE=FILE DESNAME=my_rep.pdf
DESNAME=my_rep.pdf DESFORMAT=pdf
DESFORMAT=pdf

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-16 Oracle iDS Reports: Build Internet Reports
Making a Request to Run a Report
.....................................................................................................................................................

Running a Non-Web Report from the Command Line

Example
1 Invoke the command line. In Windows NT, Select Start—>Run.
2 Enter the command string, for example:
RWCLI60.EXE SERVER=masterserver REPORT=my_rep.rdf DESTYPE=FILE
This command sends the report to the remote master server, and the report runs
immediately.

Parameters for Running a Remote Report


• RWCLI60 sends a request to the Reports Services (master).
• RWCLI60 is invoked by a Common Gateway Interface (CGI) script. The CGI
version for Web servers is RWCGI60.
• SERVER=<tnsname>, where <tnsname> is an alias for your Report Server that
you create in <oracle_home>\net80\admin\tnsnames.ora. The
Reports Services name and parameters are discussed later in this lesson.
• You cannot set DESTYPE to Screen or Preview when using RWCLI60.
• HTMLCSS uses cascading style sheets, available in Netscape 4.0 or later.
Note: RWCLI60 accepts the same parameters as the Reports Runtime, RWRUN60.

Returning Control to the Client


Include BACKGROUND=Yes in your RWCLI60 command line, and then RWCLI60
returns immediately after submitting a job request to Reports Services.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-17
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

The Schedule Parameter

SCHEDULE = [FREQ from] TIME [retry n after LEN]

RWCLI60...
SCHEDULE=monthly_last_weekday_from_17:00_Oct_23,_1999_
retry_3_after_1_hour

FREQ CLOCK DATE

TIME

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-18 Oracle iDS Reports: Build Internet Reports
Making a Request to Run a Report
.....................................................................................................................................................

The Schedule Parameter


SCHEDULE is a scheduling parameter that you can include in the RWCLI60
command line to control the time and frequency with which your report runs.
The syntax of the SCHEDULE parameter comes primarily from the syntax of a "cron"
job on UNIX. To avoid quoting the schedule string, use underscores (_) instead of
spaces.
In default mode, the program runs the report immediately.

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}
LEN = {n} * SUFFIX
SUFFIX = <time, date, FREQ>

Example
SCHEDULE=hourly_from_09:00am_May_01,_1999

SCHEDULE=last_weekday_from_17:00_Oct_23,_1999_retry_3_after_1_hour
Note: This syntax is necessary only if you want to control your report jobs from the
command line. You can also specify the scheduled time and frequency of a report
when you define a new job in the easy-to-use Queue Manager screen, which you use
later in this course.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-19
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Reports Caching

Cached reports on server:


• Tolerance = n (minutes)
• Tolerance = 0 (default/current behavior)
• Maximum tolerance is 232 minutes (approximately
10,000 years)
• Cached output controlled by a server parameter
CACHEDIR

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-20 Oracle iDS Reports: Build Internet Reports
Making a Request to Run a Report
.....................................................................................................................................................

Reports Caching
Include the TOLERANCE parameter in your command line to cache the report output
for a specified number of minutes.
Setting TOLERANCE=60 means that Reports Services can detect a duplicate report
request from the same userid 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.

Cached Output
Reports Services uses a parameter CACHEDIR to determine where to place the
cached output.
The default directory is <oracle_home>\report60\server\cache.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-21
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Reports Services Configuration


Parameters
server_name.ORA file in
<oracle_home>\report60\server
MAXCONNECT=20
CACHEDIR="C:\ORANT\REPORT60\server\cache"
CACHESIZE=50
SOURCEDIR="C:\develop\reports\6i"
INITENGINE=1
MINENGINE=1
MAXENGINE=3
MAXIDLE=30
SECURITY=1
ENGLIFE=200
®

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-22 Oracle iDS Reports: Build Internet Reports
Making a Request to Run a Report
.....................................................................................................................................................

Reports Services Configuration Parameters


When you install Oracle Reports Services, it creates a .ora file with the same name
as the server. The file exists in <oracle_home>\report60\server, and you
can edit the parameters in the file. You can start up Reports Services using the services
folder in the Control Panel from Oracle Reports Services desktop:
Parameter Description
CACHEDIR Output directory for report caching.
CACHESIZE Size of the cache in megabytes. The default value is 50
ENGLIFE Maximum number of reports an engine runs before shutting itself
down and being replaced. The default value is 50
INITENGINE Initial number of runtime engines started
MAXCONNECT Maximum number of processes that can communicate with the server
process. The default value is 20
MAXENGINE Maximum number of engines available to run reports
MAXIDLE Maximum time for an engine to remain idle before being shut down
MINENGINE Minimum number of engines running to run reports
SECURITY Level of access (0 to 3) for accessing cached output files through the
Queue Manager
SOURCEDIR Directory that Reports Services initially searches for source (.rdf,
.rep) files.

Log File Contents A <servername>.log file in the same directory contains an


administrative actions log, which includes the information on shutdown and startup
time as well as engine start and stop time.

How Parameters Control Run-Time Engines


To conserve application server resources, excess or idle report engines remove
themselves from memory for one of the four following reasons:
• When an engine is idle for a MAXIDLE period of minutes, an engine removes
itself from the process table and frees up any associated resources.
• When an engine has run its ENGLIFE number of jobs, the report engine dies
gracefully, to be replaced by another engine.
• In response to changes to the maximum number of engines MAXENGINE, excess
engines are removed.
• When the multitiered Reports Services shuts down.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-23
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Configuring a Clustered
Reports Services: Example

Add to master_name.ora configuration file

clusterconfig=" (server=nt-2
minengine=0
maxengine=2
initengine=2
cachedir="H:\Cache")
(server=sun-1
minengine=0
maxengine=2
initengine=2
cachedir="/share/Cache") "

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-24 Oracle iDS Reports: Build Internet Reports
Making a Request to Run a Report
.....................................................................................................................................................

Configuring a Clustered Reports Services


Reports Services clustering works as a master-slave configuration. You designate a
server to be the master by adding the following line in the <server_name>.ora
configuration file:
clusterconfig="(server=server_name
minengine=minimum number of master engines
maxengine=maximum number of master engines
initengine=initial number of master engines
cachedir=directory for central cache)"
Note: You need an entry for each slave server.
The next thing you do is to ensure that the master can see the slaves, and that the slaves
can see the master.
• Add a line to the master tnsnames.ora file for each slave:
slave_name.world=(ADDRESS=(PROTOCOL=tcp)(HOST=slave_name)(PORT=
1949))
• Add a line to the slave tnsnames.ora file to identify the master:
master_name.world=(ADDRESS=(PROTOCOL=tcp)(HOST=master_name)(PORT=1949))

Technical Note
Reports Services requires Oracle Net8. When installing Oracle9i Application Server,
the Installer knows this is a dependency and installs it if necessary.
Reports supports the following protocols: Named Pipes, and TCP/IP.
If you have a sqlnet.ora file with a default domain, you must make sure that you
specify the domain in your tnsnames.ora file when entering the server name; for
example, my_server.world=(). Alternatively, if you do not use your
sqlnet.ora file, remove or rename it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-25
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

What Is the Queue Manager?

Real-time Reports Services status


• View report status and scheduled jobs
• Refresh to see the up-to-date status
• Reprioritize or cancel jobs

• Administrator password encrypted in .ora file

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-26 Oracle iDS Reports: Build Internet Reports
Viewing and Scheduling Reports in the Queue Manager
.....................................................................................................................................................

Viewing and Scheduling Reports in the Queue Manager


Introduction
This section explains the features of the Queue Manager and how to use it to view and
schedule reports in an easy-to-use GUI.

What Is the Queue Manager?


The Queue Manager is a facility that enables users and administrators to view the
current status of each report.
You can see all the jobs controlled by the master, as well as the server on which each
job is running, and the time that each report started and finished, and whether it
terminated successfully or with an error.
You can also view jobs that are scheduled to run at a future date or time.
You can reprioritize or cancel your own scheduled jobs. Administrators can
reprioritize or cancel any scheduled jobs.

Administrator Privilege
In the <servername>.ora 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 iDS Reports: Build Internet Reports 20-27
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Queue Manager

Past jobs

Current jobs
Scheduled jobs

Copyright  Oracle Corporation, 2000. All rights reserved.

Queue Manager

All my jobs
All jobs
Refresh

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-28 Oracle iDS Reports: Build Internet Reports
Viewing and Scheduling Reports in the Queue Manager
.....................................................................................................................................................

Viewing Report Jobs


The Queue Manager status bar enables you to switch among different views of report
jobs.
Icon Name Description
Show Past Jobs Displays jobs that have already run for a given reports server
Show Current Jobs Displays jobs that are currently running
Show Scheduled Jobs Displays scheduled jobs in order to reprioritize or cancel a job

Viewing Jobs of Different Owners


The Queue Manager status bar enables you to restrict the view of jobs by owner.
Icon Name Description
Show All My Jobs Displays your reports for a given reports server
Show All Jobs Displays all reports for a given reports server

Displaying Up-to-Date Job Status


Click Refresh on the status bar to refresh the screen and display the up-to-date status.
The default update interval is 15 seconds. You can alter this interval in the Queue
Manager preferences window. Select Options—>Preferences—> Polling Interval.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-29
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Using the Queue Manager

RSVR1
Queue
Manager
RSVR2

• Connect to any number of servers


• Administrator can shut down server
• Reports Services restores scheduled jobs after
shutdown

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-30 Oracle iDS Reports: Build Internet Reports
Viewing and Scheduling Reports in the Queue Manager
.....................................................................................................................................................

Connecting to Reports Services


You can connect to Reports Services by changing the server name in the Queue
Manager status bar.

Shutting Down Reports Services


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.

Retaining Scheduled Jobs After Shutdown


Reports Services maintains a list of all scheduled jobs in a file, <oracle_home>/
report60/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 iDS Reports: Build Internet Reports 20-31
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Reports Services ActiveX Control

• Embed in any ActiveX container


• Run report with a call to RWRBE60 or RWMTS60

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-32 Oracle iDS Reports: Build Internet Reports
Viewing and Scheduling Reports in the Queue Manager
.....................................................................................................................................................

The Reports Services ActiveX Control


The Oracle Reports installation provides an ActiveX control, which you can use from
other Windows applications to invoke the remote Reports Services and schedule your
reports.
The ActiveX control is RWSXU60.OCX. This control displays the Queue Manager.
You can embed this control in any ActiveX container.

Remote or Local Remote Reporting The ActiveX control can run a report by a
synchronous or an asynchronous call to the remote Reports Services; it can also run a
report by calling the Reports Background Engine.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-33
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Summary

Reports Services provides:


• Increased efficiency and scalability
• Multitiered architecture
• Reports client (RWCLI60)
• Reports server (RWMTS60)
• Reports caching
• Status and rescheduling (RWRQM60)
• ActiveX control for other applications

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-34 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
The remote Reports Services provides increased efficiency, scalability, and distributed
capabilities for large reports, and uses a multitier architecture.
The Queue Manager provides an easy-to-use GUI for viewing and scheduling report
jobs.
By caching report output, you can ensure that users do not rerun common reports
unnecessarily.
You can embed the Reports Services ActiveX control in other Windows applications
to run and schedule reports.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-35
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Practice 20 Overview

• Running a report on your local machine


• Running reports on a remote server using the
Queue Manager
• Copying output from a remote server to your local
machine
• Running a report on a remote server using the
command line

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
20-36 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 20
.....................................................................................................................................................

Practice Session Overview: Lesson 20


This practice session contains:
• Running a report on your local machine
• Running reports on a remote server using the Queue Manager
• Copying output from a remote server to your local machine
• Running a report on a remote server using the command line

Introduction
In this practice session, you run a report locally and then on a remote server, using the
Queue Manager. You also use the Queue Manager to view the submitted jobs.
If you have time, you can submit a report to a remote server using the command line
options.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 20-37
Lesson 20: Maximizing Performance Using Reports Services
.....................................................................................................................................................

Practice Session: Lesson 20


1 Run longrun1.rdf on your local client machine.
Open longrun1.rdf and run the report. Notice the time it takes for the report to
run to completion. If it has not completed within five minutes, note how many
pages have been formatted, and then cancel the report.
Note: Change Destination Type to File in the run-time parameter form when
running this report.
2 Run longrun1.rdf and longrun2.rdf by calling Reports Services from the
Queue Manager.
Note: Your instructor will give you specific instructions to complete this exercise.
The location of the remote server, directory paths, and so on, might differ for your
class.
a Invoke the Queue Manager. Enter repserver1 as your server name. Note if
there are any jobs in the queue.
b Schedule a new job to run the longrun1.rdf report on Reports Services.
Select applicable settings from the tab pages of the Queue Manager. For
Destination Type, select ToLocalFile, ToFile, or Cache; the report default is
Screen, which is not valid when running a remote report.
c Do the same for longrun2.rdf.
d Display all jobs to see where your jobs are queued in relation to the reports of
other students.
e Display all your own jobs only.
f Refresh the screen several times to see how quickly the report pages are
formatted.
g Cancel your own longrun2.rdf from the server queue.
3 When the report longrun1.rdf has finished, copy the output to a filename,
longrun1.pdf, in your home directory.

If You Have Time


4 Run longrun1.rdf by scheduling a new job from the command line.
a Using RWCLI60 from the command line, submit your longrun1.rdf
report to Reports Services.
b Ensure the output is in PDF format and that it is cached.

......................................................................................................................................................
20-38 Oracle iDS Reports: Build Internet Reports
................................
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Describe performance areas
• Use performance measurement tools
• Build reports for different GUIs
• Build reports to run in other languages

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
A report does not run in a vacuum. It is dependent on the underlying hardware,
software, and network connection. Because of this complex interrelationship,
performance is always an issue. 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.

Objectives
After completing this lesson, you should be able to do the following:
• Describe the various areas to investigate to improve performance
• Use the performance measuring tools
• Describe the considerations when building reports for different graphical user
interfaces (GUIs)
• Describe the facilities available for building reports to run in other languages

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-3
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Tuning Reports

• No absolute rules
• Investigate specific areas:
– Data Model
– Layout Model
– Run-time arguments
– Query and application partitioning

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-4 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

Tuning Oracle Reports


Tuning a report is not a matter of applying a few small tweaks that will result in
dramatic improvements in performance. It is more a case of investigating specific
areas. The areas to investigate are the Data Model, the Layout Model, run-time
arguments and application and query partitioning. 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


Report Builder offers two measurement tools, the Reports Profile option and the Trace
option.

The Reports Profile option When you set this option, Oracle Reports produces a
log file that shows where processing time is spent. To set the Profile option, use the
PROFILE=<log_file> command line argument with RWRUN60, or from the main
menu select Tools—>Preferences, Runtime Settings. Typical profile output is shown
below:
Reports Profiler Statistics
TOTAL ELAPSED Time: 29.00 seconds
Reports Time: 24.00 seconds (82.75% of TOTAL)

ORACLE Time: 5.00 seconds (17.24% of TOTAL


UPI: 1.00 seconds
SQL: 4.00 seconds
In this profile output, you see the execution time (total elapsed time) for the report, the
amount of time spent formatting the retrieved data (Reports time), and the amount of
time spent waiting for the data to be retrieved (Oracle time), comprised of time spent
establishing the database connection, parsing and executing the SQL statement (UPI
time), and the time spent for fetching the data and executing SRW.DO_SQL()
statement (SQL time).

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-5
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Performance Measurement

• Measurement tools:
– Profile option
– Trace option
• Server and network Measurements
– SQL Trace
– Traffic and bandwidth

21-4 Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-6 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

The Reports Measurements Tools (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.
To set the Trace option, use the TRACEFILE=<trace_file> command line argument
when running the report, or from the main menu select Tools—> Trace.

Server and Network Specific Measurements


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 Oracle database sever. 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 SQL Language 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 iDS Reports: Build Internet Reports 21-7
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Investigating the Data Model

• Schema design • Redundant queries


• Indexes • Break groups
• Efficient SQL • Group filters
• Efficient PL/SQL • Linking queries
• Calculations

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-8 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

Investigating the Data Model


If the report spends a large amount of time in the database, then it is often wise to
review the data structure and how it is being used. The following areas should be
examined:
• Schema design
The specific nature of your application will determine the most efficient Data Model,
but bad schema design can have a dramatic effect. Generally speaking, query-driven
applications can benefit from denormalized tables, whereas normalized tables are
usually best for applications that do many updates and inserts. Oracle Reports is a
typical nonprocedural tool geared for set-based data retrieval. Hence, an overly
normalized Data Model can result in many avoidable joins or queries.
• Use of indexes
A lack of appropriate indexes can result in many full table scans and Cartesion 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.
• 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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-9
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Investigating the Data Model

• Schema design • Redundant queries


• Indexes • Break groups
• Efficient SQL • Group filters
• Efficient PL/SQL • Linking queries
• Calculations

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-10 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

Investigating the Data Model (continued)


• Performing calculations
For calculations within a report (either through summary or formula columns), the rule
of thumb is that the more calculations that can be performed within SQL, the better. If
calculations are included in SQL, they are performed before the data is retrieved rather
than performed on the retrieved data by Oracle Reports.
If a PL/SQL function is required within a report, then SRW.DO_SQL() should be used
as sparingly as possible as it necessitates parsing and binding of the command and
opening a cursor for each object within which the SRW.DO_SQL() resides. 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).
• 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 database columns wherever this
is feasible.
• Group filters
It is usually more efficient to try and incorporate a group filter into the query WHERE
clause. This restricts the number of rows returned and avoids local filtering by Oracle
Reports itself.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-11
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Investigating the Layout Model

• Frames
• Object size
• Format triggers
• Fetching ahead
• Sectioning and distribution

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-12 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

Investigating the Data Model (continued)


• Linking queries
There are a number of ways to create Data Models that include more than one table.
You can create a single query with a join condition or you can create two separate
queries and create a link between the two. In general, it is preferable to minimize the
actual number of queries as each time a query is issued, Oracle Reports needs to parse,
bind, and execute a cursor. A single query report is therefore able to return all the
required data in a single cursor rather than many. Also, with master detail queries, the
detail query will be reparse, rebound, and reexecuted for each master record retrieved.
In this case, it is often more efficient to use a single query report with break groups.

Layout Model Considerations


Once the data has been retrieved, Oracle Reports needs to format the output following
the Layout Model 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.
• 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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-13
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Setting Run-Time Arguments

• RUNDEBUG=NO
• Array processing
• LONGCHUNK
• PARAMFORM
• Batch processing

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-14 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

Layout Model Considerations (continued)


• 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 in
the Live Previewer or Previewer. To enhance perceived performance, reading ahead
should be avoided when a report is going to be run to the screen in a production
environment.
• Sectioning and distribution
The use of report sectioning in conjunction with distribution offers considerable
performance gains. Each section of a report can have multiple different formats and
can be sent to multiple destinations in one single run rather than running the same
report multiple times.

Setting 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 report has columns of the LONG 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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-15
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Application and Query Partitioning

• Query partitioning
• Move wait time forward
• Share work between components

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-16 Oracle iDS Reports: Build Internet Reports
Tuning Oracle Reports
.....................................................................................................................................................

Application and Query Partitioning


Application and query partitioning are not geared to be report-tuning techniques as
such. They enable you to examine the system and the environment to see if there are
areas where perceived performance can be enhanced.
• Query partitioning
In a typical Oracle application development environment, it is often the case that some
kind of report is required on data that has already been retrieved by another
component. The tight integration between the products allows for passing blocks of
data. Between Oracle Forms and Oracle Reports, this is achieved by record groups and
data parameters. Sourcing a Reports query from a Forms record group avoids
requerying the database and hence Oracle Reports will only spend time formatting the
data.
The same query partitioning technique works from Reports to Graphics. When a chart
display item is defined in the Reports Builder, then a Reports group can be defined to
match the Graphics query. This means again that the database needs only be queried
once.
• Move wait time forward
When one development component calls another, and the called component is not
already in memory, it takes a certain time to load it. While this technique of load-upon-
demand makes more efficient use of memory, it can cause a perceptible wait for the
end user. It is possible to reduce the wait time by initially loading the called
component along with the calling component. This does lengthen startup time, but it is
less noticeable that waiting in the middle of processing. Note that this technique is
more useful for Forms calling Reports than it is for Reports calling Graphics.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-17
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Different Development and Run-Time


Environments

• Report Builder development


Bitmapped only
• Report Builder Runtime
– Bitmapped
MODE = bitmap
– Character mode
MODE = character

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-18 Oracle iDS Reports: Build Internet Reports
Different Development and Run-Time Environments
.....................................................................................................................................................

Different Development and Run-Time Environments


Introduction
Although you always develop your reports in a bitmapped environment, the
production reports can run in either bitmapped or character mode.
Therefore, you can develop a report in a bitmapped environment that is to run in a
character mode environment.

Bitmapped Environment
This environment has a unit of pixel and typically supports a mouse. Interaction with
the host computer is continuous.
The bitmapped Designer allows you, as a developer, to take advantage of the graphical
user interface.

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 Report Builder
and view the report output in the Previewer.
The execution of the report as bitmapped or character simply depends on a system
parameter called MODE. You can change this parameter in Report Builder to test the
character output during your report development.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-19
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Developing Reports to Run in Different


GUIs

• Use common fonts or map fonts in


uifont.ali
• Use common colors
• Beware of dots per inch (DPI)

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-20 Oracle iDS Reports: Build Internet Reports
Developing Reports to Run in Different GUIs
.....................................................................................................................................................

Developing Reports to Run in Different GUIs


Introduction
There are a few points that you should consider when moving a report from one GUI
to another, because the following GUI differences may affect the report output.

Using Common Fonts


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.

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"
In the uifont.ali file on UNIX (motif), map Microsoft Windows fonts to Motif:
/* Microsoft Windows fonts */
"Courier New" = lucidatypewriter
"Times New Roman"= lucidabright

Using Common Colors


If possible, use a color that you know exists on the target GUI; otherwise, use one that
maps well to the default color of the target GUI.

Beware of Dots Per Inch


The dots per inch (DPI) may differ among machines, even if they use the same GUI.
This only affects how alphanumeric characters wordwrap on the screen. Therefore, if
you design a report that is displayed in the Previewer, try to use the same DPI as the
users who will eventually run the report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-21
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Setting NLS Language Environment


Variables

• NLS_LANG
• DEVELOPER_NLS_LANG, USER_NLS_LANG

NLS_LANG=French_France.WE8DEC
NLS_LANG=French_France.WE8DEC

• Unicode
NLS_LANG=<lang>_<territory>.AL24UTFFSS
NLS_LANG=<lang>_<territory>.AL24UTFFSS

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-22 Oracle iDS Reports: Build Internet Reports
Building Reports to Run in Different Languages
.....................................................................................................................................................

Building Reports to Run in Different Languages


Introduction
This section gives a brief overview of the features available on the server and in
Oracle Reports Developer that provide support for building multilingual applications.
• Switching languages using Oracle’s National Language Support (NLS)
• Translating an application using Translation Builder

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.

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 (UCS-2) is a fixed-length two-byte character set that represents up to 65,536
characters.
Using Unicode in Oracle Developer Reports enables you to display multiple languages
in one application without switching character sets.

Syntax
NLS_LANG = <language>_<territory>.AL24UTFFSS

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-23
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Translating an Application

• Use Translation Builder to:


– Extract strings; import into repository
– Execute translation
– Merge back into original resource
• Consider:
– Format masks
– Hard-coded strings
– Multiple character sets

21-12 Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-24 Oracle iDS Reports: Build Internet Reports
Building Reports to Run in Different Languages
.....................................................................................................................................................

Translating an Oracle Developer Application


Translation Builder is a component of Oracle Developer that supports and manages
translations of text extracted from both Oracle resource files, such as Oracle
Developer applications, and non-Oracle resource files, such as Microsoft Windows
(.rc) and HTML files.
You can translate a report from any language to any other language. Once a translation
is complete, you can use that translation as a base for further translations.
Translations are portable across multiple platforms.

How to Translate a Resource


1 Use the Project Navigator to extract translatable strings from Oracle or
non-Oracle resources and import them into the translation repository.
2 Add a translation by indicating the language.
3 Execute the translation using the Translation editor.
4 Preview the translation by performing appearance checking and tuning to preserve
an acceptable look and feel.
5 Extract the translated strings and merge them back into the original resource.

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.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-25
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Summary

• Tuning and performance


• GUIs:
Colors, uifont.ali
• Languages:
NLS, Unicode, Translation Builder

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
21-26 Oracle iDS Reports: Build Internet Reports
Building Reports to Run in Different Languages
.....................................................................................................................................................

Practice 21 Overview

• Identifying areas to investigate for tuning reports


• Using the trace facility
• Interpreting time statistics
• Improving performance

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-27
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

Practice Session Overview: Lesson 21


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. Report Builder offers a few tools that allow
you to measure preformance. In this practice you will use them and interpret the
results.

......................................................................................................................................................
21-28 Oracle iDS Reports: Build Internet Reports
Practice Session: Lesson 21
.....................................................................................................................................................

Practice Session: Lesson 21


1 Name three main areas to investigate when tuning reports.
2 What is the name of the font mapping file?
3 Generate and interpret Reports Profiler Statistics.
Open report p21q1a.rdf. From the menu select Tools—>Trace.
a
b In the Runtime Trace Settings dialog box specify p21q1a.txt as the trace file
and check the Profile Messages and Timestamp checkboxes.
c Select OK to close the dialog box.
d Run the report.
e Open p21q1a.txt and look at the results. Where does this report spend
time?
f Repeat the same steps for report p21q1b.rdf. Specify p21q1b.txt as the
trace file. Compare the result. How do you explain this?
4 Make a suggestion to improve performance.
a Using the Reports Runtime, run p21q2a.rep and generate the Reports
Profiler Statistics. Look at the time statistics.
b Open the report p21q2a.rdf and examine the data model. What could you
possibly do to make the report run faster?
c Implement your change and regenerate the time statistics. Did things improve?

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports 21-29
Lesson 21: Building Reports: Efficiency Guidelines
.....................................................................................................................................................

......................................................................................................................................................
21-30 Oracle iDS Reports: Build Internet Reports
................................
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 1


Introduction
This practice familiarizes you with Oracle Reports Developer by asking you a number
of questions that you answer by navigating through the interface and by investigating
Help Topics.
After each question, space is provided for you to write the answer. Or, if you prefer,
use a separate sheet of paper.
Depending on the size of your group, the instructor might ask you to answer some of
the questions and share your answers with the rest of the class.
Depending on the environment you are using in this course, the instructor might ask
you to compile some reports from the Project Builder.

......................................................................................................................................................
A-2 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 1
.....................................................................................................................................................

Practice Session Solutions: Lesson 1


1 Launch Report Builder and then choose Cancel in the wizard.
Select Report Builder in the launcher.
When Report Builder is up, Select Cancel in the wizard.
2 Change your preferences so that a newly opened report is not immediately
executed. To do this, you must suppress the Report editor on Open.
Select Tools—>Preferences from the menu. On the General tab, select the
option Suppress Report Editor on Open and then click OK.
3 Open the report named p2q2.rdf.
Select Open from the toolbar or File—>Open from the menu and then select
the file named p2q2.rdf.
4 Change your preferences so that you can work with a report definition either in a
file or the database. Ensure that the default list shows only reports.
Select Tools—>Preferences from the menu. On the Access tab select the
option File/Database and check Reports. Click OK to accept your
preferences.
5 Open another report: p2q3.rdf. Notice the additional dialog box.
Select Open from the toolbar or File—>Open from the menu. Accept the
dialog box. In the File Browse dialog box, select the file named p2q3.rdf and
click OK.
6 Reset your preferences to work with files only. Enable a report to be run
automatically on open.
Select Tools—>Preferences from the menu. On the General tab clear the
option Suppress Report Editor on Open. On the Access tab select the option
File. Click OK to accept your preferences.
7 Name the three products that make up Oracle’s business intelligence solution.
Oracle Reports Developer, Oracle Discoverer, Oracle Express
8 Name three Report Builder components.
Any three out of this list: Object Navigator, Live Previewer, Data Model,
Layout Model, Property Palette,PL/SQL Editor, PL/SQL Development
Environment, Syntax Palette.
9 What is the purpose of the UI_ICON environment variable?
This environment variable determines the path that is used for icon files at
run time.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-3
Appendix A: Solutions
.....................................................................................................................................................

10 Use the context-sensitive Help to discover more about preferences.


Select Tools—>Preferences from the menu. Choose Help or press the Help key
(F1 on Windows systems).
General:
a What setting must you choose for color mode if you want to alter the color
palette for a specific report?
Select the General button in the Help system. In the dialog box, select
Color Mode and choose Display.
You must set the color mode to Editable.
b What menu option do you use to alter the color palette?
Format—>Layout Options—>Color Palette.
Close the Help system.
Run-time values:
Go back into the Tools—>Preferences Help system.
c What is the purpose of the Runtime Values?
Select the Runtime Values tab in the Help system.
Run-time values are values used if you run your report in the current
session.
d When do they take effect?
Immediately.
e What must you do to change the default setting in your report?
You must update the Initial Value of the appropriate parameter in the
report definition.
f What are the names of the three run-time values that affect the report
destination, and what are the three related report parameters?
Destination Format DESFORMAT
Destination Name DESNAME
Destination Type DESTYPE

Close the Help system and leave the Preferences dialog box.

......................................................................................................................................................
A-4 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 1
.....................................................................................................................................................

11 Use Help Topics to discover more about the functionality of Oracle Developer
Report Builder:
Select Help—>Report Builder Help Topics from the menu.
a What is MAPI?
Use the index to look for MAPI. Select MAPI, about.
MAPI is the Microsoft Messaging Application Program Interface used to
send reports to an e-mail system.
b What are the prerequisites for sending a report as an e-mail attachment?
You must have an appropriate MAPI mail client.
c The report is sent as what type of attachment format?
Bitmapped reports are sent as PostScript files, character mode reports as
ASCII text.
d What is delimited output?
Delimited output enables you to specify a delimiter to separate the data in
your report. Using this feature you can create report output that is easily
imported into spreadsheets.
12 Use Help on Manuals to answer the following questions in the Oracle Information
Navigator:
Note: In the Information Navigator, select Tools—>Preferences to initialize your
Web browser. Your instructor will tell you which browser to use.
Select Help—>Manuals from the menu.
a List three of the top-level folder names for the online manuals.
Release Notes, Getting Started, Publishing Reports
b In the Publishing Reports Manual, what is the purpose of the RWCLI60
command and what is the maximum length of the logon definition?
Expand the node Oracle Developer 6i Online Manuals: Publishing
Reports.
Select Appendix A: RWCLI60 Command Line Arguments

The purpose of the RWCLI60 command is:


To parse and transfer the command line to the specified Reports Server.
The maximum length of the logon definition is 512 bytes.
c In Designing Portable Applications, what is the purpose of section 3?
Expand the node Oracle Developer6i Online Manuals: Guidelines for
Building Applications in the Oracle Information Navigator.
Select Designing Portable Applications.
Section 5.3 discusses designing portable reports.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-5
Appendix A: Solutions
.....................................................................................................................................................

Name the three language environment variables available when developing


d
multilingual applications.
Select Oracle Developer: Guidelines for Building Applications and then
select Index in the Oracle Information Navigator.
Go to Multilingual Applications in the index.
The three environment variables are:
DEVELOPER_NLS_LANG
NLS_LANG
USER_NLS_LANG
13 Use Quick Tour to find out how to prepare a report for the World Wide Web.
Select Help—>Quick Tour from the menu.
In the Web browser, select Report Builder, then select Preparing a Report for
the World Wide Web.
a What changes do you have to make to your report to deploy it on the Web?
Page 2 of 9: You can prepare an existing report for the World Wide Web
without making any changes to the report.
b What output formats can you choose from?
Page 4 of 9: You can choose from HTML or PDF output formats.

......................................................................................................................................................
A-6 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 2
.....................................................................................................................................................

Practice Session Overview: Lesson 2


This practice session contains:
• Invoking the Reports Runtime executable from the Program Manager
• Running a report from a browser
• Executing a number of different reports. For each report, answer some questions

Introduction
Before you learn to develop reports in the Builder, you should investigate the run-
time executable that you use constantly in the production environment and for
testing your reports prior to production.
This practice session consists of a combination of practical and paper-based
questions.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-7
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 2


1 Invoke the Reports Runtime executable.
Select Reports Runtime from the Oracle Developer menu.
This may differ according to the classroom setup.
2 Run the report called p2q2.rep.
From the menu select File—>Run. The File Browse window opens. Select
p2q2.rep and click Open.
a Examine the report in the Previewer window. Among the styles discussed in
this lesson as a reference, what style of report is it?
Tabular report.
b How many groups of data are there in this report?
One group of data, each row being displayed once within the group.
c In the Previewer window, use the scroll bars to move up and down the report to
see all of the data.
Use the scroll bar on the right side of the Previewer to scroll up and down
the report data.
d Close the Previewer window. You are now back in the Runtime window.
In the Previewer, click Close Previewer.
3 From the Runtime window, run report p2q3.rep.
From the menu select File—>Run.The file Browse window opens. Select
p2q3.rep and then select Open.
a In the Previewer window, move to the next page. Notice that this report has a
header page with text. Notice that the Previewer also has many more buttons
highlighted. This is because there are more available actions, such as Next
Page, Previous Page, Last Page, and First Page.
Select Next Page to navigate from one page to another.
b What style of report is this?
Tabular report.
c In the Previewer window, experiment with the horizontal and vertical split
screen features.
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.

......................................................................................................................................................
A-8 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 2
.....................................................................................................................................................

To split the Previewer vertically: Select the small gray area at the left of
the horizontal scroll bar at the bottom of the window. Press the left mouse
button down and drag the gray area. As you do this, you see that a thick
dotted line is dragged right across the Previewer. Depress the left mouse
button when you have reached the desired split point. Now you have two
windows, which work independently from each other.
d Close the Previewer window. You are now back in the Runtime window.
In the Previewer click Close Previewer.
4 Open your browser and run report p2q4.
From the desktop double-click the browser. Provide the URL to run p2q4.
a What style of report is this?
It is a Master/Detail report.
b How many groups of data are in this report?
There are two groups of data.
c How many pages are there in this report?
There are three pages.
d Close the browser.
In the browser, click Close.
5 From the Runtime window, run report p2q5.rep
From the menu select File—>Run. The File Browse window opens. Select
p2q5.rep and select Open.
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
Job Title
Salary
There actually is an additional, invisible “cross product” group around
Year, Department, and Job; this special group defines the matrix
structure and is explained in the lesson on matrix reports.
c Close the Previewer window. You are now back in the Runtime window.
In the Previewer click Close Previewer.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-9
Appendix A: Solutions
.....................................................................................................................................................

6 From the Runtime window, run report p2q6.rep.


From the menu select File—>Run.The File Browse window opens. Select
p2q6.rep and click Open.
a Notice the Parameter Form. You are requested to choose a customer from a list
of values. The report will display order information based on your input.
b Specify a valid customer ID and run the report. Valid values include 201, 210,
and 213; pick one of these and then select Run Report.
Click in the customer ID field and enter one of the suggested numbers. Select
Run Report.
c What do you think would be a better method of providing valid values to a
user?
It would be more user-friendly to display a list of values. And it would be even
more meaningful to add customer names. This can easily be built into the
report. You will see how this is done in a later lesson.
d Close the Previewer window. You are now back in the Runtime window.
In the Previewer, click Close Previewer.
e Run the report again. This time do not specify a customer ID.
From the menu select File—>Run. The File Browse window opens. Select
p2q6.rep and click Open, then 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 Previewer window. You are now back in the Runtime window.
In the Previewer, click Close Previewer.
g Run the report again. This time enter Customer ID 999.
From the menu select File—>Run. The File Browse window opens. Select
p2q6.rep and click Open. Enter the customer ID 999 and select Run
Report.

......................................................................................................................................................
A-10 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 2
.....................................................................................................................................................

i What is the result?


The result is that the report does run; however, it does not display any
data. There is no customer ID 999.
ii In a production situation, what should happen in this instance?
The user should be prevented from entering an invalid value. In later
lessons you will see how this can be implemented.
Close the Previewer window. You are now back in the Runtime window.
h
In the Previewer, click Close Previewer.
7 Open your browser and run report p2q7.
From the desktop double-click the browser. Provide the URL to run p2q7.
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.
c Close the browser.
In the browser, click Close.
8 From the Runtime window, run report p2q8.rep.
From the menu select File—>Run. The File Browse window opens. Select
p2q8.rep and click Open.
a What do you notice that is different about this report?
A button is displayed to the right of the customer information.
b Select Details. Another report is called to display information about the orders
the customer has placed with the company. This is called a Drill-Down report.
c Close the Orders Report Previewer window and then close the Customer
Report Previewer window. You are now back in the Runtime window.
In the Orders Report Previewer click Close Previewer.
In the Customer Report Previewer click Close Previewer.
d Close the Previewer window. You are now back in the Runtime window.
In the Previewer, click Close Previewer.
9 From the Runtime window, select File—>Generate to File.
a From the pop-up window, select HTML Style Sheet.
Click on HTML Style Sheet.
b In the Open File dialog box, select file p2q9.rep.
Click the p2q9.rep file.
c In the Save File dialog box, save your file as p2q9.htm.
Click the Save button.
d Locate p2q9.html in your file system and double-click it.
Your report now appears in your browser.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-11
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 3


This practice session contains:
• Invoking Report 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 Report 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-12 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 3
.....................................................................................................................................................

Practice Session Solutions: Lesson 3


1 Start Report Builder.
On your desktop, locate the Report Builder icon and launch the executable.
2 Open and run an existing report: p3q2.rdf.
In the Welcome dialog box of Report Builder select the Open an Existing
Report option and click OK.
Open p3q2.rdf from the file system and run the report.
If prompted, connect to the database using the login information your
instructor gives to you.
When the parameter form comes up, select Run Report, accepting all the
defaults.
3 In the Report editor, switch to the Data Model view.
In the Object Navigator, select Q_1.
Hint: Use the Find field at the top of the Object Navigator.
Notice the object that is selected in the Data Model view.
While the Report Editor window is active, select View—>Data Model from
the menu.
Activate the Object Navigator window.
Click in the Find field and enter Q_. The Navigator expands the appropriate
node and highlights the first object that meets the entered value.
In the Data Model editor, the query object Q_1 is selected.
4 In the Report editor, switch to the Layout Model.
In the Object Navigator, select F_ID.
Hint: Use the Find field at the top of the Object Navigator.
Notice the object that is selected in the Layout Model view.
Fully expand the Layout Model node and select R_G_ORD_ID.
Notice the object that is selected in the Layout Model view.
While the Report Editor window is active, select View—>Layout Model 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 Layout Model editor the field F_ID is selected.
In the Object Navigator window, select the Layout Model node and select
Expand All in the toolbar; or select
Navigator—>Expand All from the menu. Select R_G_ORD_ID.
In the Layout Model editor, the repeating frame R_G_ORD_ID is selected.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-13
Appendix A: Solutions
.....................................................................................................................................................

5 In the Report editor, switch to the Parameter Form view.


In the Object Navigator, expand the Parameter Form node. Notice the presence of
four fields. Select PF_DESTYPE. Notice the object that is selected in the
Parameter Form.
Use the Find field at the top of the Object Navigator to select P_CUSTID. Is any
object selected in the Parameter Form? What is the reason?
While the Report Editor window is active, select View—> Parameter Form
from the menu.
In the Object Navigator select the Parameter Form node and click Expand
All from the toolbar or select Navigator—>Expand All from the menu. Select
PF_DESTYPE.
In the Parameter Form editor the object PF_DESTYPE is selected.
In the Object Navigator window, click in the Find field and enter P_. The
Navigator expands the appropriate node and highlights P_CUSTID.
In the Parameter Form editor the object PF_DESTYPE is not selected,
because P_CUSTID is a parameter and not a parameter field. Parameters are
part of the Data Model, not the Parameter Form.
6 Use Help Topics to answer the following questions:
From the menu, select Help—>Report Builder Help Topics. In the Index tab,
enter Executables in the selection field; select Invoking from the index entry
list below and select Display. Select Related Topics.
a What is RWMTS60?
Select RWMTS60 from the dialog box. It is the Reports Server executable.
b What is RWCLI60?
Select RWCLI60 from the text. It parses and transfers the command line
to the Reports Server.
c What is the Web Previewer?
In the index tab, enter Web Preview and select Display. The Web
Previewer allows you to preview your report in a browser.

......................................................................................................................................................
A-14 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 4
.....................................................................................................................................................

Practice Session Overview: Lesson 4


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

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

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-15
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 4


Invoking Report Builder and the Wizard
If Report 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 Create Object.
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 containing the following data. Use Query Builder to build
the query.
S_DEPT: NAME
S_EMP: FIRST_NAME, LAST_NAME, TITLE, SALARY, COMMISSION_PCT
Display all fields. Do not make any changes to the other wizard pages.
In the Select Data Tables dialog box, highlight the S_DEPT and S_EMP
tables, click Include, and close the dialog box.
In the Query Builder window, select the columns from the tables and click
OK.
Click Next.
Copy all fields from the Available Fields area to the Displayed Fields area.
Click Next on all other wizard pages and click Finish on the last page.
2 Using the reentrant Report Wizard, make the following modifications (test your
report frequently).
Select Tools—>Report Wizard from the menu or select Report Wizard from
the horizontal toolbar.
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 Descending. Close the Sort
dialog box and the Query Builder.
Click Finish to test your report.
Add a summary to show the total salary value.
Reenter the Report wizard by choosing Report Wizard from the toolbar.
On the Totals tab select SALARY and click Sum.
Reduce the width of SALARY and TOTAL to 6.
Change the COMMISSION_PCT label to Comm and reduce the width to 4.
Make the necessary changes on the Labels tab and click Finish to test your
report.
Save the report to a file named p4q2.rdf.
Select File—>Save As from the menu and save the file to disk.

......................................................................................................................................................
A-16 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 4
.....................................................................................................................................................

3 Using the reentrant wizard, modify the report to create a break report.
Select the report style Group Above.
Select the report style on the Style tab.
Group the report by the department name.
On the Groups tab copy NAME to the Group Fields area.
Select the template called Bright 1.
Select the template on the Template tab. Click Finish to close the Wizard.
Save the report as p4q3.rdf.
Select File—>Save As from the menu and save the file to disk.
4 Create a new report containing the following data:
a Use the Report Wizard.
b Select the Mailing Labels style.
c Use Query Builder to build the query.
Create a new report by selecting the Report node in the Object Navigator
and choosing Create Object.
As an alternative you can also select File—>New—>Report from the
menu.
Select Mailing Label style. For the query type, accept the default selection
of SQL statement.
Select Query Builder.
In the Select Data Tables highlight the S_CUSTOMER and S_ORD
tables, choose Include, and close the dialog box.
In the Query Builder window select the necessary columns from the tables
and click OK.
S_CUSTOMER: NAME, ADDRESS, CITY, STATE
S_ORD: ID, DATE_SHIPPED, TOTAL
d In the text area, include all four customer fields, each field on a new line.
Copy NAME, CITY, ADDRESS, and STATE to the Mailing Label Text
area. To enter the line feeds you can either use the button or simply press
the [Return] key.
e Select the Draft template and click Finish.
Select the template on the next page.
f Save the report to a file named p4q4.rdf.
Select File—>Save As from the menu and save the file to disk.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-17
Appendix A: Solutions
.....................................................................................................................................................

5 Using the reentrant wizard, modify the report to create a Form Letter style.
Reenter the Report wizard by choosing Report Wizard from the toolbar or
selecting Tools—>Report Wizard from the menu.
On the Style tab select Form Letter.
a In the text area, enter some free-flowing text for each order. For example:
Order No. &<ID> was shipped to &<NAME> in &<CITY> on
&<DATE_SHIPPED>.
b The order has a total value of &<TOTAL> dollars.
c Add the following text: Thank you for your business.
Copy the fields that you want to use to the Form Letter Text area and
enter your free-flowing text.
d Select a different template and click Finish.
e Save the report as p4q5.rdf.
Select File—>Save As from the menu and save the file to disk.
6 Create a new report.
Use Query Builder to build the query.
Create a new report by selecting the Report node in the Object Navigator and
choosing Create Object.
As an alternative you can also select File—>New—>Report from the menu.
a Select the matrix report style.
On the first page choose Matrix.
b For the query, import the contents of p4q6.sql.
Choose Import SQL 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.
e Display the total value 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 Sum(TOTAL_VALUE) and choose Sum.
g Reduce the widths of PRODUCT_ID to 5 and all four summaries to 7.
h Change the PRODUCT_ID label to Product.
Make the necessary changes in the Labels and Width fields.

......................................................................................................................................................
A-18 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 4
.....................................................................................................................................................

Select a template that gives Landscape output (Corporate1 Landscape for


i
example).
Select the Corporate1 Landscape template and click Finish to run your
report.
j Save the report to a file named p4q6.rdf.
Select File—>Save As from the menu and save the file to disk.
7 Modify the matrix report to create a Matrix with Group.
Reenter the Report wizard by choosing Report Wizard from the toolbar or
Tools—>Report Wizard from the menu.
On the Style tab select Matrix with Group.
a Select Month as the group and check that all totals have a width of 7.
Go to the Group tab and copy MONTH to the Matrix Group Fields area.
Check on the Labels tab that all fields with a label Total: have a width of
7.
b Save the report as p4q7.rdf.
Select File—>Save As from the menu and save the file to disk.
Note: The query for the matrix reports above has been restricted to display only
products beginning with “4,” so that you can see and understand the complete matrix
more easily.
8 Create a new report and preview it in your Web browser.
a Open report p2q9.rdf and run it using the Live Previewer.
To open the file select File—>Open from the menu or choose Open from
the Toolbar. Run the report by selecting Run from the Toolbar.
b Set your preview preferences to Use HTML Style Sheets, Show Current Page,
and Generate to Web Browser
Select View—>Web Preview and select the suggested settings. Click
outside the pop-up menu.
c Preview the report in your browser.
SelectWeb Preview from the Toolbar.
d Close the browser. You are now back in the Live Previewer.
Close the browser.
e Click the Date field and press the [Delete] key. What happens next?
In the Live Previewer select the date field and press the [Delete] key. The
report reappears in the browser and reflects the change.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-19
Appendix A: Solutions
.....................................................................................................................................................

Go back to the Live Previewer window and undo this change by selecting
f
Edit—>Undo. What happens next?
Select Edit—>Undo. The report reappears in the browser and reflects the
change.
g Close the browser.
Close the browser.
h Switch off Web preview mode.
Select Web Preview from the Toolbar.
9 Web-enable a report by using the Web Wizard.
a Using the same report as in the previous exercise, invoke the Web Wizard and
click Next on the welcome page.
Select the Web Wizard from the Toolbar. Select Next in the Welcome
screen.
b In the Web Wizard, select Name from the available columns list to serve as
bookmarks.
Copy the Name field from the Available Columns to the Bookmarks.
Select Next on the wizard page.
c Add p4_9.html as a Header HTML File.
Select Browse for the Header HTML file. In the file Open dialog box select
p4_9.html and Select Open.
Select Next on the wizard page.
d Generate HTML Style Sheet output and view the result.
Select Generate HTML Style Sheet output now. Select Generate output to
a Web browser.
e In the Save File dialog box, save the file as p4q9.html.
In the Save file dialog box change the filename to p4q9.html and select
Save.
f What happens when you click on the bookmarks?
The cursor jumps to that specific part in the report.
g What happens when you click the Oracle logo in the header?
The report invokes the Oracle Website.
h Close the browser and save the report as p4q9.rdf.
Close the browser. Select File—>Save as and change the filename to
p4q9.rdf. Select Save.
i Back in Report Builder, save and close all reports.
For each open report, select File—>Save from the menu or Choose Save
from the Toolbar. Then Select File—>Close.

......................................................................................................................................................
A-20 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 5
.....................................................................................................................................................

Practice Session Overview: Lesson 5


This practice session involves modifying reports by applying changes in the Live
Previewer.

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

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-21
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 5


1 Open report p4q2.rdf. Make the following changes in the Live Previewer:
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 Report from the menu or selecting Run in the toolbar.
a Make the columns SALARY and COMM right-justified. Do not forget to
justify the column header accordingly.
Select the columns SALARY and COMM and their labels. Then choose
End Justify from the style bar or select Format—> Justify—>End from
the menu.
b Add commas and a currency symbol to SALARY. Add two decimal places.
Deselect the COMM field. While the column is selected, click Commas
from the style bar. This adds the group separators. Then click Add
Decimal Place from the style bar to add one decimal place. Repeat the
action for the second decimal place. You can also select the commas and
decimal places options from the Format menu.
c Add one decimal place and a percent sign to COMM.
While the column is selected choose Percent and then Add Decimal Place
from the style bar. You can also select the percent and decimal places
options from the Format menu.
d Edit the heading of the COMM field. Change the text to Comm Pct.
Select the label of the COMM field, then click it again to get into Change
mode. Enter your text, then click outside the label to make your changes
permanent.
e Make the total at the end of the report right-justified and add commas, a
currency symbol, and two decimal places, as in the column SALARY.
Select the column, then select End Justify from the style bar or select
Format—>Justify—>End from the menu.
While the column is selected choose Commas, Currency, and then Add
Decimal Place from the style bar. Repeat the action for the second decimal
place.
f Change the label of the total to bold font.
Select the label, then select Bold from the style bar or use Format—>Font
in the menu.
g Make whatever other changes you like.
No formal solution.

......................................................................................................................................................
A-22 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 5
.....................................................................................................................................................

hSave the report to a file named p5q1.rdf and close it.


i Invoke the report on the Web.
Open your browser and provide the URL for the report.
j Close the browser.
2 Open report p4q3.rdf. Make the following changes in the Live Previewer:
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 Report from the menu or selecting Run from the toolbar.
a Remove the border around the total for each department.
Select the column, and choose Line Color from the vertical toolbar. Select
No Line to remove the line color.
b Add commas and two decimal places to the SALARY field and the total and
make them right-justified. Do not forget to justify the column header for the
SALARY field accordingly.
Select the total, the column, and its header, then select End Justify from
the style bar or select Format—>Justify—>End from the menu.
While the column is selected choose Commas and then Add Decimal Place
from the style bar. Repeat the action for the second decimal place. You
can also select the options from the Format menu.
c Make the same changes to the total at the end of the report. Move the grand
total so that it aligns with the SALARY field (you must do this manually; use
the ruler guides to help you).
Select the column, then choose End Justify from the style bar or select
Format—>Justify—>End from the menu.
While the column is selected choose Commas and then Add Decimal Place
from the style bar. Repeat the action for the second decimal place. You can
also select the options from the Format menu.
d Change the color of the employee data heading to red.
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 iDS Reports: Build Internet Reports A-23
Appendix A: Solutions
.....................................................................................................................................................

3 Open report p5q3_a.rdf. Make the following changes in the Live Previewer:
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 Report from the menu or selecting Run from the toolbar.
a Add a date at the top center of the page. Give it any format you want.
Hint: Choose the font, style, and text color you want before inserting the date.
Select Insert Date and Time from the top toolbar or
Insert—>Date and Time from the menu.
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.rdf. Make the following changes in the Live Previewer:
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 Report from the menu or selecting Run from the toolbar.
a Right-justify the Product ID field.
Select the Product ID field, then select End Justify from the style bar or
select Format—>Justify—>End from the menu.
b Remove the border around the cell values and the parent frame.
Select the column, hold down the [Shift] key, and choose Select Parent
Frame from the style bar. Then hold down the [Shift] key and select the
column again. Select Line Color from the vertical toolbar. Select No Line
to remove the line color from both the column and the parent frame.
c Add commas and two decimal places to the cells and summaries and make
them right-justified.
Select the columns and choose End Justify from the style bar or select
Format—>Justify—>End from the menu.
While the columns are selected choose Commas and then Add Decimal
Place from the style bar. You can also select the options from the Format
menu.
d Add a gray line color to the parent frames of NAME and PRODUCT ID.
Select the column NAME and choose Select Parent Frame from the style
bar. Select Line Color from the vertical toolbar.
Repeat for the column PRODUCT.
e Save the report to a file named p5q4.rdf and close it.

......................................................................................................................................................
A-24 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 5
.....................................................................................................................................................

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 Report from the menu or selecting Run from the toolbar.
a If the salary is less than 1,000, print the field in italics.
Select the SALARY field, then choose Format—>Conditional Formatting
from the menu or use the right mouse button to open the pop-up menu
and select Conditional Formatting from the pop-up menu.
The Conditional Formatting dialog box opens. Click New and enter the
condition and formatting as required. Select a font name. Click OK to
return to the first page but do not close the dialog box.
b If the salary is more than 2,000, print the field in bold italics and make the text
color red.
Click New again and enter the second condition and formatting as
required. Click OK to return to the first page of the dialog box and then
OK again to close the dialog box.
6 Save the report to a file named p5q5.rdf and close it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-25
Appendix A: Solutions
.....................................................................................................................................................

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 Developer Release 6 installation.
You modify objects in the margin and body regions and save the template to a new
filename. Then you apply the modified template to an existing report and note the
differences.

......................................................................................................................................................
A-26 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 6
.....................................................................................................................................................

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 corp1.tdf. This file should exist in your home directory; it is a copy of
the Corporate 1 predefined template.
Select the Templates node in the Object Navigator.
Select Open and select the file named corp1.tdf.
b Display the margin region. (This usually appears by default when you open a
template.)
c Delete the Oracle buildings logo. Import summitlo.tif and place it in the top
left corner of the margin; this file should exist in your home directory.
Select the Oracle buildings logo and press the [Delete] key.
Select File—>Import—>Image from the menu.
From the File Browse window choose the file name. summitlo.tif.
Resize it to fit into the margin region.
d Add a report title:Summit Sporting Goods.
Select the Text tool from the vertical toolbar. Click inside the editor and
type in the title. Click outside the textbox to end.

e Display the body region to view the changes you will make in the next steps.
Click the Margin/Body toggle button from the toolbar in the Template
editor.
f Change the foreground color (fill color) of the section frame to white. Make
these changes general, not specific to a particular layout.
Select any of the objects and use the Select Parent Frame tool multiple
times to select the outermost frame.
Use the Fill Color palette or the property palette to change the color.
Alternative solution:
In the Object Navigator expand the Body node, the Default node, and the
Frames node. Open the property palette for the section frame.
Under the heading Style, change the Foreground Color property to White.
g Change the justification of numeric fields (number field and summary) to End.
Do not forget to change the justification of labels for number fields to End.
Select the number field and the number heading in the Template editor
and click the End justify tool from the stylebar.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-27
Appendix A: Solutions
.....................................................................................................................................................

Alterative solution:
Open the Field Labels/Headings and the Fields nodes in the Object
Navigator. Select Number in both nodes.
Open the property palette for your selections.
Click Union (the button is a toggle and the tooltip says Intersection at this
point) from the property palette toolbar to display all properties. Under
the headings Label and Fields, change the number justification to End.
Change the justification of number summary fields to End.
Select Summaries in the Object Navigator.
In the property palette change the number justifications for fields to End.
h Save the template as summit.tdf.
2 Apply the modified template to an existing report.
Hint: you must search for the template file; it does not appear in the list of
predefined templates.
Open p4q3.rdf.
a
b Apply summit.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, report title, color of section frame region
Changes not applied: Number justification
d To apply all changes to your report, you will have to create the layout again.
From the menu, select Edit—>Select All to select all layout objects. Now
delete them. Invoke the Report Wizard and reapply your template.
e Save the report as p6q2.rdf.
3 Continue to modify the template and test it using a new report.
a Change the text color of the master group fields to red for the Group Left style
only.
Hint: In the Template editor, use the Report Style list to switch to a Group Left
style. This way you can select the correct group. You may also want to use the
Zoom Out tool so that you can see the entire template layout structure, and
recognize the difference between the master group fields and the detail group
fields.
Select the Character, Number, and Date fields and change the text color
with the Text color palette.

......................................................................................................................................................
A-28 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 6
.....................................................................................................................................................

Alternative solution:
In the Object Navigator, expand the Override node, then the Group Left,
the Section (Level1), and the Fields nodes.
Bring up the property palette for all the fields
Change the text color to red.
b Save your template as summit2.tdf and close it.
c Create a new report, using the Report Wizard.
Use the layout style Group Left.
Import the query p6q3.sql from your working directory.
Make 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 summit2.tdf.
No formal solution.
d Save the report as p6q3.rdf and close it.
4 Add Web links to a template.
a Open p6q4.rdf and run the report on the Web. Close your browser.
Use the Oracle Reports web report tester or provide the URL syntax in
your browser.
b In Report Builder open the template gray.tdf.
Select the Templates node in the Object Navigator. Select Open and select
the file named gray.tdf.
c Set the necessary properties so that the template contains the Web links in the
file temp_hdr.html. The links must appear at the beginning of the
document.
In the property palette, set the Before Report Type property to file, and
Before Report Value property to temp_hdr.html (use the browse button
to locate the file).
d Save and close the template.
e Apply the template gray.tdf to the report. Save 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.
f Run the report on the Web. Try the Web links
Open your browser and provide the URL. The Web links take you to the
online book and music store amazon.com.
g Close the browser. Save the report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-29
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 7


This practice session contains:
• Using the Help system to find comprehensive information on storage types and
executables
• Converting the storage type of a report using the Convert utility
• Documenting a report using the Report on Reports utility
Because the Report Builder tables are optional in Oracle Developer, your
classroom might not have the tables available for you to save your report.
Therefore your instructor will advise you whether to attempt this question.

......................................................................................................................................................
A-30 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 7
.....................................................................................................................................................

Practice Session Solutions: Lesson 7


1 Search in the Help system for information on the RWCON60 executable.
From the menu, select Help—>Report Builder Help Topics. Enter
RWCON60 in the Find tab.
What is this executable used for?
RWCON60 enables you to convert one or more report definitions or PL/SQL
libraries from one storage format to another.
Can you compile more than one report with this utility?
Yes
When converting a report to a template, what is converted and what is not?
Only objects in the header and trailer pages and in the margin area are used
in the template. Objects in the body are ignored.
2 Use the Convert utility in Report Builder to convert a report from .rdf to .rep.
a Open p6q3.rdf, if it is not already open.
b Convert it to a .rep file.
Choose File—>Administration—>Convert from the menu.
Document Type: Report
Source Type: Report Binary File (RDF)
Source: Enter the filename, including the path, or click Browse.
Destination Type: Report Binary Run-only File (REP)
Leave Destination empty.
c What other methods could you use to compile a report?
File—>Administration—>Compile report or Ctrl T
What is the difference?
The Compile option from the menu compiles the presently selected report;
the Convert utility enables you to choose which report or reports to
compile. It also enables you to convert to other storage types.
d Convert the same report to a .rex file.
Select File—>Administration—>Convert from the menu.
Document Type: Report
Source Type: Report Binary File (RDF)
Source: Enter the filename, including the path, or click Browse.
Destination Type: Report ASCII File (REX)
Leave Destination empty.
e Open a system editor to look at the .rex file.
No formal solution.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-31
Appendix A: Solutions
.....................................................................................................................................................

3 Open the registry and investigate the setting for the REPORTS60_PATH key.
No formal solution.

If You Have Time


4 If the database product tables are installed, document a report definition that is
saved in the database.
a Save report p6q3 to the database.
Either change your preferences to be able to save to the database (Tools —
>Preferences—>Object tab)
or use the convert utility (File—>Administration—>Convert).
b Run the Report on Reports utility to produce documentation on the report
p6q3. Set the run-time parameters to output to a file in PDF format.
Choose File—>Administration—>Report on Reports.
Select report name P6Q3.
Destination Type: File
Destination Name: p6q3.pdf
Destination Format: PDF
c Open the PDF file and scroll through the documentation.

......................................................................................................................................................
A-32 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 8
.....................................................................................................................................................

Practice Session Overview: Lesson 8


This practice session contains:
• Creating a second query in an existing report
• Restricting records in a query
• Restricting records with a packaged filter
• Creating a data link
• Creating a report containing a master group with two detail groups
• Creating an external query file and referencing the file in a new report

Introduction
In this practice session, you include new data in a report by adding a query to an
existing single-query report created with the wizard. You also practice linking data
from different queries to alter the report structure. Using two different techniques, you
restrict the records in a report. If you have time, you create an external query and link
it to a report.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-33
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 8


1 Open report p8q1_a.rdf, which contains a single-query report showing customer
information.
a In the Data Model, create the following query.
QUERY: Q_ORD:
SELECT customer_id, id, date_shipped, total
FROM s_ord
bChange the group_name to G_ORD.
Open the Report Wizard and select a Tabular layout.
c Copy group G_ORD to the Displayed Groups area.
d Copy all remaining fields to the Displayed Fields area.
e Click Finish.
f Note how the data appears in the Live Previewer. The Q_CUSTOMER data
appears before the Q_ORD data. Remember that you can alter the order in
which the data is printed by modifying 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.
No formal solution.
g Save the report as p8q1.rdf. 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 group to display only the first four
customers. Run to test.
Select the group G_CUSTOMER in the Data Model and open the
property palette. Set the property Filter Type to First and enter the
number of records.
b Save the report as p8q2.rdf and close it.
c Close the report and any others you still have open in the Object Navigator.
3 Open p8q1.rdf.
a In the Data Model, link the two queries together on the primary and foreign
keys.
Select the Link tool. Click and drag from the ID column in the Customer
group to the CUSTOMER_ID column in the Ord group.

......................................................................................................................................................
A-34 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 8
.....................................................................................................................................................

bRedo the layout by opening the Report Wizard. Select the Group Above style.
Do not display CUSTOMER_ID.
c Save the report as p8q3.rdf.
d Run the report on the Web.
4 Modify p8q3.rdf to show and restrict customers’ credit rating. You need to
modify the query properties.
a Include CREDIT_RATING in the query statement, although you do not need
to display it. Restrict the query statement to show those who have a poor credit
rating.
In the Data Model select the query Q_1. Press the right mouse button to
open the SQL Query Statement or open it from the property palette.
Either enter WHERE S_CUSTOMER.CREDIT_RATING = ’POOR’ directly
in the query statement area or use the Query Builder to build the WHERE
clause.
If you use the Query Builder, click in the blank condition field Conditions
panel to activate it. Then click the column CREDIT_RATING in the
S_CUSTOMER table. Enter = ’POOR’ and press [Return].
b Save the report as p8q4.rdf and run it on the Web.
5 Create a new report that lists the sales representatives and the products they have
sold.
a Select a Group Above report style.
b Import the query file p8q5_a.sql.
c Make NAME and ID the group fields. Make sure that these fields are in one
group, at Level 1, not two separate groups.
d Do not display ID, but display all other fields in the order described in the
following table.
Hint: You can change the order of fields in the Report Wizard in the Displayed
Fields text region.
e Change the following field attributes:
Column Label Width
NAME Name 20
PRODUCT Product 10
PRODUCT_ID ID 4
QUANTITY Quantity 4
PROD_TOTAL Total 6

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-35
Appendix A: Solutions
.....................................................................................................................................................

f Use the template file summit.tdf


g Run your report.
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 p8q5_b.sql.
This query returns the customer names, their IDs, and the total sales per
customer for each sales representative.
i Ensure that the group is named G_CUSTOMER.
j Link the second query to the correct group.
Click and drag from ID in G_NAME to SALES_REP_ID in
G_CUSTOMER.
k Use the Report Wizard to display the new group. Do not display
SALES_REP_ID or ID.
l Change the following field attributes:
Column Label Width
CUSTOMER Customer 10
CUSTOMER_ID ID 4
CUST_TOTAL Total 6

m Run and test your report.


n Save the report as p8q5.rdf and close it.

If You Have Time


6 Create an External Query module that selects the following data:
Select the External SQL Queries node in the Object Navigator and choose
Create.
Columns Table
id, name s_dept
id, first_name||’ ’ ||last_name, title,salary s_emp

a Remember to include a join condition.


b Give the columns meaningful names.
Write the following query:
SELECT S_DEPT.ID DEPT_ID
, S_DEPT.NAME DEPARTMENT
, S_EMP.ID EMP_ID
, S_EMP.FIRST_NAME ||’ ’|| S_EMP.LAST_NAME EMPLOYEE

......................................................................................................................................................
A-36 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 8
.....................................................................................................................................................

, S_EMP.TITLE
, S_EMP.SALARY
FROM S_DEPT, S_EMP
WHERE S_EMP.DEPT_ID=S_DEPT.ID
cSave the query as p8q6.sql and close the query window.
7 Use the Report Wizard to create a Group Left report using the external query
created in question 6.
a Department information should be in the master group.
b Look at the Data Model. Notice that the break group exists.
c In the Data Model, move TITLE into a group at the top of the hierarchy.
Hint: Move it into the Department group first, and then up into its own new
group.
Click and drag TITLE to the Department group, then up again to make a
separate group.
Note: Because this is a single-query report, you can also make the group change
using the Report Wizard Group tab. However, you have learned that you can
combine many queries and groups in your own reports, and this simple exercise
helps you to practice moving columns in the Data Model.
d Open the Report Wizard and click Finish to update the layout and run the
report.
e Save the report as p8q7.rdf and close it.
f Run and test the report on the Web.
8 Create a new report using a ref cursor query.
a In the Object Navigator, create a client-side package defining a record and a ref
cursor. The record has the following fields:
Name Definition
last_name s_emp.last_name%type
first_name s_emp.first_name%type
salary s_emp.salary%type

Create a new report manually. Select the Program Units node in the
Object Navigator and click Create.
In the New Program Unit dialog box enter a name for the package and
choose Package Spec.
Enter the code for the package specification.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-37
Appendix A: Solutions
.....................................................................................................................................................

PACKAGE RefCur IS
TYPE EmpRec IS RECORD ( last_name s_emp.last_name%TYPE,
first_name s_emp.first_name%TYPE,
salary s_emp.salary%TYPE);
Type EmpCur IS REF CURSOR RETURN EmpRec;
END;

You can also import the text file p8q8a.txt. While the PL/SQL editor is active
and the cursor is in the text area, select File—>Import Text from the menu to
import the text file.
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 s_emp
Note: You can import the p8q8b.txt file.
Write the following function or import the text file p8q8b.txt:
FUNCTION QR_1RefCurDS RETURN RefCur.EmpCur IS
V_EmpCur RefCur.EmpCur;
BEGIN
OPEN V_EmpCur
FOR
SELECT last_name, first_name, salary
FROM s_emp;
RETURN V_EmpCur;
END;
cOpen the Report Wizard to create the layout for the report. Select all the fields and
choose a template.
d Run and test the report.
e Save the report as p8q8.rdf and close it.
If you still have any objects open in the Object Navigator, close them all.

......................................................................................................................................................
A-38 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 9
.....................................................................................................................................................

Practice Session Overview: Lesson 9


This practice session contains:
• Creating a new report with summaries
• Opening an existing report to add summary calculations to the columns
• Creating a report that displays the contents of a file in a column
• Creating a new report with ranking summary columns
(Use the ORDER BY clause to create the ranking effect.)
• Opening an existing report to add placeholders for the highest and lowest values in
the report

Introduction
In your reports, you may need to include additional columns with summary
functions—or even add summaries, such as break totals and report totals. This practice
gives you the opportunity to create summaries and additional columns with
functionality that cannot be achieved using SQL alone.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-39
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 9


1 Create a new report using the Report Wizard. Select a Group Above report style.
a Display the following data:
Table Column Definition Group Label Width
s_ord id G_ord Ord. No. 4
date_ordered Order Date 9
s_item item_id G_item No. 2
product_id Product No. 5
price Price 4
quantity_shipped Quantity 4
line_total price*quantity_shipped Total 4

b Do you need a formula column to calculate the line_total?


No, it is a much better solution to do the calculation directly in the query.
Enter the formula price*quantity_shipped into the query text and give
it an alias name of line_total.
You can also use the Query Builder to create expressions in the query.
Select the table S_ITEM.
Select Define Column.
Click inside the Defined Columns box.
Enter Line_Total.
Click inside the Defined As box.
Enter the expression price*quantity_shipped.
Click OK.
c Create the following summaries. Can you use the Report Wizard to create the
summaries?
Because this is a single query report you can use the Report Wizard.
Column Summary
line_total sum
line_total % Total

d Use the summit.tdf template file from the file system.


In the Template tab choose and apply the template. Finish and run the
report.
e In the Data Model, rename the groups to G_ORD for the break group and
G_ITEM for the detail group. Alter the position of columns in the G_ORD
group so that DATE_ORDERED is above ID, and change the break order on
DATE_ORDERED so that it is sorted in descending order.

......................................................................................................................................................
A-40 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 9
.....................................................................................................................................................

Open the property palettes for each group and change the names.
Click on DATE_ORDERED and drag it above ID; be careful not to drag
it outside the group.
Open the property palette for DATE_ORDERED and change the Break
Order property to Descending.
f Run and test the report (do not reenter the wizard).
g Save the report as p9q1.rdf and close it.
2 Open report p8q5.rdf.
a Add a summary to total PROD_TOTAL for each employee master. Can you
use the Report Wizard?
Because this is a multiquery report, you have to create all summaries
manually unless you created them with the first query.
Select Summary Column in the vertical toolbar and click inside the group
G_NAME. This creates a new summary.
Open the property palette for the new column and name it REP_TOTAL.
In the Summary section select the function Sum.The Source is
PROD_TOTAL.
Reset at G_NAME.
b Create columns to show the percentage of the total per sales representative for
PROD_TOTAL and CUST_TOTAL.
Select Summary Column in the vertical toolbar and click inside the group
G_PRODUCT. This creates a new summary.
Open the property palette for the new column and name it PCT_PROD.
In the Summary section select the function % of Total.
The Source is PROD_TOTAL.
Reset at G_PRODUCT.
Compute at G_NAME.
Select Summary Column in the vertical toolbar and click inside the group
G_CUSTOMER. This creates a new summary.
Open the property palette for the new column and name it PCT_CUST.
In the Summary section select the function % of Total.
The Source is CUST_TOTAL.
Reset at G_CUSTOMER.
Compute at G_NAME.
c Make all the new summaries four characters wide.
d Save the report as p9q2.rdf and close it.
e Run the report on the Web.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-41
Appendix A: Solutions
.....................................................................................................................................................

3 Create a new report using the Report Wizard.


a Select a Tabular report style and display the following information:
Table Column Label
s_product id Id
name Name
short_desc Description
s_image filename Picture

Restrict the query to return only products with ID beginning with 10 or 30


b
because you do not have picture files for all products.
Enter the following to the WHERE clause:
AND (S_PRODUCT.ID LIKE ’10%’
OR S_PRODUCT.ID LIKE ’30%’)
into the query.
You can also use the Query Builder to create complex WHERE clauses.
Click in the condition fields in the Conditions panel. Then select the
column ID from the S_PRODUCT table. This copies the name of the
column into the condition field.
Enter LIKE ’10%’ into the condition field and press [Return].
Enter S_PRODUCT.ID LIKE ’30%’ and press [Return].
You will see AND in the box to the left.
To put an OR between the two conditions select AND, then select Or from
the toolbar.
c Run the report.
d In the Data Model, change the properties for the column “filename” to read
from file, file format image.
e Use the Report Wizard to redo the layout.
f In the Live Previewer, resize the picture column to about 1.5*1.5 inches.
Hint: You need to enable Flex Mode. Use the last image on the page to resize
the picture column
g Save the report as p9q3.rdf and close it.
4 Open report p9q1.rdf to list the orders ranked by their total.
a In the Data Model, add a new column S_ORD.TOTAL to the query.
Hint: You will have to move the new column TOTAL to the G_ORD group.
Any new column is added in the lowest group, so you must move it up to
G_ORD.

......................................................................................................................................................
A-42 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 9
.....................................................................................................................................................

b Because you want to list the highest total first, set the break order for TOTAL
accordingly, and move the TOTAL column so that it is first in the G_ORD
group.
Set the break order for TOTAL to Descending. Click and drag TOTAL to
be the first column in the group G_ORD.
c To display the ranking add another column called RANK in the group G_ORD.
Create a summary column in the group G_ORD.
Name it Rank. Select the function Count.
The Source is ID.
Reset at Report.
d Use the Report Wizard to display the rank, giving it a width of 2. You do not
need to display the total, because there is already a total on the G_ITEM group.
e Run the report to test.
f Save the report as p9q4.rdf and close it.

If You Have Time


5 Open report p9q1.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 ID, as well as the minimum order total and the
corresponding ID.
Hint: You need one formula column and some summaries and placeholders.
You can import the code for the formula column from the file p9q5.txt.
At report level create two summary columns:
Name Function Source Reset At
CS_Max Maximum SumLineTotalPerID Report
CS_Min Minimum SumLineTotalPerID Report

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-43
Appendix A: Solutions
.....................................................................................................................................................

a (continued)
Also at report level create two placeholder columns. Name them
CP_Maxid and CP_Minid. This is where the IDs of the highest and lowest
orders will go.
Create a formula column in the upper group and name it CF_GetIds.
Return number 1 (although it does not really matter what you return if
the formula column is a character type).
The PL/SQL formula is the following:
function CF_GetIdsFormula return Number is
begin
if :SumLine_TotalPerId = :CS_Max then
:CP_Maxid := :ID;
end if;
if :SumLine_TotalPerId = :CS_Min then
:CP_Minid := :Id;
end if;
return (1);
end;

b Use the Report Wizard to put the new columns into the layout. Display the
maximum order total, the maximum ID, the minimum order total, and the
minimum ID.
Display columns CS_Max, CS_Min, CP_Maxid, and CP_Minid. Give
them more meaningful labels.
c Run the report to test. Scroll down to the last page to see the new columns.
d Save the report as p9q5.rdf and close it.

......................................................................................................................................................
A-44 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 10
.....................................................................................................................................................

Practice Session Overview: Lesson 10


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 button to display a multimedia column
• Modifying an existing report to add a repeating frame to the header section
displaying order information.
• Opening an existing report and adding flexible lines
• Modifying an existing report to anchor a boilerplate object to an outer frame

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 investigate the layout hieraarchy add flexible lines to a frame
and anchor one object to another.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-45
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 10


1 Open report p9q4.rdf. Modify the report as follows:
a Create a header section.
Open the Layout Model editor. Select Header Section from the horizontal
toolbar or choose View—>Layout Section—>Header Section from the
menu. Make sure that you are editing the Body region, not the Margin.
Display the summitlo.tif file as fixed boilerplate in the Body region.
Select File—>Import—>Image from the menu to import 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 logo inside.
Select Fill Color from the vertical toolbar.
Place the logo on top of the rectangle. Center the two objects.
Select the rectangle and Select Arrange—>Send To Back from the menu.
Select the logo, press the [Shift] key, and select the rectangle.
Select Arrange—>Align Objects from the menu. In the dialog box select
Align to Each Other and then Align Center both horizontally and
vertically. Click OK.
Hint: Use the Arrange option from the menu.
b Add a report title in the body region.
Use Arial bold as the font and 18 as the size.
Click the Text tool from the vertical toolbar and click in the layout area.
Enter the text and click outside the text object.
While the text object is selected, choose font and size from the stylebar.
c Add a trailer section that displays today’s date with the text “End of report run
on: ” in the body region. Select a larger font.
Hint: Copy and paste the date from the Margin Area of the report.
Select Trailer Section from the horizontal toolbar, or Select View—
>Layout Section—>Trailer Section 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 Margin from the horizontal toolbar, or select Layout Section—
>Margin View from the menu.
Select the f_date1_sec2 field and then select Edit—>Copy from the menu.
Select Trailer from the horizontal toolbar, or select Layout Section—

......................................................................................................................................................
A-46 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 10
.....................................................................................................................................................

>Trailer View from the menu. Deselect Edit Margin.


Select Edit—>Paste from the menu and move the field to the desired
place.
d Save the report as p10q1.rdf and close it.
e Run the report on the Web.
2 Open report p9q3.rdf and modify it to display the product picture in a separate
window.
a Delete field F_FILENAME from the body region of the main section in the
Layout Model (not the column from the Data Model).
Open the Layout Model editor. Select Body from the horizontal toolbar or
select View—>Layout Section—>Main Section from the menu.
Select the f_filename field and press [Delete].
b Add a button to display the picture from the multimedia column.
Give it a meaningful label. In the Object Navigator, change the name to
PICTURE_BUTTON.
Click the button tool from the vertical toolbar and create a button in place
of the f_filename field.
Make the following changes in the property palette:
Property Value
Label Type Text
Text Picture
Type Multimedia Column
Multimedia Column Filename

c Resize the other layout fields to .25 inch in height.


Hint: Use the Arrange option on the menu.
Select all the layout fields by shift-clicking them.
Select Arrange—>Size Objects from the menu.
Select Custom for height and enter .25.
d Make the button the same size.
Hint: Use the Arrange option on the menu.
e Give all fields and the button the same vertical alignment.
Hint: Use the Arrange option on the menu.
Align the fields and the button using Arrange—>Align Objects from the
menu.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-47
Appendix A: Solutions
.....................................................................................................................................................

Resize the repeating frame and all enclosing frames to be just large enough to
f
fit the fields inside.
Hint: Think of Flex Mode.
Enable Flex Mode and resize the repeating frame.
g Save the report as p10q2.rdf and close it.
h Run and test your report. Do not use the Live Previewer; use Reports Runtime.
i Select File—>Administration—>Convert to convert the .rdf file into a
.rep file. Now invoke the Reports Runtime and test your report.
3 Open report p9q1.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 Layout Model editor. Select Header Section from the horizontal
toolbar, or choose View —>Layout Section—>Header Section from the
menu. Make sure that you are editing the Body region.
Select the Additional Default layout tool from the vertical toolbar and
click in the Layout area. In the Report Wizard
select a tabular layout.
Select the group G_ORD and give a print direction down.
Select the fields ID, DATE_ORDERED, and SumLinetotalPerId.
b Add “Executive Summary” as boilerplate text in the margin region of the
Header section.
From the vertical toolbar, choose Edit Margin. Select the Text tool and
create the boiler plate text.
c Set the distribution for the header section to an HTMLCSS file.
In the Object Navigator, open the Property Palette for the Header Section.
Select the Distribution property. In the Distribution Dialog box set the
distribution ID, desname, and desformat fields. Make sure the output
format is HTMLCSS.
d Set the distibution for the main section to a PDF file.
In the Object Navigator, open the Property Palette for the Main Section.
Select the Distribution property. In the Distribution Dialog box set the
distribution id, desname, and desformat fields. Make sure the output
format is PDF. Save the report.
e Compile the report to generate a .rep file.
f Run and test the report using the Distribute facility in the Reports Runtime.
In the Reports Runtime, select File—>Distribute.

......................................................................................................................................................
A-48 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 10
.....................................................................................................................................................

Look at the output generated for both file formats.


g
Locate the files in your file system and double-click each of them to look at
the output.
h Save the report as p10q3.rdf and close it.
4 Open report p5q3.rdf.
a Use the Report Wizard to give last_name and first_name a width of 6 (you can
also do it directly in the Layout Model or from the Live Previewer).
b Add flexible lines vertically between the fields.
Select the line tool from the vertical toolbar. Create lines between the
fields. If you want to ensure that the lines are vertical, press the [Shift] key
while drawing. Make the lines the same height as the fields using the
Arrange—>Size Objects menu option.
In the property palette, set Line Stretch with Frame to
R_G_LAST_NAME.
c Run and test the report using the Live Previewer.
d Save the report as p10q4.rdf.
5 Open and run report p2q10.rdf.
a Using the Live Previewer, compare the output with s10q5a.rdf. What is
different? Change the report so that it looks like s10q5a.rdf.
Both are master detail reports. But in s10q5a.rdf the groups are
intermixed.
b Fully expand the Layout Model node for p2q10.rdf.
Select the Layout Model node for p2q10.rdf. Then select Expand All in
the Vertical toolbar.
c Open the Layout Model Editor 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.
Select Confine Mode in the Horizontal toolbar. Click and drag the
F_EMPLOYEE field down 2 inches. Notice where the field is being placed
in the object hierarchy.
e Resize the R_G_EMPLOYEE frame so that it only encloses the F_SALARY
and F_TITLE fields.
In the Object Navigator, select R_G_EMPLOYEE. In the Layout Editor,
resize the frame.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-49
Appendix A: Solutions
.....................................................................................................................................................

f Resize the M_G_EMPLOYEE_GRPFR frame so that it encloses the


R_G_EMPLOYEE repeating frame.
In the Object Navigator, select M_G_EMPLOYEE_GRPFR. In the
Layout Editor, resize the frame.
g Move the F_NAME and F_ID fields to the right.
Click and drag the fields to the right.
h Create a new repeating frame in the free space. Set the Line color attribute to
No line.
Select Repeating Frame form the Vertical toolbar. Click and drag an area
in the space previously occupied by F_NAME AND F_ID.
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.
i Link the repeating frame to the G_EMPLOYEE group.
Open the property palette 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 p10q5a.rdf and invoke the Live Previewer. 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 Arrange—>Bring to
Front. The field is now enclosed by R_1.
m Rearrange the column headers.
Click and drag the column headers to match the column positions.
n Save the report and invoke the Live Previewer.
The two data groups are now intermixed.
o Close the report. Save as p10q5a.rdf.

If You Have Time


6 Continue with report p10q4.rdf.
a Add boilerplate and anchor it to halfway down the right side of the Report
Group frame.
Hint: To ensure that you get the right frame, select the frame
M_G_LAST_NAME_GRPFR. You can use either the Object Navigator or the
Select Parent Frame tool. Pull the frame out slightly to the right. After you

......................................................................................................................................................
A-50 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 10
.....................................................................................................................................................

have fastened your anchor, you can make it smaller again.


Select the Text tool from the vertical toolbar and click to the right of the
layout objects. Enter the text and click outside the text object.
Give it a line color. This makes it easier to click on the edge.
Click on a field and choose Select Parent Frame from the style bar twice to
select the group frame. Drag the right edge a little to the right to make the
frame larger.
Select the Anchor tool from the vertical toolbar and click the left edge of
the boilerplate text object. Then click the right edge of the group frame.
You can press the [Shift] key while you create the anchor to anchor it at
50% of the edges or you can make the adjustments later in the property
palette of the anchor.
Move the boilerplate so that the anchor is a straight horizontal line.
Resize the group frame to its original size.
b Run the report and check that the text is half way down the data output.
c Rerun the report, this time displaying only 10 rows. The boilerplate should still
be half way down the data output.
Create a group filter in the Data Model editor to restrict the number of
records.
d Save the report as p10q5.rdf and close it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-51
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 11


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 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-52 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 11
.....................................................................................................................................................

Practice Session Solutions: Lesson 11


1 Create a new break report showing each customer and the relevant orders.
a Use external query p11_1ext.sql to create the report.
In the Report Wizard use Import SQL Query.
b Create a group above master detail report with all the customer data in the
break group. Create a sum for the quantity shipped. Use the Corporate2
template.
The break group should contain all the fields from the s_customer table.
Create totals by using the Sum function on the quantity shipped column.
Use the template Corporate2.
c Modify the width for the fields listed below:
Column Width
NAME 20
ADDRESS 20
CITY 15
STATE 10
ZIP_CODE 10
COUNTRY 15

Resize the customer repeating frame to 3 inches high.


d
In the object navigator, select the R_G_CUSTID group. Open the Layout
Editor. Select Flex Mode and use the central handle on the bottom edge of
the repeating frame to resize it to 3 inches high.
e Run the report. What do you see?
Some of the customer master records print without their detail order
information.
f Ensure that no customer data displays without details.
Open the repeating frame’s property palette and set the Page Protect
property to Yes.
g Save the report as p11q1.rdf.
h Run the report.
2 Open p11q2_a.rdf.
a In the Margin region of the report’s Main Section import image
dinner1.bmp. Create a rectangle around it and give it a solid fill.
In the Layout Editor, select Edit Margin. Then from the menu select

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-53
Appendix A: Solutions
.....................................................................................................................................................

File—> Import—>Image and browse for dinner1.bmp. Click OK.


From the Vertical toolbar, select Rectangle. Click and drag a rectangle.
Give it a solid fill. From the menu, select Arrange—>Send to Back.
b When you click on the image in HTML output you want to open a local .pdf
file named mousse.pdf.
Open the property palette for the image and set the hyperlink property.
You can copy the pathname from dinhyper.txt.
c Save the report as p11q2.rdf and run it on the Web (HTML output).
Save and run the report on the Web using as the HTML output format.

......................................................................................................................................................
A-54 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 12
.....................................................................................................................................................

Practice Session Overview: Lesson 12


This practice session contains:
• Modifying the printing of a mailing label report
• Controling the number of records on a page
• Adding a link file to a report
• Ensuring that all details of a master are printed on the same page

Introduction
Modify a mailing label report to ensure you fill the printed page with label records.
You then restrict the number of labels that are printed on each page.
You add a link file to display a company logo by dynamically referencing a file at run
time.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-55
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 12


1 Open report p4q4.rdf.
Modify the layout so that the mailing labels are 2 inches wide and 1 inch high.
a
Use the Arrange option on the menu. Ensure that the company names are
printed in alphabetical order across the page.
Open the Layout Model editor and select the repeating frame. From the
menu, select Arrange—>Size Objects. Select custom for both width and
height and enter the width in the fields. You can also drag and resize the
repeating frame in the Layout Model editor.
Add an ORDER BY clause to the query.
b Give each label a solid fill.
Select Fill Color from the vertical toolbar and select a color.
c Make the boilerplate object 1.8 inches wide and center it horizontally and
vertically in the repeating frame.
Select the boilerplate object in the Layout Model editor and choose
Arrange—>Size Objects from the menu. Select custom for the width and
No Change for the height. Enter the width in the field below.
Select both the boilerplate object and the repeating frame and choose
Arrange—>Align Objects from the menu.
d Add spacing between the labels: .25 inch between each column of labels across
the page; .5 inch between each row of labels down the page.
Select the repeating frame and open its property palette. Set Horizontal
Space Between Frames to .25 and Vertical Space Between Space to .5.
e Save the report as p12q1.rdf.
2 Continue with report p12q1.rdf.
a Modify the report so that only six labels are printed on each page.
Select the repeating frame and open its property palette. Set Maximum
Records per Page to 6.
b Save the report as p12q2.rdf and close it.
3 Open p9q1.rdf.
a On the operating system, copy the file summitlo.tif to a file logo.tif.
Ask your instructor for help if needed.
b Delete the logo in the margin area and create a link file 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 Link File tool from the vertical toolbar and

......................................................................................................................................................
A-56 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 12
.....................................................................................................................................................

create an external boilerplate object in the margin region where the logo
was. Set the following properties:
Note: Do not include a file pathname.
Property Value
Name B_logo
Source File Format Image
Source File Name logo.tif

Run the report.


c
d On the operating system, copy any other .tif file to logo.tif.
e Rerun your report.
f Save the report as p12q3.rdf.
4 Continue with report p12q3.rdf.
a Ensure that all items of one order are printed on the same page.
Select Edit Margin from the horizontal toolbar. Open the property palette
for the repeating frame R_G_ID and set the property Page Protect to Yes.
b Save the report as p12q4.rdf and close it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-57
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 13


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-58 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 13
.....................................................................................................................................................

Practice Session Solutions: Lesson 13


1 Open report p12q3.rdf.
a In the Report Wizard, add the following columns from the S_CUSTOMER
table. Create a new group for the customer information above the Order group.
Column Label Width
NAME 30
ADDRESS 30
CITY 30

Create a reference to a bind parameter P_CUSTOMER in the query to restrict


orders to the parameter value you input at run time.
Note how Reports creates the parameter automatically.
Add the following to the WHERE clause of the query:
AND s_customer.id =:p_customer
Run and test the report with valid customer IDs.
b
Choose any number in the range 201 to 215.
c Save the report as p13q1.rdf. Do not close it.
2 Continue with report p13q1.rdf.
Add a list of values to select any valid customer ID in the S_CUSTOMER
table. Do not allow users to enter any other value. The list should display
customer names, not ID numbers.
In the Object Navigator, expand the Data Model node and the User
Parameter node.
Open the property palette for the P_CUSTOMER parameter and make
sure that the datatype is Number.
In the parameter property palette, select List of Values.
In the dialog box, choose Select Statement.
Make sure that the Restrict List to Predetermined Values check box is
selected.
Select the Hide First Value check box.
Enter the following statement in the Enter Query area:
SELECT id, name
FROM s_customer
ORDER BY name

d Save the report as p13q2.rdf. Do not close it for the moment.


e Run and test the report on the web with different values.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-59
Appendix A: Solutions
.....................................................................................................................................................

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. Replace the 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 Parameter node to create a parameter.
Select the parameter name P_1 and change it to P_ORDER.
Open the parameter property palette.
Make sure that the datatype is Character and increase the width to 50.
Enter an Initial Value:
ORDER BY s_emp.last_name
In the Data Model, open the query property palette and add the following
lexical reference to the end of the query:
&P_ORDER
b Add a static list of values. Code two or three alternative ORDER BY clauses.
Allow any clause to be entered at run time.
In the parameter property palette select List of Values.
In the dialog box choose Static Values and enter other ORDER BY clauses
in the Value field; for example:
ORDER BY s_emp.last_name
ORDER BY s_emp.title
For each value, remember to select Add>> to add the value to the list.
Clear the Restrict List to Predetermined Values check box.
c Run the report to test.
Select an ORDER BY clause from the list.
Enter your own ORDER BY clause.
Delete the default parameter value.
d Save the report as p13q3.rdf and close it.
4 Continue with report p13q2.rdf.
a Create a default parameter form.
Include a Title message but not a Hint message.
Display the parameters DESNAME and P_CUSTOMER.
Select Tools—>Parameter Form Builder from the menu.
Enter your own Title message. Delete the Hint message.
Select DESNAME.
P_CUSTOMER is already selected.

......................................................................................................................................................
A-60 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 13
.....................................................................................................................................................

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 Run the report using the Live Previewer to test.
d Save the report as p13q4.rdf and close it.
e Run the report on the Web.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-61
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 14


This practice session contains:
• Using the Chart Wizard to create a chart in an existing report
• Altering the chart with the Chart Wizard
• Creating charts in an existing report that will be printed once for each record of a
group

Introduction
In this practice session you open existing reports to add charts using the Chart Wizard.
You also reenter the Chart Wizard to change the characteristics of a chart.

......................................................................................................................................................
A-62 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 14
.....................................................................................................................................................

Practice Session Solutions: Lesson 14


1 Open report p13q1.rdf.
a Remove all reference to the parameter P_CUSTOMER
Open the Data Model editor.
Use the right mouse button to open the Query dialog box.
Delete the row:
AND S_CUSTOMER.ID = :P_CUSTOMER
In the Object Navigator, delete the paramter from the User Parameters
node.
Open the Parameter Form Editor and delete all objects.
b Rename SumtotalPerNAME to Cust_total (a shorter, more meaningful name
looks better in a chart).
Open the property palette for SumLine_totalPerNAME to change the
name, or make the change in the Object Navigator.
c Use the Chart Wizard to create a line chart.
Select Tools—>Chart Wizard from the menu and enter the following
properties in the wizard pages:
Chart Type Line
Chart Subtype Plain
Category NAME
Value CUST_TOTAL
Position At the beginning of the report
File Name p14q1.ogd

dRun report to test. Resize the chart if necessary.


e Close the Graphics Batch.
f Save report to p14q1.rdf.
2 Reenter the Chart Wizard to change the characteristics of the chart created in the
previous exercise.
Make sure that the chart is selected; otherwise you will create a new chart.
Select Chart Wizard from the horizontal toolbar or Tools—>Chart Wizard
from the menu.
a Give the chart the following characteristics:
Enter the following properties in the wizard pages:

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-63
Appendix A: Solutions
.....................................................................................................................................................

Title Ordertotal per Customer


Chart Style Column
Chart Subtype Depth
Filename p14q2.ogd

Run the report to test.


b
c Close the Graphics Batch.
d Save report to p14q2.rdf and close it.
3 Open report p8q5.rdf.
a Use the Chart Wizard to create a pie chart for the data group G_PRODUCT.
Select Chart Wizard from the horizontal toolbar or Tools—> Chart
Wizard from the menu, and enter the following properties in the wizard
pages:
Chart Type Pie
Chart Subtype Plain
Data Group G_PRODUCT
Category PRODUCT_ID
Value PROD_TOTAL
Chart Frequency Once per Name
Filename p14q3a.ogd

In the Layout editor, move the chart beneath the product group and resize it to
b
the same width as the product group.
Select the chart and drag it below the product group frame. You must
enable Flex Mode. Do not forget to turn it off again when you have
finished.
Select the group frame and the chart and select Arrange—>Size Objects
from the menu to resize the chart.
c Run and test the report.
d Close the Graphics Batch.
4 Create a report containing a chart hyperlink.
a Open p14q4a.rdf and run the report using the Live previewer.
b Open p14a4b.rdf and run the report using the Live Prewviewer.
c Create a chart hyperlink to invoke p14q4b.rdf when you run
p14q4a.rdf on the Web and click the pie chart.

......................................................................................................................................................
A-64 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 14
.....................................................................................................................................................

Note: The name of the user parameter in the detail report is p_cust. The
customer name should be passed to the detail report.
In the Object Navigator, select the pie chart object in module
p14q4a.rdf and open its Property Palette. Set the Chart Hyperlink
property to the following:
/dev60cgi/rwcgi60.exe?p14q4b+&<name>
d Save the report and test the chart hyperlink.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-65
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 15


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

......................................................................................................................................................
A-66 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 15
.....................................................................................................................................................

Practice Session Solutions: Lesson 15


1 Open report p4q6.rdf.
aUse the Report Wizard to apply a template file to the report. The file
corpmat.tdf should be located in your working directory. The new template
gives you spaces between the layout objects to make it easier to see the
different objects in the Layout editor.
b How many repeating frames do you have?
There are two repeating frames, R_G_NAME and R_G_PRODUCT_ID.
c Change the properties of the cell object to display zero for a null value.
Open the property palette for F_SumTOTAL_VALUE and set Value if
Null to 0.
d Run and test the report.
All cells without a value now display 0.
e Close the report without saving it.
2 Create a new report, importing the external query p4q6.sql from your working
directory.
Select File—>New—>Report from the menu, or open a new report in the
Object Navigator. Use the Report Wizard.
a Select the following settings:
Report Style Matrix
Query Import file p4q6.sql
Matrix Row Fields Level 1 - Month
Level 2 - Name
Matrix Column Fields Product_id
Matrix Cell Fields Sum of total_value
Matrix Totals Sum of the cell field

b Change the labels and widths for the following fields:


Field Label Width
NAME Customer 10
PRODUCT_ID Product 5
MONTH Month 4
SUMTOTALVALUE Total 5
All Summaries Total: 5

c Use corpmat.tdf as the template.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-67
Appendix A: Solutions
.....................................................................................................................................................

d Save the report as p15q2.rdf. Run the report on the Web.


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 editor to create summaries for each month and for the
level month and product.
Create both summaries in the cross product group.
Use the following settings:
Property Value
Name SumMonth
Product Order G_MONTH
Function Sum
Source SumTOTAL_VALUE
Reset At G_MONTH

Property Value
Name SumMonthProduct
Product Order G_MONTH G_PRODUCT_ID
Function Sum
Source SumTOTAL_VALUE
Reset At G_PRODUCT_ID

g Use the Layout editor 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

Select the Field tool from the vertical toolbar.


Create a field below F_SumSumTOTAL_VALUEPerNAME. Position the

......................................................................................................................................................
A-68 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 15
.....................................................................................................................................................

field in the R_G_MONTH repeating frame but outside any other


repeating frames.
Set the following properties:
Property Value
Name F_SumMonth
Source SumMonth

Run and test the report using the Live Previewer.


h
i Save the report as p15q2.rdf. Do not close it.
3 Continue with the report from the previous exercise.
a Add zeros for null values in the cells.
Open the property palette 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 palette 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 and test the report using the Live Previewer.
f Save the report as p15q3.rdf and close it.

If You Have Time


4 Open the report as p15q3.rdf.
a Make the necessary changes in the Data Model editor to include the product
name.
Use the right mouse button to open the Query dialog box.
The query should read:

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-69
Appendix A: Solutions
.....................................................................................................................................................

SELECT S_CUSTOMER.NAME
, S_ITEM.PRODUCT_ID
, SUM(S_ITEM.PRICE*S_ITEM.QUANTITY_SHIPPED) TOTAL_VALUE
, TO_CHAR(S_ORD.DATE_ORDERED, ’MM/RR’) MONTH
, S_PRODUCT.NAME PRODUCT
FROM S_CUSTOMER, S_ITEM, S_ORD, S_PRODUCT
WHERE S_ITEM.PRODUCT_ID LIKE ’4%’
AND S_ITEM.ORD_ID=S_ORD.ID
AND S_PRODUCT.ID=S_ITEM.PRODUCT_ID
AND S_ORD.CUSTOMER_ID=S_CUSTOMER.ID
GROUP BY S_CUSTOMER.NAME
, S_ITEM.PRODUCT_ID
, TO_CHAR(S_ORD.DATE_ORDERED, ’MM/RR’)
, S_PRODUCT.NAME
b In the Layout Model, editor delete the product_id field and insert a
boilerplate object to display the product name. Rotate this object by
90 degrees.
Note: You may have to expand the R_G_PRODUCT_ID frame and the
outermost frame. Watch out for frequency errors.
Select F_PRODUCT_ID and press [Delete].
Select the Text tool from the vertical toolbar and create a text object in the
place of the F_PRODUCT_ID field.
Enter: &PRODUCT.
Select the boilerplate object.
Select the Rotate tool from the vertical toolbar.
Press [Shift] and click the boilerplate object to rotate it by 90 degrees.
Open the property palette for the boilerplate object and set Vertical and
Horizontal Elasticity to Variable.
Open the data model and ensure that the G_PRODUCT_ID group
contains the PRODUCT column by dragging it in there.
c Save the report as p15q4.rdf and close it.
d Run and test the report on the Web using a format of PDF or
HTMLCSS.

......................................................................................................................................................
A-70 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 16
.....................................................................................................................................................

Practice Session Overview: Lesson 16


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
layout versions 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 iDS Reports: Build Internet Reports A-71
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 16


1 Create a new report, using p16q1.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:
Create a new report, using the Report Wizard.
Import the SQL Query from file p16q1.sql.
Display the following fields. Select Labels and other properties as you
wish.
Group Column
G_CUSTOMER CUSTOMER_ID
G_ID ID
DATE_ORDERED
DATE_SHIPPED
PAYMENT_TYPE
TOTAL

c Create a Tabular layout using the following columns from the query:
In the Layout Model editor select the Additional Default Layout tool from
the vertical toolbar.
Display the following fields. Select Labels and other properties as you
wish.
Column
ID
DATE_ORDERED
DATE_SHIPPED
TOTAL

d Ensure that only the Group Above layout is displayed when you select a
destination of Screen, and that only the Tabular layout is displayed when you
select a destination of Preview.
Create a format trigger on the M_G_CUSTOMER_ID_GRPFR group
frame in the first layout or use conditional formatting.
function M_G_CUSTOMER_ID_GRPFRFormatTrigger return BOOLEAN is
begin
if:destype = ’Screen’ then
return(true);
else
return(false);
end if;
end;

......................................................................................................................................................
A-72 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 16
.....................................................................................................................................................

Create a format trigger on the M_G_ID_GRPFR1 group frame in the


second layout with the reverse logic or use conditional formatting:
function M_G_ID_GRPFR1FormatTrigger return BOOLEAN is
begin
if :destype = ’Preview’ then
return(true);
else
return(false);
end if;
end;
Create an anchor from the top edge of the second layout group frame up
to the bottom edge of the first layout group frame.
Open the anchor property palette, and set the Collapse Vertically
property to Yes.
Alternatively, ensure that there is almost no space between the two
layouts, so that there is no extra white space at the top of the report when
the second layout is output.
To test the result, display the DESTYPE parameter in the report.
Create a field to display the system parameter DESTYPE.
Make sure that you can enter a parameter value at run time.
Select Tools—>Parameter Form Builder from the menu to create a
parameter form.
Test the report by changing the Destination Type parameter on the
Runtime Parameter Form.
e Save the report as p16q1.rdf.
2 Continue with the previous report.
a Modify the report so that the Tabular (Preview) layout displays an extra
column that indicates, with an asterisk, those orders that were shipped more
than 15 days after the order date.
Create a new Program Unit, either from the Program menu or in the
Object Navigator. Create a function called ASTERISK:
function asterisk(odate date, sdate date)
return varchar2 is
begin
if odate + 15 < sdate then
return(’*’);
else
return(’’);
end if;
end;

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-73
Appendix A: Solutions
.....................................................................................................................................................

In the Data Model editor, create a formula column in


the detail group G_ID.
Open the property palette and alter the following
properties for the column CF_ASTERISK:
Name Datatype Width
CF_ASTERISK Character 1

Click PL/SQL Formula to open the PL/SQL editor, and


call the ASTERISK function from the formula.
function CF_asteriskFormula return varchar2 is
begin
return(asterisk(:date_ordered,:date_shipped));
end;

In the Layout editor, increase the width of the


R_G_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 destination to Preview during testing.
Test the report using the Live Previewer.
c Move the function code into a new PL/SQL library named p16lib.pll.
In the Object Navigator, create a new library.
Open the Library node and click and drag the ASTERISK function into
the Program Unit node below the library.
Save the PL/SQL library.
Delete the report-level ASTERISK function. Attach the library to the
report.
d Call the external function from your report instead of calling the report-level
function.
e Save the report to p16q2.rdf.
3 Continue with the previous report.
a Modify the same layout to display additional spacing between every two
records.

......................................................................................................................................................
A-74 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 16
.....................................................................................................................................................

In the Data Model editor, create a summary column in the G_ID group to
keep a running total of records.
Name Function Source Reset At
COUNT_ORD COUNT ID Report

In the Layout Editor, increase the height of the repeating frame for the
second layout. Remember to switch Flex mode on, so that you can increase the
repeating frame and the group frame together.
Open the repeating frame property palette 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 p16q3.rdf and close it.

If You Have Time


4 Open report p16q1.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.
In the Object Navigator, open the Data Model node, and
double-click the User Parameters node to create the first parameter.
Select the Create tool to create a second parameter.
Rename the parameters P_COUNT_CUST and P_CUTOFF.
Give P_COUNT_CUST an initial value of 0.
Open the G_CUSTOMER_ID group property palette.
Set Filter Type to PL/SQL
Select PL/SQL Filter to open the PL/SQL editor.
Enter the following code:

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-75
Appendix A: Solutions
.....................................................................................................................................................

function G_CUSTOMER_IDGroupFilter return boolean is


begin
:p_count_cust := :p_count_cust + 1;
if :p_count_cust <= :p_cutoff then
return(TRUE);
else
return(FALSE);
end if;
end;

Rebuild the parameter form.


b Test the report several times by changing the cutoff parameter at run time.
c Save the report as p16q4.rdf.

......................................................................................................................................................
A-76 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 17
.....................................................................................................................................................

Practice Session Overview: Lesson 17


This practice session contains:
• Modifying an existing report, enhancing it for the Web.
• Publishing the report on the Web

Introduction
If you use the Web Wizard and change some properties, you can easily prepare a
report for the Web. You will open an existing report and add: bookmarks,
hyperlinks, pagestreaming, animated gifs, and JavaScript.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-77
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 17


1 Open your bowser and run web_sol.rdf. The report contains: bookmarks,
hyperlinks, pagestreaming, HTML header, drill down, and JavaScript.
Test every feature listed.
2 Start Report Builder and open web_it.rdf. Your task is to add the Web
features listed above. Save and test your report frequently.
3 Ensure that only two sales representatives print on each page and that the
records print with some space between them.
Open the property palette for the R_G_ID repeating frame. Set the Maximum
Records per Page property to 2. Set the Vert. Space Between Frames property
to .25
4 Add bookmarks for the LAST_NAME field.
Invoke the Web Wizard and set the LAST_NAME column as the bookmark.
Do not include a header or footer.
5 Create a hyperlink to www.oracle.com and add pop-up text.
a Import oracle.gif and place it in the upper right corner of the
M_G_ID_GRPFR group frame.
b Set the necessary properties for the hyperlink and the pop-up text.
Open the property palette for the boilerplate image and set the Hyperlink
property to http://www.oracle.com. Set the Display Name (HTML)
property to “Visit our web site”.
6 Create an internal hyperlink for quick navigation to the top of the report.
a Use the date field in the M_G_ID_GRPFR frame as the hyperlink destination.
Open the property palette for F_DATE and set the Hyperlink Destination
to ’top’.
b Create boilerplate text inside the R_G_ID repeating frame.
Enlarge the R_G_ID repeating frame and create the boilerplate text to the
right of the F_START_DATE field.
c Set the hyperlink.
Set the Hyperlink property to #top.
7 Add pagestreaming to the report.
Add the pagestream=yes argument to the URL or the cgicmd.dat
mapfile.
8 Add webhead.htm as the report header.
Open the report property palette and set the Before Report Value property to
webhead.htm.

......................................................................................................................................................
A-78 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 17
.....................................................................................................................................................

9 Provide drill down reporting to web_drill.rdf. This should be triggered by


the F_NAME field. Don’t forget you need to pass the customer name as a
parameter in the URL.
Open the property palette for the F_NAME field and set the Hyperlink
property to /dev60cgi/rwcgi60.exe?web_drill+&<name>
Ensure that the cgicmd.dat file has an entry labeled web_drill with
p_custname=%1 as the last argument.
10 Show the customer credit rating in an alert. This should be triggered by the
F_ID1 field. Use the following line of JavaScript:
javascript: showmyalert(’Credit Rating: &<credit_rating>’)
Note: The function itself is part of the HTML report header file.
Open the Property palette for the F_ID1 field and enter the line of code
listed in the Hyperlink property.
11 Save the report as p17q1.rdf and run the report in your browser. Test every
Web feature you added.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-79
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 18


This practice session contains:
• Building a report containing conditional highlighting
• Building a drill-down 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 separate report from a button in
the previewer.
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.

......................................................................................................................................................
A-80 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 18
.....................................................................................................................................................

Practice Session Solutions: Lesson 18


1 Open report p8q5.rdf.
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 import the file p18q1a.txt.


Open the PL/SQL editor and create a function to apply the format
attributes.
function FIELD_MASK return boolean is
begin
srw.set_text_color(’red’);
srw.set_font_weight(srw.bold_weight);
srw.set_font_style(srw.italic_style);
return(TRUE);
end;
b Alter the pattern and color of those records where the customer total is 5,000 or
less.
Hint: Check the Help system for the SRW.SET <attributes> or use conditional
formatting.
Attribute
Suggested Values
Fill pattern Crisscross, sandpaper
Foreground fill color Yellow
Background fill color Green

You can import the file p18q1b.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 iDS Reports: Build Internet Reports A-81
Appendix A: Solutions
.....................................................................................................................................................

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;
Create a format trigger on the R_G_CUSTOMER repeating
frame to call the function.

function R_G_CUSTOMERFormatTrigger return boolean is


begin
if :cust_total <= 5000 then
return(record_mask);
else
return(TRUE);
end if;
end;

Save the report as p18q1.rdf.


d
e Run the report on the Web.
2 Call a drill-down report using a button.
a Continue with the previous report.
b Alter the layout to exclude the customer ID field from displaying in the report.
Use the Report Wizard and on the Fields tab, remove CUSTOMER_ID
from the Displayed Fields list.

c Add a button to this report to display a drill-down report when the button is
clicked at run time. The button should be displayed once for every customer
record.
In the Layout editor, increase the width of the R_G_CUSTOMER
repeating frame to allow room for the button.
Create a button inside the repeating frame.
d When the button is clicked , the detail report (p18q2c.rdf) is called with the
customer ID as a parameter.
Hint: Have a look at report p18q2c.rdf to check the name of the parameter.
You can import the file p18q2d.txt.
Open the property palette for the button and set the Type property to PL/

......................................................................................................................................................
A-82 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 18
.....................................................................................................................................................

SQL.
Import the file p18q2d.txt into the PL/SQL code, or enter the following
code:
procedure U_1ButtonAction is
begin
srw.run_report(’report=p18q2c.rdf
p_customer=’||to_char(:customer_id)||’ paramform=no’);
end;
e Save the report as p18q2.rdf.
f Test the report using the run time executable and then close the run time.

If You Have Time


3 Open report p9q1.rdf.
In this report, you use report triggers to create a temporary table at the start of report
execution, and you insert rows into the table at various stages of the execution.
a Write a trigger that creates a temporary table to hold the date and userid each
time the report is run. The table should contain three columns: one date
column, one character column of width 10, and one character column of width
80.
CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10), COMMENTS VARCHAR2(80)

In the Object Navigator, expand the Report Triggers


node, and
double-click the Before Report PL/SQL icon to open
the PL/SQL editor. Create the following function:
function BeforeReport return boolean is
begin
srw.do_sql(’CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))’);
return(true);
exception
when srw.do_sql_failure then null;
end;

b The same trigger should also insert the current date, userid, and “Starting
Report” into this table.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-83
Appendix A: Solutions
.....................................................................................................................................................

INSERT INTO RUNREPORT


( DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, ’Starting Report’)
Hint: Think about how you code the single quotes.
Add the following code:
function BeforeReport return boolean is
begin
srw.do_sql(’CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))’);
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Starting Report’’)’);
return(TRUE);
end;
c Compile the PL/SQL code and close the window.
d Save the report as p18q3.rdf.
e Create the .rep file
f Run and test the report using the Reports Runtime. Close the report.
g Using SQL*Plus, verify that your table exists and was populated successfully.
h Log on to SQL*Plus (in Microsoft Windows, select the SQL*Plus icon in the
Oracle group) using the same userid as you used for Reports.
i Display all records in the RUNREPORT table.
SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;
j Try running the report more than once. When you run the report a second time,
the table already exists and Report 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:

......................................................................................................................................................
A-84 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 18
.....................................................................................................................................................

function BeforeReport return boolean is


begin
begin
srw.do_sql(’CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))’);
exception
when srw.do_sql_failure then
null;
end;
begin
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Starting Report’’)’);
return(TRUE);
end;
end;
k 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’’)’);
return(TRUE);
end;
l Write a trigger that inserts a record with the comment “Report completed”
when the report finishes.
In the Object Navigator, expand the Report Triggers node and double-
click the After Report PL/SQL icon to open the PL/SQL editor.
Or, if the editor is already open, change the Name to After Report.
Report the following function:

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-85
Appendix A: Solutions
.....................................................................................................................................................

function AfterReport return boolean is


begin
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Report Completed’’)’);
return(TRUE);
end;
m Save and run the report using the Reports Runtime. Verify the results in
SQL*Plus.

......................................................................................................................................................
A-86 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 19
.....................................................................................................................................................

Practice Session Overview: Lesson 19


This practice session contains:
• Running a report using an XML definition
• Applying an XML report definition to an existing .rdf file
• Debugging an XML 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, apply an XML definition to an existing report, and debug
an XML report definition.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-87
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 19


1 Run an XML report definition.
Open p19q1.xml using Wordpad. Examine the code. What type of report
a
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 model. 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 corp1.tdf, but overrides the formatting for
the F_SAL field through a formatting exception.
b Execute p19q1.xml using the Reports Runtime.
Invoke the Reports Runtime. From the menu select Run. In the open file
dialog box type in p19q1.xml, and click Open. Close the Reports
Runtime.
2 Apply run-time customizations
a Open p19q2.rdf. Run the report using the Live Previewer.
b What type of report is this? Investigate the data model, the layout model, and
the report sections.
It is a simple tabular report. There is nothing in the Header and Trailer
sections. There are no summary fields, and no data formatting.
c Open p19q2.xml. Examine the code. What goes on in this XML definition
file?
It has a data source that is different from what is in the p19q2.rdf
report. The data is going to be formatted in the header section. In the
main section it has a formatting spec for the SALARY column in the main
section.
d Apply p19q2.xml to p19q2.rdf using the RWRUN60 command and
send the output to the screen.
RWRUN60 report=p19q1.xml customize=p19q2.xml destype=screen
e Examine the newly created report output. What do you see?
3 Debug an XML definition file
a Execute p19q3a.xml using the Reports Runtime. What output do you get?
Close the previewer window.
Invoke the Reports Runtime. From the menu select Run. In the open file
dialog box type in p19q3a.xml, and click Open. The first page shows a

......................................................................................................................................................
A-88 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 19
.....................................................................................................................................................

tabular report with department information. The second page is a break


report with department and employee information, The third page
contains a matrix report.
Close the Previewer window.
b Execute p19q3b.xml using the Reports Runtime. What output do you get?
No output at all. We get an error message stating ’Invalid XML report
definition’. Click OK, and close the Reports Runtime.
c Open p19q3b.xml using Wordpad and correct any errors. Save and test
frequently. The ouput should be identical to p19q3a.xml.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-89
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Overview: Lesson 20


This practice session contains:
• Running a report on your local machine
• Running reports on a remote server using the report Queue Manager
• Copying output from remote server to your local machine
• Running a report on a remote server using the command line

Introduction
In this practice session, you run a report locally and then on a remote server, using the
Queue Manager. You also use the Queue Manager to view the submitted jobs.
If you have time, you can submit a report to a remote server using the command line
options.

......................................................................................................................................................
A-90 Oracle iDS Reports: Build Internet Reports
Practice Session Solutions: Lesson 20
.....................................................................................................................................................

Practice Session Solutions: Lesson 20


1 Run longrun1.rdf on your local client machine.
Open longrun1.rdf and run the report. Notice the time it takes for the report to
run to completion. If it has not completed within five minutes, note how many
pages have been formatted, then cancel the report.
Note: Make sure that DESTYPE=FILE is set in the Parameter Form when running
this report.
2 Run longrun1.rdf and longrun2.rdf by calling Reports Services from the
Queue Manager.
Note: Your instructor will give you specific instructions to complete this exercise.
The location of the remote server, directory paths, and so on might differ for your
class.
a Invoke the Queue Manager. Enter repserver1 as your server name. Note if
there are any jobs in the queue.
b Schedule a new job to run the longrun1.rdf report on Reports Services.
Select applicable settings from the tab pages of the Queue Manager. For
Destination Type select ToLocalFile, ToFile, or Cache; the report default is
Screen, which is not valid when running a remote report.
Select Job—>New from the menu, then select Set Options.
In the dialog box enter the following information:
Tab Parameter Value
General Report Name longrun1.rdf
Type 7 - ToServerCache
Data Connection User Name Your User Name
Password Your Password
Database Your Database
Output Options Output Driver PDF

c Do the same for longrun2.rdf.


Select Job—>New from the menu, then select Set Options.
In the dialog box enter the following information:
Tab Parameter Value
General Report Name longrun2.rdf
Type 7 - ToServerCache
Data Connection User Name Your User Name
Password Your Password
Database Your Database
Output Options Output Driver PDF

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-91
Appendix A: Solutions
.....................................................................................................................................................

dDisplay all jobs to see where your jobs are queued in relation to the reports of
other students.
Select Show All Jobs from the toolbar if it is not selected.
e Display all your own jobs only.
Select Show All My Jobs from the toolbar.
f Refresh the screen several times to see how quickly the report pages are
formatted.
Select Refresh from the toolbar.
g Cancel your own longrun2.rdf from the server queue.
Select the job and select Job—>Remove from the menu.
3 When the report longrun1.rdf has finished, copy the output to a filename,
longrun1.pdf, in your home directory.
When the job has finished, it is no longer displayed in the Current Jobs
window.
Select Show Past Jobs from the toolbar.
Select the job and choose Job—>Copy Output To from the menu.
Choose your home directory.
Enter the filename longrun1.pdf and click Save.

If You Have Time


4 Run longrun1.rdf by scheduling a new job from the command line.
a Using RWCLI60 from the command line, submit your longrun1.rdf report to
Reports Services.
Your instructor will give you specific instructions to complete this exercise
because this is operating-system specific.
b Make sure that the output is in PDF format and that it is cached.
On Windows platforms enter the following command:
RWCLI60 LONGRUN1.RDF USERID=<userid>/<password>
@<alias> SERVER=repserver1 DESTYPE=CACHE DESFORMAT=PDF

......................................................................................................................................................
A-92 Oracle iDS Reports: Build Internet Reports
Practice Session Overview: Lesson 21
.....................................................................................................................................................

Practice Session Overview: Lesson 21


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. Report Builder offers a few tools that allow
you to measure preformance. In this practice you will use them and interpret the
results.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports A-93
Appendix A: Solutions
.....................................................................................................................................................

Practice Session Solutions: Lesson 21


1 Name three main areas to investigate when tuning reports.
The data model, the layout model, run time arguments.
2 What is the name of the font mapping file?
uifont.ali
3 Generate and interpret Reports Profiler Statistics.
a Open report p21q1a.rdf. From the menu select Tools—>Trace.
b In the Runtime Trace Settings dialog box specify p21q1a.txt as the trace file
and check the Profile Messages and Timestamp checkboxes.
c Select OK to close the dialog box.
d Run the report.
e Open p21q1a.txt and look at the results. Where does this report spend
time?
The time is spent on the layout and formatting of the report.
f Repeat the same steps for report p21q1b.rdf. Specify p21q1b.txt as the
trace file. Compare the result. How do you explain this?
The statistics for p21q1b.rdf also show that time is spend formatting
the report. The figures are a bit higher because of the dynamic customized
formatting of the R_G_CUSTOMER frame and the F_CUST_TOTAL
field.
4 Make a suggestion to improve performance.
a Using the Reports Runtime, run p21q2a.rep and generate the Reports
Profiler Statistics. Look at the time statistics.
Invoke the Reports Runtime. Connect to the database. From the menu
select Edit—>Runtime options and specify p21q2a.txt in the profile
field on the Runtime Settings tab. Click OK to close the window. Now run
p21q2a.rep. Close the report.
Look at the .txt file you just generated.
b Open the report p21q2a.rdf and examine the data model. What could you
possibly do to make the report run faster?
Set the Break Order property for all columns except the ORDID column
to None. Thus avoiding forcing (unnecessary) extra sorting.
c Implement your change and regenerate the time statistics. Did things improve?
Yes indeed the report runs faster.

......................................................................................................................................................
A-94 Oracle iDS Reports: Build Internet Reports
................................
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

Summit Sporting Goods Database Diagram

ORD_ID
ID
S_ITEM S_ORD

PRODUCT_ID CUSTOMER_ID
SALES_REP_ID

S_INVENTORY
PRODUCT_ID
ID

ID ID
S_CUSTOMER
S_PRODUCT SALES_REP_ID

IMAGE_ID

ID ID ID

S_IMAGE S_EMP
DEPT_ID

ID

S_DEPT

*Unique occurrences are identified by PRODUCT_ID and WAREHOUSE_ID.

......................................................................................................................................................
B-2 Oracle iDS Reports: Build Internet Reports
S_CUSTOMER Description
.....................................................................................................................................................

S_CUSTOMER Description
Column Name Null? Datatype
-------------- --------- ------------- -----------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(50)
PHONE VARCHAR2(25)
ADDRESS VARCHAR2(400)
CITY VARCHAR2(30)
STATE VARCHAR2(20)
COUNTRY VARCHAR2(30)
ZIP_CODE VARCHAR2(75)
CREDIT_RATING VARCHAR2(9)
SALES_REP_ID NUMBER(7)
REGION_ID NUMBER(7)
COMMENTS VARCHAR2(255)

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-3
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_CUSTOMER Data

SQL> SELECT * FROM s_customer;

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
201 Unisports 55-2066101 72 Via Bahia
Sao Paolo Brazil
Excellent 12 2
Customer Usually Orders Large Amounts And Has A High Order Total.
This Is Okay As Long As The Credit Rating Remains Excellent.

202 Oj Atheletics 81-20101 6741 Takashi Blvd.


Osaka Japan
Poor 14 4
Customer Should Always Pay By Cash Until His Credit Rating
Improves.

203 Delhi Sports 91-10351 11368 Chanakya


New Delhi India
Good 14 4
Customer Specializes In Baseball Equipment And Is The Largest
Retailer In India.

......................................................................................................................................................
B-4 Oracle iDS Reports: Build Internet Reports
S_CUSTOMER Data
.....................................................................................................................................................

S_CUSTOMER Data (continued)

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
204 Womansport 1-206-104-0103 281 King Street
Seattle Washington USA
98101 EXCELLENT 11 1

205 Kam’s Sporting Goods 852-3692888 15 Henessey Road


Hong Kong EXCELLENT 15 4

206 Sportique 33-2257201 172 Rue de Rivoli


Cannes France
EXCELLENT 15 5
Customer specializes in Soccer. Likes to order accessories in
bright colors.

207 Sweet Rock Sports 234-603620 6 Saint Antoine


Lagos Nigeria
GOOD 3

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-5
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_CUSTOMER Data (continued)

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
208 Muench Sports 49-527454 435 Gruenestrasse
Stuttgart Germany
GOOD 15 5
Customer usually pays small orders by cash and large orders on
credit.

209 Beisbol Si! 809-352689 789 Playa Del Mar


San Pedro de Macon’s Dominican Republic
EXCELLENT 11 1

210 Futbol Sonora 52-404562 3 Via Saguaro


Nogales
EXCELLENT 12 2
Customer is difficult to reach by phone. Try mail.

211 Kuhn’s Sports 42-111292 7 Modrany


Prague Czechoslovakia
EXCELLENT 15 5

......................................................................................................................................................
B-6 Oracle iDS Reports: Build Internet Reports
S_CUSTOMER Data
.....................................................................................................................................................

S_CUSTOMER Data (continued)

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
212 Hamada Sport 20-1209211 57A Corniche
Alexandria Egypt
EXCELLENT 13 3
Customer orders sea and water equipment.

213 Big John’s Sports 1-415-555-6281 4783 18th Street


Emporium
San Francisco CA USA
94117 EXCELLENT 11 1
Customer has a dependable credit record.

214 Ojibway Retail 1-716-555-7171 415 Main Street


Buffalo NY USA
14202 POOR 11 1

215 Sporta Russia 7-3892456 6000 Yekatamina


St. Petersburg Russia
POOR 15 5
This customer is very friendly, but has difficulty paying bills.
Insist upon cash.

15 rows selected.

Note: This display has been formatted.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-7
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_DEPT Description and Data


Column Name Null? Datatype
---------------------- ------------- --------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(25)
REGION_ID NUMBER(7)

SQL> SELECT * FROM s_dept;

ID NAME REGION_ID
------ ---------------- -----------------
10 Finance 1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
44 Operations 4
45 Operations 5
50 Administration 1

12 rows selected.

......................................................................................................................................................
B-8 Oracle iDS Reports: Build Internet Reports
S_EMP Description
.....................................................................................................................................................

S_EMP Description
Column Name Null? Datatype
------------------------ -------------- --------------
ID NOT NULL NUMBER(7)
LAST_NAME NOT NULL VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
COMMENT VARCHAR2(255)
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID NUMBER(7)
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-9
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_EMP Data

SQL> SELECT * FROM s_emp;

ID LAST_NAME FIRST_NAME USERID START_DAT


---- ----------------- ---------------- -------- ---------
COMMENTS
--------------------------------------------------------------
MANAGER_ID TITLE DEPT_ID SALARY
---------- ---------------------------- ------- ------
COMMISSION_PCT
---------------
1 Velasquez Carmen cvelasqu 03-MAR-90
President 50 2500
2 Ngao LaDoris lngao 08-MAR-90
1 VP, Operations 41 1450

3 Nagayama Midori mnagayam 17-JUN-91


1 VP, Sales 31 1400

4 Quick-To-See Mark mquickto 07-APR-90


1 VP, Finance 10 1450

5 Ropeburn Audry aropebur 04-MAR-90


1 VP, Administration 50 1550

6 Urguhart Molly murguhar 18-JAN-91


2 Warehouse Manager 41 1200

7 Menchu Roberta rmenchu 14-MAY-90


2 Warehouse Manager 42 1250
8 Biri Ben bbiri 07-APR-90
2 Warehouse Manager 43 1100

9 Catchpole Antoinette acatchpo 09-FEB-92


2 Warehouse Manager 44 1300

......................................................................................................................................................
B-10 Oracle iDS Reports: Build Internet Reports
S_EMP Data
.....................................................................................................................................................

S_EMP Data (continued)

ID LAST_NAME FIRST_NAME USERID START_DAT


---- ----------------- ---------------- -------- ---------
COMMENTS
--------------------------------------------------------------
MANAGER_ID TITLE DEPT_ID SALARY
---------- ---------------------------- ------- ------
COMMISSION_PCT
---------------
10 Havel Marta mhavel 27-FEB-91
2 Warehouse Manager 45 1307

11 Magee Colin cmagee 14-MAY-90


3 Sales Representative 31 1400
10

12 Giljum Henry hgiljum 18-JAN-92


3 Sales Representative 32 1490
12.5

13 Sedeghi Yasmin ysedeghi 18-FEB-91


3 Sales Representative 33 1515
10

14 Nguyen Mai mnguyen 22-JAN-92


3 Sales Representative 34 1525
15

15 Dumas Andre adumas 09-OCT-91


3 Sales Representative 35 1450
17.5

16 Maduro Elena emaduro 07-FEB-92


6 Stock Clerk 41 1400

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-11
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_EMP Data (continued)

ID LAST_NAME FIRST_NAME USERID START_DAT


---- ----------------- ---------------- -------- ---------
COMMENTS
--------------------------------------------------------------
MANAGER_ID TITLE DEPT_ID SALARY
---------- ---------------------------- ------- ------
COMMISSION_PCT
---------------
17 Smith George gsmith 08-MAR-90
6 Stock Clerk 41 940

18 Nozaki Akira anozaki 09-FEB-91


7 Stock Clerk 42 1200

19 Patel Vikram vpatel 06-AUG-91


7 Stock Clerk 42 795

20 Newman Chad cnewman 21-JUL-91


8 Stock Clerk 43 750

21 Markarian Alexander amarkari 26-MAY-91


8 Stock Clerk 43 850

22 Chang Eddie echang 30-NOV-90


9 Stock Clerk 44 800

23 Patel Radha rpatel 17-OCT-90


9 Stock Clerk 34 795

24 Dancs Bela bdancs 17-MAR-91


10 Stock Clerk 45 860

25 Schwartz Sylvie sschwart 09-MAY-91


10 Stock Clerk 45 1100

25 rows selected.

Note: This display has been formatted.

......................................................................................................................................................
B-12 Oracle iDS Reports: Build Internet Reports
S_ITEM Description
.....................................................................................................................................................

S_ITEM Description
Column Name Null? Datatype
------------------------- -------------- ----------
ORD_ID NOT NULL NUMBER(7)
ITEM_ID NOT NULL NUMBER(7)
PRODUCT_ID NOT NULL NUMBER(7)
PRICE NUMBER(11,2)
QUANTITY NUMBER(9)
QUANTITY_SHIPPED NUMBER(9)

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-13
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_ITEM Data

SQL> SELECT * FROM s_item;

ORD_ID ITEM_ID PRODUCT_ID PRICE QUANTITY QUANTITY_SHIPPED


------ -------- ----------- ------ -------- -----------------
100 1 10011 135 500 500
100 2 10013 380 400 400
100 3 10021 14 500 500
100 5 30326 582 600 600
100 7 41010 8 250 250
100 6 30433 20 450 450
100 4 10023 36 400 400
101 1 30421 16 15 15
101 3 41010 8 20 20
101 5 50169 4.29 40 40
101 6 50417 80 27 27
101 7 50530 45 50 50
101 4 41100 45 35 35
101 2 40422 50 30 30
102 1 20108 28 100 100
102 2 202011 23 45 45
103 1 30433 20 15 15
103 2 32779 7 11 11
104 1 20510 9 7 7
104 4 30421 16 35 35
104 2 20512 8 12 12
104 3 30321 1669 19 19
105 1 50273 22.8 16 16
105 3 50532 47 28 28
105 2 50419 80 13 13

......................................................................................................................................................
B-14 Oracle iDS Reports: Build Internet Reports
S_ITEM Data
.....................................................................................................................................................

S_ITEM Data (continued)

ORD_ID ITEM_ID PRODUCT_ID PRICE QUANTITY QUANTITY_SHIPPED


------- ------- ----------- ------ -------- -----------------
106 1 20108 28 46 46
106 4 50273 22.89 75 75
106 5 50418 7 5 98 98
106 6 50419 80 27 27
106 2 20201 123 21 21
106 3 50169 4.29 125 125
107 1 20106 11 50 50
107 3 20201 1 15 130 130
107 5 30421 16 55 55
107 4 30321 1669 75 75
107 2 20108 28 22 22
108 1 20510 9 9 9
108 6 41080 35 50 50
108 7 41100 45 42 42
108 5 32861 60 57 57
108 2 20512 8 18 18
108 4 32779 7 60 60
108 3 30321 1669 85 85
109 1 10011 140 150 150
109 5 30426 18.25 500 500
109 7 50418 75 43 43
109 6 32861 60 50 50
109 4 30326 582 1500 1500
109 2 10012 175 600 600
109 3 10022 21.95 300 300
110 1 50273 22.89 17 17
110 2 50536 50 23 23
111 1 40421 65 27 27
111 2 41080 35 29 29
97 1 20106 9 1000 1000
97 2 303211 500 50 50
98 1 404218 5 7 7
99 1 20510 9 18 18
99 2 20512 8 25 25
99 3 50417 80 53 53
99 4 50530 45 69 69
112 1 20106 11 50 50

62 rows selected.

Note: This display has been formatted.


......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-15
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_ORD Description and Data


Column Name Null? Datatype
------------------------ ------ ---------------------
ID NOT NULL NUMBER(7)
CUSTOMER_ID NOT NULL NUMBER(7)
DATE_ORDERED DATE
DATE_SHIPPED DATE
SALES_REP_ID NUMBER(7)
TOTAL NUMBER(11,2)
PAYMENT_TYPE VARCHAR2(6)
ORDER_FILLED VARCHAR2(1)

SQL> SELECT * FROM s_ord;

ID CUSTOMER_IDDATE_ORDEDATE_SHIPSALES_REP_IDTOTALPAYMENORDER_F
--- ------------------------------------------------------------
100 204 31-AUG9210-SEP-9211601100CREDITY
101 205 31-AUG-9215-SEP-92148056.6CREDITY
102 206 01-SEP-9208-SEP-92158335CREDITY
103 208 02-SEP-9222-SEP-9215377CASHY
104 208 03-SEP-9223-SEP-921532430CREDITY
105 209 04-SEP-92 18-SEP-92112722.24CREDITY
106 210 07-SEP-92 15-SEP-921215634CREDITY
107 211 07-SEP-9221-SEP-9215142171CREDITY
108 212 07-SEP-9210-SEP-9213149570CREDITY
109 213 08-SEP-92 28-SEP-92111020935CREDITY
110 214 09-SEP-92 21-SEP-92111539.13CASHY
111 204 09-SEP-92 21-SEP-92112770CASHY
97 201 28-AUG-92 17-SEP-921284000 CREDITY
98 202 31-AUG-92 10-SEP-9214595CASHY
99 203 31-AUG-92 18-SEP-92147707CREDITY
112 210 31-AUG-92 10-SEP-9212550CREDITY

16 rows selected.

......................................................................................................................................................
B-16 Oracle iDS Reports: Build Internet Reports
S_PRODUCT Description
.....................................................................................................................................................

S_PRODUCT Description
Column NameNull?Datatype
---------------------------------------------------
ID NOT NULLNUMBER(7)
NAMENOT NULLVARCHAR2(50)
SHORT_DESCVARCHAR2(255)
LONGTEXT_IDNUMBER(7)
IMAGE_ID NUMBER(7)
SUGGESTED_WHLSL_PRICE‘NUMBER(11,2)
WHLSL_UNITSVARCHAR2(25)

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-17
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_PRODUCT Data

SQL> SELECT * FROM s_product;

IDNAMESHORT_DESCLONGTEXT_ID
-----------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
10011 BootBeginner ’s ski boot518
1001150

10012Ace Ski BootIntermediate ski boot519


1002200

10013Pro Ski BootAdvanced ski boot520


1003410

10021Bunny Ski PoleBeginner ’s ski pole528


101116.25

10022Ace Ski PoleIntermediate ski pole529


101221.95

10023Pro Ski PoleAdvanced ski pole530


101340.95

20106Junior Soccer BallJunior soccer ball613


11

20108World Cup Soccer BallWorld cup soccer ball615


28

20201World Cup NetWorld cup net708


123

......................................................................................................................................................
B-18 Oracle iDS Reports: Build Internet Reports
S_PRODUCT Data
.....................................................................................................................................................

S_PRODUCT Data (continued)

ID NAMESHORT_DESCLONGTEXT_ID
-------------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
20510Black Hawk Knee pads, pair1017
Knee Pads9

20512 Black Hawk Elbow pads, pair1019


Elbow Pads8

30321Grand Prix Bicycle Road bicycle828


1291 1669

30326Himalaya BicycleMountain bicycle833


1296 582

30421Grand PrixRoad bicycle tires927


Bicycle Tires16

30426Himalaya TiresMountain bicycle tires933


18.25

30433New Air PumpTire pump940


20

32779Slaker Water Water bottle1286


Bottle7

32861Safe-T HelmetBicycle helmet1368


1829 60

40421Alexeyer ProStraight bar928


Lifting Bar
1381 65

40422Pro Curling BarCurling bar929


1382 50

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-19
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_PRODUCT Data (continued)

ID NAMESHORT_DESCLONGTEXT_ID
-------------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
40421Alexeyer ProStraight bar928
Lifting Bar
1381 65

40422Pro Curling BarCurling bar929


1382 50

41010Prostar 10 Ten pound weight517


Pound Weight
8

41020Prostar 20Twenty pound weight527


Pound Weight
12

41050Prostar 50 Fifty pound weight557


Pound Weight
25

41080Prostar 80 Eighty pound weight587


Pound Weight
35

41100Prostar 100 One hundred pound 607


Pound Weightweight
45

50169Major League Baseball676


Baseball
1119 4.29

......................................................................................................................................................
B-20 Oracle iDS Reports: Build Internet Reports
S_PRODUCT Data
.....................................................................................................................................................

S_PRODUCT Data (continued)

ID NAMESHORT_DESCLONGTEXT_ID
---------------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
50273 Chapman HelmetBatting helmet780
1223 22.89

50417Griffey GloveOutfielder ’s glove924


1367 80

50418Alomar GloveInfielder ’s glove925


1368 75

50419Steinbach GloveCatcher ’s glove926


1369 80

50530 Cabrera BatThirty inch bat1037


1480 45

50532Puckett BatThirty-two inch bat1039


1482 47

50536Winfield BatThirty-six inch bat1043


1486 50

33 rows selected.

Note: This display has been formatted.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-21
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_REGION Description and Data


Column Name Null? Datatype
------------------------------ ----------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(50)

SQL> SELECT * FROM s_region;

ID NAME
--- --------------------------
1 North America
2 South America
3 Africa / Middle East
4 Asia
5 Europe

......................................................................................................................................................
B-22 Oracle iDS Reports: Build Internet Reports
S_TITLE Description and Data
.....................................................................................................................................................

S_TITLE Description and Data


Column Name Null? Datatype
---------------------------------- ----------------
TITLE NOT NULL VARCHAR2(25)

SQL> SELECT * FROM s_title;

TITLE
------------------------
President
Sales Representative
Stock Clerk
VP, Administration
VP, Finance
VP, Operations
VP, Sales
Warehouse Manager

8 rows selected.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-23
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

Oracle8 Objects: Types, Tables


emp_type_ObjCol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

emp_type_RefCol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

dept_type
-------------------------------------------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)

......................................................................................................................................................
B-24 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

Tables

oo_emp_Table_ObjCol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAMEVARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
ID LAST_NAMEFIRST_NAME USERID
--------- --------------------- --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1VelasquezCarmencvelasqu
03-MAR-90President
DEPT_TYPE(50, ’Administration’, 1)
2500

2NgaoLaDorislngao
08-MAR-901 VP Operations
DEPT_TYPE(41, ’Operations’, 1)
1450

3NagayamaMidorimnagayam
17-JUN-91 1 VP Sales
DEPT_TYPE(31, ’Sales’, 1)
1400
ID LAST_NAMEFIRST_NAMEUSERID
---------- ----------------------------- --------

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-25
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

START_DAT MANAGER_ID TITLE


--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
4 Quick-To-See Markmquickto
07-APR-901 VP Finance
DEPT_TYPE(10, ’Finance’, 1)
1450

5RopeburnAudryaropebur
04-MAR-901 VP Administration
DEPT_TYPE(50, ’Administration’, 1)
1550

6 Urguhart Mollymurguhar
18-JAN-91 2 Warehouse Manager
DEPT_TYPE(41, ’Operations’, 1)
1200

7 MenchuRobertarmenchu
14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
1250

8 Biri Benbbiri
07-APR-902 Warehouse Manager
DEPT_TYPE(43, ’Operations’, 3)
1100

9 CatchpoleAntoinetteacatchpo
09-FEB-922 Warehouse Manager
DEPT_TYPE(44, ’Operations’, 4)
1300
ID LAST_NAMEFIRST_NAMEUSERID
---------- ------------------------------ --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------

......................................................................................................................................................
B-26 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

DEPT_ID(ID, NAME, REGION_ID)


------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
10 Havel Marta mhavel
27-FEB-912 Warehouse Manager
DEPT_TYPE(45, ’Operations’, 5)
1307

11 MageeColincmagee
14-MAY-903 Sales Representative
DEPT_TYPE(31, ’Sales’, 1)
140010

12 GiljumHenry hgiljum
18-JAN-92 3 Sales Representative
DEPT_TYPE(32, ’Sales’, 2)
149013

13 SedeghiYasminysedeghi
18-FEB-913 Sales Representative
DEPT_TYPE(33, ’Sales’, 3)
1515 10

14 NguyenMai mnguyen
22-JAN-923 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
1525 15

15 DumasAndreadumas
09-OCT-913 Sales Representative
DEPT_TYPE(35, ’Sales’, 5)
145018
ID LAST_NAMEFIRST_NAMEUSERID
---------- ----------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-27
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

SALARY COMMISSION_PCT
---------- --------------
16 MaduroElena emaduro
07-FEB-926 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
1400

17SmithGeorgegsmith
08-MAR-906 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
940

18 NozakiAkira anozaki
09-FEB-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
1200

19PatelVikramvpatel
06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795

20 NewmanChad cnewman
21-JUL-918 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
750

21 MarkarianAlexanderamarkari
26-MAY-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
850
ID LAST_NAMEFIRST_NAMEUSERID
---------- ------------------------------ --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------

......................................................................................................................................................
B-28 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

22 ChangEddie echang
30-NOV-90 9 Stock Clerk
DEPT_TYPE(44, ’Operations’, 4)
800

23 PatelRadharpatel
17-OCT-909 Stock Clerk
DEPT_TYPE(34, ’Sales’, 4)
795

24 Dancs Bela bdancs


17-MAR-9110 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
860

25 SchwartzSylviesschwart
09-MAY-9110 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
1100

oo_emp_Table_RefCol
Name Null? Type
----------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCTNUMBER(4,2)

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmencvelasqu
03-MAR-90President
......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-29
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
2500

2NgaoLaDorislngao
08-MAR-90 1 VP Operations
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450

3 NagayamaMidorimnagayam
17-JUN-91 1 VP Sales
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400

4 Quick-To-SeeMarkmquickto
07-APR-90 1 VP Finance
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450

5 Ropeburn Audryaropebur
04-MAR-90 1 VP Administration
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1550

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
6 UrguhartMollymurguhar
18-JAN-912 Warehouse Manager
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200

......................................................................................................................................................
B-30 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

9 CatchpoleAntoinetteacatchpo
09-FEB-922 Warehouse Manager
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1300

10 Havel Martamhavel
27-FEB-91 2 Warehouse Manager
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1307

11 Magee Colincmagee
14-MAY-90 3 Sales Representative
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400 10

13 SedeghiYasminysedeghi
18-FEB-91 3 Sales Representative
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1515 10

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-31
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
14 NguyenMaimnguyen
22-JAN-92 3 Sales Representative
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1525 15

15 DumasAndreadumas
09-OCT-913 Sales Representative
0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450 18

16 MaduroElenaemaduro
07-FEB-92 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400

17 SmithGeorgegsmith
08-MAR-90 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
940

18 NozakiAkiraanozaki
09-FEB-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200

......................................................................................................................................................
B-32 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
19 PatelVikramvpatel
06-AUG-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795

20 NewmanChadcnewman
21-JUL-918 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
750

21 MarkarianAlexanderamarkari
26-MAY-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
850

22 ChangEddieechang
30-NOV-90 9 Stock Clerk
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
800

23 PatelRadharpatel
17-OCT-90 9 Stock Clerk
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-33
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
24 DancsBelabdancs
17-MAR-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
860

25 SchwartzSylviesschwart
09-MAY-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1100

oo_dept_table
Name Null? Type
-------------------------------------------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)

ID NAME REGION_ID
-------------------------------------------------
10 Finance1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
44 Operations 4
45 Operations 5
50 Administration 1

......................................................................................................................................................
B-34 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

rel_emp_Table_Objcol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 VelasquezCarmencvelasqu
03-MAR-90President
DEPT_TYPE(50, ’Administration’, 1)
2500

2 NgaoLaDorislngao
08-MAR-90 1 VP Operations
DEPT_TYPE(41, ’Operations’, 1)
1450

3 NagayamaMidorimnagayam
17-JUN-91 1 VP Sales
DEPT_TYPE(31, ’Sales’, 1)
1400

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-35
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
4 Quick-To-SeeMarkmquickto
07-APR-90 1 VP Finance
DEPT_TYPE(10, ’Finance’, 1)
1450

5 RopeburnAudryaropebur
04-MAR-90 1 VP Administration
DEPT_TYPE(50, ’Administration’, 1)
1550

6 Urguhart Mollymurguhar
18-JAN-91 2 Warehouse Manager
DEPT_TYPE(41, ’Operations’, 1)
1200

7 Menchu Robertarmenchu
14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
1250

8 Biri Benbbiri
07-APR-90 2 Warehouse Manager
DEPT_TYPE(43, ’Operations’, 3)
1100

9 CatchpoleAntoinetteacatchpo
09-FEB-92 2 Warehouse Manager
DEPT_TYPE(44, ’Operations’, 4)
1300

......................................................................................................................................................
B-36 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
10 Havel Martamhavel
27-FEB-91 2 Warehouse Manager
DEPT_TYPE(45, ’Operations’, 5)
1307

11 MageeColincmagee
14-MAY-90 3 Sales Representative
DEPT_TYPE(31, ’Sales’, 1)
1400 10

12 GiljumHenryhgiljum
18-JAN-92 3 Sales Representative
DEPT_TYPE(32, ’Sales’, 2)
1490 13

13 Sedeghi Yasmin ysedeghi


18-FEB-91 3 Sales Representative
DEPT_TYPE(33, ’Sales’, 3)
1515 10

14 NguyenMaimnguyen
22-JAN-92 3 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
1525 15

15 Dumas Andre adumas


09-OCT-91 3 Sales Representative
DEPT_TYPE(35, ’Sales’, 5)
1450 18

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-37
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
16 MaduroElenaemaduro
07-FEB-92 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
1400

17 Smith George gsmith


08-MAR-90 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
940

18 Nozaki Akira anozaki


09-FEB-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
1200

19 PatelVikramvpatel
06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795

20 Newman Chad cnewman


21-JUL-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
750

21 Markarian Alexanderamarkari
26-MAY-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
850

......................................................................................................................................................
B-38 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
22 ChangEddieechang
30-NOV-90 9 Stock Clerk
DEPT_TYPE(44, ’Operations’, 4)
800

23 Patel Radha rpatel


17-OCT-90 9 Stock Clerk
DEPT_TYPE(34, ’Sales’, 4)
795

24 Dancs Bela bdancs


17-MAR-91 10 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
860

25 Schwartz Sylvie sschwart


09-MAY-91 10 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
1100

rel_emp_Table_RefCol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-39
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmen cvelasqu
03-MAR-90 President
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
2500

2 Ngao LaDoris lngao


08-MAR-90 1 VP Operations
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450

3 Nagayama Midori mnagayam


17-JUN-91 1 VP Sales
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400

4 Quick-To-See Mark mquickto


07-APR-90 1 VP Finance
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450

5 Ropeburn Audry aropebur


04-MAR-90 1 VP Administration
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1550

......................................................................................................................................................
B-40 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
6 Urguhart Molly murguhar
18-JAN-91 2 Warehouse Manager
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200

9 Catchpole Antoinette acatchpo


09-FEB-92 2 Warehouse Manager
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1300

10 Havel Marta mhavel


27-FEB-91 2 Warehouse Manager
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1307

11 Magee Colin cmagee


14-MAY-90 3 Sales Representative
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400 10

13 Sedeghi Yasmin ysedeghi


18-FEB-91 3 Sales Representative
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1515 10

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-41
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
14 Nguyen Mai mnguyen
22-JAN-92 3 Sales Representative
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1525 15

15 Dumas Andre adumas


09-OCT-91 3 Sales Representative
0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450 18

16 Maduro Elena emaduro


07-FEB-92 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400

17 Smith George gsmith


08-MAR-90 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
940

18 Nozaki Akira anozaki


09-FEB-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200

......................................................................................................................................................
B-42 Oracle iDS Reports: Build Internet Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
19 Patel Vikram vpatel
06-AUG-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795

20 Newman Chad cnewman


21-JUL-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
750

21 Markarian Alexander amarkari


26-MAY-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
850

22 Chang Eddie echang


30-NOV-90 9 Stock Clerk
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
800

23 Patel Radha rpatel


17-OCT-90 9 Stock Clerk
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports B-43
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
24 Dancs Bela bdancs
17-MAR-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
860

25 Schwartz Sylvie sschwart


09-MAY-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1100

......................................................................................................................................................
B-44 Oracle iDS Reports: Build Internet Reports
................................
Appendix C: Frequently Asked Questions
.....................................................................................................................................................

Frequently Asked Questions


Contents
1 How do I set up and run my reports on a remote server?
2 How can the Report Builder Background Engine be shut down programmatically
from another Oracle Developer application?
3 How do I pass parameters with spaces from the command line or from the Form
Builder built-in RUN_REPORT_OBJECT or RUN_PRODUCT?
4 How do I print a report to an ASCII file with no page breaks or control characters?
5 How do I create a report containing barcodes in Report Builder?
6 How do I print a character mode report in landscape orientation?
7 How do I send report output to a fax?
8 How do I suppress blank rows or columns in a Matrix report?
9 How can I print to the second printer tray using Report Builder?
10 What Registry parameter is used in Windows to redirect where temporary files are
created?
11 How do I automatically delete temporary files created when running reports using
Reports Runtime?
12 Is there any way to programmatically disable the Print button in the run-time
Previewer?

......................................................................................................................................................
C-2 Oracle iDS Reports: Build Internet Reports
Frequently Asked Questions and Answers
.....................................................................................................................................................

Frequently Asked Questions and Answers


Accessing Reference Material
The reference numbers given in these answers are the index numbers that enable you
to search for a document in Metalink if you are a member of the Oracle Metals
Program; that is, support levels Bronze, Silver, and Gold. If you do not currently have
one of these metal support services, you can call your sales representative to upgrade
your support service level.
You can use these numbers for an exact match, or you can search on full words
pertaining to the problem you are having, such as BOILERPLATE.
From http://support.oracle.com/metalink select the TOOLS option and then
select Oracle Developer reports. From there select Top Product Articles and enter the
text for your search. Click the Advanced button and select ConText Syntax before
starting the search.
Oracle allows access to published bulletins only from Metalink. If you do not find the
topic you need, call the support center for help. Material is constantly being added to
this site in an effort to give customers fast access to the information they need.
Note: These documents can also be obtained by calling the customer support hotline.
1 How do I set up and run my reports on a remote server?

Answer The Multitiered Reports Server, which is part of Oracle Reports Developer
release 6i, enables you to run reports on a remote application server. When used in
conjunction with the Reports Web CGI or Web Cartridge, it also enables you to run
reports from a Web browser using standard URL syntax. The server can be installed on
Windows NT, Windows95, or UNIX. It handles client requests to run reports by
entering all requests into a job queue.

For Further Information


• Oracle Developer R6.0 Documentation: Online Manuals
• Oracle Developer: Guidelines for Building Applications
2: Deploying Applications on the Web
2.2.3: Configuring Reports for the Web
2.2.3.1: Setting up the Reports Server

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports C-3
Appendix C: Frequently Asked Questions
.....................................................................................................................................................

2 How can the Report Builder Background Engine be shut down


programmatically from another Oracle Developer application?
Answer
In your Form application, use ORACLE_SHUTDOWN = Yes as a parameter in a
parameter list that you pass to the Form Builder built-in, RUN_PRODUCT.
The parameter value, Yes, must have initial capitals.
References
<PrSol:2067466.6>
3 How do I pass parameters with spaces from command line or from the Form
Builder built-in RUN_REPORT_OBJECT or RUN_PRODUCT?
Answer
Use a CMDFILE for passing parameters with spaces from the command line.
Use extra quotes to delimit values to pass parameter values with spaces when
using RUN_REPORT_OBJECT or RUN_PRODUCT.
References
<PrSol:2056652.6>
4 How do I print a report to an ASCII file with no page breaks or control
characters?
Answer
Remove "CONTROL(L)" from the "AFTER PAGE{S} CONTROL(L)" line in
dflt.prt or use DESFORMAT=no_ff. (A no_ff.prt printer definition file is
supplied as part of the Report Builder installation in the
<oracle_home>\report60\printers directory.)
References
<PrSol:2058834.6>

......................................................................................................................................................
C-4 Oracle iDS Reports: Build Internet Reports
Frequently Asked Questions and Answers
.....................................................................................................................................................

5 How do I create a report containing barcodes in Report Builder?


Answer
In Windows, use the barcode font supplied as part of the Report Builder
installation, in the <oracle_home>\tools\devdem60\bin directory, or any third-
party barcode font.
Alternatively, you can use Oracle Developer Graphics Builder.
References
<PrSol:2059321.6>
6 How do I print a character mode report in landscape orientation?
Answer
Manually edit escape sequences into a .prt file.
References
<Note:34318.1> Landscape Printing in Reports on Windows
7 How do I send report output to a fax?
Answer
Install a third-party software—for example Winfax—and make that a printer.
In order to programmatically fax a report without any user interaction through
Microsoft Exchange Fax driver, look up bulletin BUL 13000147.6 (CR 159472).
References
<PrSol:2083424.6>

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports C-5
Appendix C: Frequently Asked Questions
.....................................................................................................................................................

8 How do I suppress blank rows or columns in a Matrix report?


Answer
In release 2.0 or earlier, create a summary column in the cross product group to
count the number of cells that hold a NOT NULL value. Use a format trigger to
suppress the row or column if this value is zero.
Starting with release 6, a nested matrix style creates a “non-sparse” matrix by
default, which means that it suppresses all blank rows or columns.
References
<PrSol:2065884.6>
9 How can I print to the second printer tray using Report Builder?
Answer
Use a Before Report, Between Pages, or other format trigger to switch to different
printer trays as your report formats. You can determine the names of the printer
trays defined for your printer in the Page Setup dialog box.
In release 2.0, use SRW.SET_ATTR (PRINTER_INTRAY attribute) to set the
printer tray as desired.
In release 6i, use SRW.SET_PRINTER_TRAY, which provides an easier syntax
similar to Form Builder.
References
– <PrSol:2063840.4>
– <Note:40507.1>

......................................................................................................................................................
C-6 Oracle iDS Reports: Build Internet Reports
Frequently Asked Questions and Answers
.....................................................................................................................................................

10 What Registry parameter is used in Windows to redirect where temporary


files are created?
Answer
Report Builder uses the REPORTS60_TMP parameter in the Registry. If this is not
set, then it uses the working directory instead.
11 Is there any way to programmatically disable the Print button in the run-time
Previewer?
Answer
Include the DISABLEPRINT=YES argument in your command line.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports C-7
Appendix C: Frequently Asked Questions
.....................................................................................................................................................

......................................................................................................................................................
C-8 Oracle iDS Reports: Build Internet Reports
................................
Appendix D: Oracle Rdb Overview
.....................................................................................................................................................

What Is Oracle Rdb?


Oracle Rdb is a multiuser relational database management system designed and
developed by Oracle Corporation for high availability, high performance, and ease of
use in large-scale, mission-critical applications. It includes a full set of utilities for
database maintenance and an industry-standard version of SQL that allows you to
easily create applications and maintain your Oracle Rdb databases.
Oracle Rdb is currently running on over 45,000 servers at more than 15,000 sites
worldwide. It is used in many large online transaction processing (OLTP) systems and
its customer list is made up of some of the world’s leading corporations. Oracle
continues to enhance the functionality of Rdb by adding new features and
strengthening integration with other Oracle technology and tools.

Supported Platforms
Oracle Rdb is available on the following computing platforms:
• OpenVMS VAX
• OpenVMS Alpha
• Windows NT Intel and Alpha

Oracle Rdb Features


These are some of the features that Oracle Rdb offers:
• Disaster tolerance
The Hot Standby option is ideal where very high performance and continuous
(7 ×365) availability is essential. It provides disaster tolerance across
geographically dispersed systems using the existing network with no change in
applications or material increment in system overhead. The Hot Standby system
can be accessed simultaneously for read-only transactions.
• High performance
Rdb is optimized to meet enterprise OLTP requirements for the highest levels of
performance on OpenVMS Alpha and VAX. Features include full support for
64-bit Very Large Memory on OpenVMS Alpha, mixed-clusters, patented Record
Caching, pinning tables in memory for rapid access, a patented Dynamic Query
Optimizer, and Query Outlines for repeatable query performance.
• Ease of management
Rdb provides comprehensive, simple management of Rdb databases. Default
database settings provide great performance for Rdb out of the box. The Enterprise
Manager DBA Pack for Rdb provides a complete set of management tools for Rdb
that can be run from the Oracle Enterprise Manager console. The TRACE/Expert
option provides performance monitoring and expert database design for Rdb. Rdb8
integration with Oracle Enterprise Manager provides common graphical interfaces
to manage Rdb and Oracle RDBMS from the same Windows console.

......................................................................................................................................................
D-2 Oracle iDS Reports: Build Internet Reports
What Is Oracle Rdb?
.....................................................................................................................................................

Oracle Rdb Features (continued)


• Support for Windows NT Intel and Alpha
Compaq customers can extend their OpenVMS environment to include NT and
run Rdb applications on commodity Intel platforms. Rdb8 on NT is a native, multi-
threaded, complete implementation of Rdb.
• Integration with other Oracle technologies
Rdb customers can leverage their investment in Rdb by enhancing existing
applications and developing new ones with the latest Oracle tools for Web and
client-server application development, and powerful business intelligence analysis.
Customers can make a single investment in products and training that is
completely portable across Rdb and Oracle RDBMS. Rdb supports Oracle
Application Server, Oracle Developer, Oracle Designer, Oracle Discoverer, and
Oracle Express Server.
• Support for SQL*Net for Rdb
This enables integration with the Oracle technologies listed above. Customers and
application partners can use standard Oracle APIs to build applications that run on
Rdb and Oracle RDBMS. Data sharing between Rdb and Oracle RDBMS is
enabled without the use of gateways. Rdb includes support for the Oracle Call
Interface (OCI), Oracle network protocols, and DB Links.

Other Information

Oracle Rdb Education Oracle Education offers a comprehensive series of Oracle


Rdb courses. The course titles include:
• Introduction to Rdb: Technical Overview and SQL Language
• Rdb for the Database Administrator
• Rdb for the Database Designer
• Rdb 3GL Programming
• Rdb Performance and Tuning
• Rdb Internals
To receive the Oracle Education U.S. schedule and catalog, which contains complete
course descriptions, pricing, and enrollment information, call 1.800.633.0575 within
the continental U.S. or 650.633.5019 from outside the U.S. For international course
information, contact the Oracle site nearest to you. You can also get Oracle Education
information and order catalogs from the following website:
http://www.oracle.com.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports D-3
Appendix D: Oracle Rdb Overview
.....................................................................................................................................................

Other Information (continued)

Oracle Rdb Product Information The Rdb Web site is a resource for finding out
the latest news on the product and its features. Look here for information such as:
• New product releases
• Product interoperability information
• How customers are using Oracle Rdb
• Calendar of product-related events
To access the Web site, go to the following URL: http://www.oracle.com/
rdb

Oracle Rdb Demonstration CD-ROM To receive a free Oracle Rdb product


demonstration CD-ROM, send an e-mail including your name, address, and company
to: infordb@us.oracle.com.
Specify that you would like to receive the free Oracle Rdb CD-ROM.

......................................................................................................................................................
D-4 Oracle iDS Reports: Build Internet Reports
................................
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Query Builder Features

• Easy-to-use data access tool


• Point-and-click graphical user interface
• Distributed data access
• Powerful query building

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-2 Oracle iDS Reports: Build Internet Reports
What Is Query Builder?
.....................................................................................................................................................

What Is Query Builder?


Easy-to-Use Data Access Tool
Query Builder is an easy-to-use data access tool. It provides a logical and intuitive
means to access information stored in networked, distributed databases for analysis
and reporting.

Point-and-Click Graphical User Interface


Query Builder enables you to become productive quickly because its graphical user
interface works like your other applications. A toolbar enables you to perform
common operations quickly.

Distributed Data Access


Query Builder represents all database objects (tables, views, and so on) as graphical
datasources, which look and work exactly the same way regardless of which database
or account the data came from.
• Performing distributed queries on complex, enterprisewide databases is no more
difficult than querying a single database.
• Locating database objects is easy because Query Builder uses a single hierarchical
directory that lists all accessible data in your account, in other accounts, and in
other databases.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-3
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Query Builder Features

• Easy-to-use data access tool


• Point-and-click graphical user interface
• Distributed data access
• Powerful query building

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-4 Oracle iDS Reports: Build Internet Reports
What Is Query Builder?
.....................................................................................................................................................

Powerful Query Building


Query Builder is designed for professionals who do not have a computer programming
or database background. However, because of its powerful query features and its
support of Structured Query Language (SQL) statements, experienced database users
and programmers will find that Query Builder serves many of their needs as well.
• Graphical representation of tables and their relationships enables you to see the
structure of your data.
• You can build queries by clicking the columns that you want to retrieve from the
database. The browser generates the necessary SQL statements behind the scenes.
• You can specify exactly which rows to retrieve from the database by using
conditions, which consist of any valid SQL expression that evaluates to true or
false.
• You can combine and nest conditions graphically using logical operators. You can
disable conditions temporarily for what-if analysis.
Note: Query Builder as a tool in itself also includes WYSIWYG formatting and
reporting capabilities. This appendix describes Query Builder as part of tools such as
Report Builder.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-5
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Query Builder Window

2 3

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Toolbar
2 Conditions panel
3 Datasource panel

......................................................................................................................................................
E-6 Oracle iDS Reports: Build Internet Reports
The Query Builder Window
.....................................................................................................................................................

The Query Builder Window


The Query Builder graphical user interface consists of one window, the Query
window, where you build your queries.

Query Window Panels


The Query window is divided into two panels:
• The Conditions panel where you specify conditions to refine your queries
• The Datasource panel where you display and select tables and columns for a query

Toolbar
The toolbar enables you to issue commands with a click of the mouse. You can create
conditions, add new datasources, or define new columns.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-7
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Building a New Query

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-8 Oracle iDS Reports: Build Internet Reports
Building a New Query
.....................................................................................................................................................

Building a New Query


To build a query, you must select the tables you want to include and the columns you
want to retrieve.

How to Include a Table


1 Choose Select Data Tables from the toolbar.
The Select Data Tables dialog box appears.
Note: When you open Query Builder to create a new query, the Select Data Tables
dialog box is open by default.
2 Select the table name and then click Include, or simply double-click the desired
table name.
The selected table appears in the Query window.
3 Click Close to close the dialog box.
You can at any time include additional tables in the query by following these steps.

How to Delete a Table


1 Select the data source in the Query window.
2 Select Clear from the toolbar or press [Delete].

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-9
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Datasource Components

1 5

2
6
3
7

4 8

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Datasource name 5 Object type


2 Primary key 6 Column datatype
3 Column name 7 Recursive relationship icon
4 Foreign key 8 Comments icon

......................................................................................................................................................
E-10 Oracle iDS Reports: Build Internet Reports
Datasource Components
.....................................................................................................................................................

Datasource Components
Tables
A table that has been included in a query is referred to as a datasource. It is displayed
as a rectangular graphic in the Datasource panel of the Query window. The top part of
the rectangle contains the table name and an icon representing its type.
Type Description
Table Stores data in the database.
View Acts like a table when you execute a query, but is really a pointer to either a
subset of a table, a combination of tables, or a join of two or more tables.
Synonym Another name for an object. Sometimes table names can be rather cryptic,
such as emp_em_con_tbl. You can create a synonym that simply calls this
table Contracts.
Alias Query Builder uses an alias name for a table when the table is used more
than once, mostly with self-joins (you can also rename a table).

Columns
The body of the rectangle contains column names listed vertically. To the right of the
column name is an icon representing the datatype.
Columns also provide additional information.
• Primary keys are displayed in bold.
• Foreign keys are displayed in italics.
• Recursive relationships are indicated by a self-relationship icon.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-11
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Refining a Query

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-12 Oracle iDS Reports: Build Internet Reports
Refining a Query
.....................................................................................................................................................

Refining a Query
Adding Columns to a Query
There are several methods of adding columns to a query:
• Select the check box to the right of the column name
• Double-click the column name
To include all columns from any single table, double-click the table heading.

Removing Columns to a Query


There are several methods of removing columns to a query:
• Clear the check box to the right of the column name
• Double-click the column name
To remove all columns from any single table, double-click the table heading.

Changing Column Position in a Query


By default, Query Builder places columns in the order in which you select them. You
can resequence them by selecting the Column Sequence tool.
The Column Sequence dialog box appears. Column names are shown in the Displayed
Columns list in order of their appearance in the query. Drag any column to a new
position.
Note: You can also use the Column Sequence dialog box to add columns to or remove
them from a query.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-13
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Sorting Data

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-14 Oracle iDS Reports: Build Internet Reports
Refining a Query
.....................................................................................................................................................

Sorting Data
By default, a query returns the data in no specific order. To sort the data, you must add
an ORDER BY clause to the query.

How to Add an ORDER BY Clause to a Query


1 Select the Sort tool. The Sort dialog box appears.
2 Select the column you want to sort from the Available Columns list.
3 Select Copy.
Query Builder adds the column to the Sorted Columns list and places an up arrow
in the list box to indicate the default sort ascending order.
Note: You can sort by more than one column. Query Builder sorts according to the
order in which columns appear in the Sorted Columns list.
4 You can change the sorting order by selecting the column name in the Sorted
Columns list and selecting the desired option button.
5 Select OK to close the dialog box.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-15
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Viewing and Saving Queries

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-16 Oracle iDS Reports: Build Internet Reports
Viewing and Saving Queries
.....................................................................................................................................................

Viewing and Saving Queries


Viewing a Query
Select the Show SQL tool to view the query text that Query Builder will create.

How to Save a Query


You can save your query as a SQL statement to the file system.
1 Select the Save tool from the toolbar.
The Save As dialog box appears.
2 Enter a filename.
Note: If you do not enter a file extension, Query Builder automatically appends the
.SQL file extension.
3 Select a destination.
4 Click OK.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-17
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Including Additional Tables

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-18 Oracle iDS Reports: Build Internet Reports
Including Additional Tables
.....................................................................................................................................................

Including Additional Tables


Often, all of the data needed to create a desired report cannot be found in a single
table. With Query Builder, you can include multiple tables in a single query.
Remember that you can see the names of all the tables in your account by choosing the
Select Data Tables tool. This brings up the Select Data Tables dialog box. You can also
use this dialog box to show only certain types of datasources as well as datasources in
other accounts and databases.

How to Find Tables in Other Accounts


If you do not find the table you are looking for in the Select Data Tables dialog box in
your own account, you can search other accounts.
1 Open the pop-up menu to display the name of the current database and the option
databases.
2 Select the current database name.
The list box displays a list of accounts that contain tables you can access.
3 Select the name of the account in the list and then click Open, or simply double-
click the account name. This opens the account and displays a list of tables in the
account.
4 Follow the normal procedure for including tables in the Query window.

How to Find Tables in Other Databases


If you do not find the table you are looking for in the Select Data Tables dialog box in
your own account, you can search other databases.
1 Open the pop-up menu to display the name of the current database and the option
databases.
2 Select databases.
The list box displays a list of databases you can access.
3 Select the name of the database in the list and then click Open, or simply double-
click the account name.
4 Follow the normal procedure for including tables in the Query window.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-19
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Viewing Comments

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-20 Oracle iDS Reports: Build Internet Reports
Including Additional Tables
.....................................................................................................................................................

How to View Comments


Sometimes, details about the kind of data stored in the database are not reflected by the
table or column names. This can often make it difficult to decide which objects to
include in your query. Query Builder features the Get Info dialog box to provide this
kind of information for tables and columns.
To open the dialog box, follow these steps:
1 In the Datasource panel, select the table or column name.
2 Select the Get Info tool.
Alternatively, you can double-click the Comment icon in each table or column in the
Datasources panel.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-21
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Including Related Tables

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-22 Oracle iDS Reports: Build Internet Reports
Relationships
.....................................................................................................................................................

Relationships
To combine data from multiple tables into one query, Query Builder enables you to
search for relationships between tables and to create user-defined relationships if they
do not exist. Additionally, you can activate or deactivate relationships to suit your
needs.

How to Find and Include Related Tables


1 Select the table in the Datasource panel.
2 Choose the Select Related Tables tool.
A list of tables that have relationships defined with the selected table appears.
3 Select the table name and click Include, or simply double-click the table name.
The selected table appears in the Datasource panel. Relationships between the
tables are identified by relationship lines, drawn from the primary keys in one table
to the foreign keys in another.
4 Click Close to close the dialog box.
Once you have included the table, you can retrieve its columns.
Note: When you select a foreign key column before selecting related tables, only the
table to which the foreign key refers appears in the Select Related Tables dialog box.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-23
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Creating a User-Defined Relationship

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-24 Oracle iDS Reports: Build Internet Reports
Relationships
.....................................................................................................................................................

Creating a User-Defined Relationship


When you create a user-defined relationship, Query Builder draws a relationship line
connecting the related columns.

How to Create a Relationship


1 Select the Set Table Relationship tool.
The Set Relationship dialog box appears.
2 Enter the foreign key (A—>) and primary key (B—>) column names.
3 Type the complete table and column names (separate the table name from its
column name with a period).
4 Click OK to close the dialog box.

How to Create a Relationship (Optional Method)


1 Select the column that you want to relate (foreign key).
2 While holding down the mouse button, drag the cursor to the related column in the
second table (the primary key).
You are drawing a relationship line as you do so.
3 Once the target column is selected, release the mouse button to anchor the
relationship line.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-25
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Unmatched Rows

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-26 Oracle iDS Reports: Build Internet Reports
Relationships
.....................................................................................................................................................

Retrieving Unmatched Rows


Query Builder lets you choose whether to retrieve any unmatched rows when you are
using a relationship in a query. An unmatched row occurs when the relationship
connects tables where there are values on one side that have no corresponding values
on the other side.
There are three types of relationships that you can choose from:
• Display records from table A not found in table B
• Display records from table B not found in table A
• Suppress any mismatched records (default)

How to Create an Unmatched Relationship


1 Click on the relationship line that connects the tables.
Both the column names and the relationship line should be selected.
2 Select the Set Table Relationship tool from the toolbar.
The Set Relationship dialog box appears.
3 Choose one of the three relationship option buttons.
4 Click OK.
An unmatched relationship icon is placed on the relationship line next to the
column that returns unmatched rows.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-27
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Conditions

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-28 Oracle iDS Reports: Build Internet Reports
Selecting Rows with Conditions
.....................................................................................................................................................

Selecting Rows with Conditions


The Conditions Panel
The Query window contains two independently scrollable panels, the Conditions panel
and the Datasource panel. The Datasource panel is where you include tables and
columns. The Conditions panel is where you apply conditions. You enter conditions
into the Condition field of the panel.

How to Add Conditions to a Query


1 Activate the Conditions field.
2 Enter the text that describes the condition.
Type the conditions directly into the Condition field.
Or
Click in the columns in the Datasource panel and enter the rest of the condition.
Or
Select columns and functions, using the appropriate tools.
Note: Character and date values must be enclosed in single quotes.
3 Close and validate the condition.
Note: If a column is used in a condition but it is not displayed in the results
window, a gray check mark appears to the left of the column name in the
datasource in the Query Window.

Closing and Validating the Condition


Query Builder automatically validates the condition when you close the Condition
field.
You can close the Condition field in the following ways:
• Press [Return].
• Click in the Conditions panel outside the Condition field.
• Select Accept from the toolbar.

The Toolbar
The logical operators and the Accept and Cancel tools in the toolbar are active
whenever the Condition field is active. You can insert an operator from the toolbar into
the condition by clicking it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-29
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Operators
Arithmetic
• Perform calculations on numeric and date columns
• Examples: +, -, x, /
Logical
• Combine conditions
• Examples: AND, OR, NOT
Comparison
• Compare one expression with another
• Examples: =, <>, <, IN, IS NULL,
BETWEEN ... AND

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-30 Oracle iDS Reports: Build Internet Reports
Operators
.....................................................................................................................................................

Operators
An operator is a character or reserved word that is used to perform some operation in
Query Builder, such as the + operator, which performs addition. Query Builder uses
several types of operators.

Arithmetic Operators
Arithmetic (+, -, x, /) operators are used to perform calculations on numeric and date
columns. In handling calculations, Query Builder first evaluates any multiplication or
division, and then evaluates any addition or subtraction.

Logical Operators
Logical operators are used to combine conditions. They include:
• AND: Causes the browser to retrieve only data that meets all conditions
• OR: Causes the browser to retrieve all data that meets at least one of the
conditions
• NOT: Used to make a negative condition, such as NOT NULL

Comparison Operators
Comparison operators are used to compare one expression with another, such that the
result will either be true or false. The browser returns all data for which the result
evaluates true.
Operator Usage
= Equal
<> Not equal
< Less than
<= Less than or equal
> Greater than
>= Greater than or equal
BETWEEN... Between two values
AND...
IN (LIST) Equal to any member of the following list
IS NULL Is a NULL value. A row without a value in one column is said to contain a
NULL value.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-31
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Multiple Conditions

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-32 Oracle iDS Reports: Build Internet Reports
Entering Multiple Conditions
.....................................................................................................................................................

Entering Multiple Conditions


There is no limit to the number of conditions you can include in a browser query.
Multiple conditions are always combined using logical operators. You can add
conditions to any query either before or after execution.

How to Add Conditions


The Conditions panel always displays a blank Condition field at the bottom of the list
of conditions. Use this field to enter multiple conditions.
1 Click in the empty Condition field to activate it.
2 Enter the new condition.
Each time you add a condition, a new blank Condition field is created.
Note: Pressing [Shift]-[Return] following the entry of each condition is the fastest
way to create multiple conditions, because it moves the cursor and prompt down
one line so that you can enter another condition.
3 Press [Return] to close and validate the condition.

How to Change Logical Operators


By default, Query Builder combines multiple conditions with the AND operator. To
change the logical operator:
1 Select the logical operator in the Conditions panel.
2 Click a new operator on the toolbar or select one from the Data menu.

How to Create Nested Conditions


Query Builder enables you to combine logical operators to produce complex queries
made up of multiple levels of conditions. These are referred to as nested conditions. To
nest two or more conditions:
1 Build each condition to be included in the nest.
2 While holding down the [Shift] key, click in the box to the left of each condition to
be nested.
3 Select the logical operator to combine the conditions—either AND or OR.
Query Builder draws a box around the highlighted conditions in the Conditions
panel and combines them with the operator that you specified.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-33
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Deactivating a Condition

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-34 Oracle iDS Reports: Build Internet Reports
Changing Conditions
.....................................................................................................................................................

Changing Conditions
If you change your mind about including one or more conditions in your query, you
can delete, deactivate, or edit any of them in the Conditions panel.

How to Delete a Condition


1 Click inside the Condition field to activate it.
2 Select Clear from the toolbar or select Delete.
The condition is removed from the query.

How to Deactivate a Condition


Query Builder enables you to temporarily deactivate a condition so that you can test
different scenarios without having to re-create the conditions each time.
Double-clicking the box to the left of the condition or its operator acts as a toggle
switch, alternately turning the condition on and off. Deactivated conditions remain in
the Condition field but appear dimmed.
Additionally, you can turn conditions on and off by using the Data menu:
1 Select the box to the left of the condition or its operator.
Note: Hold down the [Shift] key to select multiple conditions.
2 Double-click in the box to deactivate the condition.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-35
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Defining Columns Using an Expression

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-36 Oracle iDS Reports: Build Internet Reports
Defining Columns Using an Expression
.....................................................................................................................................................

Defining Columns Using an Expression


Besides retrieving columns of data stored in a table, Query Builder enables you to
define new columns that are derived or calculated from the values in another column.

How to Define a Column


When you define a column, it exists only in your query, not in the database.
1 Select the table where you want to define a new column.
2 Select the Define Column tool.
The Defined Column dialog box appears, which displays a list of all columns
currently defined in the query (if any).
3 Click in the Defined Column field to activate it, and then enter the name for your
new column.
4 Move your cursor to the Defined As field and enter the formula or expression that
defines your column.
5 Select Define.
The new column is added to the list of defined columns in the dialog box and
appears in the Datasource panel.
6 Click OK to close the dialog box.

How to Enter Expressions


You can enter information in the Defined As field in the following ways:
• Type the expression in directly.
• Select Paste Column.
The Paste Column dialog box appears.
– Select the column from the displayed list.
– Click OK to paste the column into your expression and return to the Define
Column dialog box.

How to Display and Hide Defined Columns


You display or hide defined columns from a query in exactly the same manner as you
do ordinary columns.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-37
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

Defining Columns Using a Function

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
E-38 Oracle iDS Reports: Build Internet Reports
Defining Columns Using a Function
.....................................................................................................................................................

Defining Columns Using a Function


The browser also enables you to define columns using a variety of built-in functions
provided by the Oracle Server. You can type a function directly in the Defined As field
of the Define Columns dialog box, or select Paste Function to select from a list.

What Is a Function?
A function is similar to an operator in that it performs a calculation and returns a
result. Functions consist of a function name followed by parentheses, in which you
indicate the arguments.
An argument is an expression that supplies information for the function to use.
Functions usually include at least one argument, most commonly the name of the
column on which the operation will be performed.

Single-Row Functions
• Return one value for every data row operated on
• Examples: INITCAP(), SUBSTR(), TRUNC()

Aggregate Functions
• Return a single row based on the input of multiple rows of data
• Examples: AVG(), COUNT(), SUM()

How to Select a Function


1 Click in the Defined As field to activate it.
2 Select Paste Function.
The Paste Function dialog box appears.
3 Select or deselect the Show Categories check boxes to view the desired list of
functions.
4 Select the function from the displayed list.
5 Select the Paste Arguments check box (optional).
Note: If this check box is selected, a description or datatype name of the
arguments appropriate for the function is pasted into your expression. You then
replace the description with the actual arguments.
6 Click OK to paste the function into your expression and return to the Define
Columns dialog box.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports E-39
Appendix E: Introduction to Query Builder
.....................................................................................................................................................

......................................................................................................................................................
E-40 Oracle iDS Reports: Build Internet Reports
................................

i
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Describe the Oracle8 scalar datatypes
• Describe object types and objects
• Describe object tables, object columns, and object
views
• Describe the INSTEAD-OF triggers
• Describe object REFs
• Identify the display of objects in the Object
Navigator

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-2 Oracle iDS Reports: Build Internet Reports
Overview
.....................................................................................................................................................

Overview
Introduction
In this lesson, you will review certain object features of Oracle8. This lesson also
explains how these objects are displayed in the Object Navigator.

Objectives
After completing of this lesson, you should be able to do the following:
• Describe the new Oracle8 scalar datatypes
• Describe object types and objects
• Describe object tables, object columns, and object views
• Describe the INSTEAD-OF triggers
• Describe object REFs
• Identify the display of objects in Object Navigator

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-3
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Oracle8 Scalar Datatypes

• NCHAR
• NVARCHAR2
• FLOAT
• NLS types

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-4 Oracle iDS Reports: Build Internet Reports
New Oracle8 Datatypes
.....................................................................................................................................................

New Oracle8 Datatypes


Scalar Datatypes
• NCHAR stores fixed-length (blank-padded if necessary) NLS character data. How
the data is represented internally depends on the national character set, which
might use a fixed-width encoding such as US7ASCII or a variable-width encoding
such as JA16SJIS.
• NVARCHAR2 stores variable-length NLS character data. How the data is
represented internally depends on the national character set, which might use a
fixed-width encoding such as WE8EBCDIC37C or a variable-width encoding
such as JA16DBCS.
• FLOAT is a subtype of NUMBER. However, you cannot specify a scale for
FLOAT variables. You can only specify a binary precision, which is the total
number of binary digits.
There is no change to the way scalar datatypes are displayed in Oracle Developer. The
new datatypes are automatically converted to existing Oracle Developer item
datatypes.

NLS Types
Oracle8 offers extended NLS (National Language Support) including national
character sets and the datatypes NCHAR and NVARCHAR2, which store NLS data.
With NLS, number and date formats adapt automatically to the language conventions
specified for a user session, so that users around the world can interact with Oracle in
their native languages. NLS is discussed in Oracle8 Server Reference Manual.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-5
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Types

Attributes

Ship

ORDER
po_no Cancel
Check custinfo
status line_items
amount

Hold
Methods

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-6 Oracle iDS Reports: Build Internet Reports
New Oracle8 Datatypes
.....................................................................................................................................................

Object Types
An object type is a user-defined composite datatype. Orcale8 requires enough
knowledge of a user-defined datatype to interact with it. Therefore, in some sense an
object type is similar to a record type, and in some sense it is similar to a package.
An object type must have one or more attributes and can contain methods.

Attributes An object type is similar to a record type in that it is declared to be


composed of one or more subparts that are of predefined datatypes. Record types call
these subparts fields, but object types call these subparts attributes.
Attributes define the object structure.
CREATE TYPE address_type AS OBJECT
(address VARCHAR2(30),
city VARCHAR2(15),
state CHAR(2),
zip CHAR(5));
CREATE TYPE phone_type AS OBJECT
(country NUMBER(2),
area NUMBER(4),
phone NUMBER(9));
Just as the fields of a record type can be of other record types, the attributes of an
object type can be of other object types. Such an object type is called nested.
CREATE TYPE address_and_phone_type AS OBJECT
(address address_type,
phonephone_type);
Object types are like record types in another sense; both of them must be declared as
types before the actual object or record can be declared.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-7
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Types

Attributes

Ship

ORDER
po_no Cancel
Check custinfo
status line_items
amount

Hold
Methods

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-8 Oracle iDS Reports: Build Internet Reports
New Oracle8 Datatypes
.....................................................................................................................................................

Object Types (continued)

Methods An object type is also similar to a package. Once an object is declared, its
attributes are similar to package variables. And like packages, objects types can
contain procedures and functions. In object types, these subprograms are known as
methods. A method describes the behavior of an object type.
Like packages, object types can be declared in two parts: a specification and a body.
As with package variables, attributes declared in the object type specification are
public and those declared in the body are private. Also as with package subprograms,
all methods are defined in the package body, but only those whose specification
appears in the object type specification are public methods.
Here is an example of an object type:
CREATE TYPE dept_type AS OBJECT
(dept_idNUMBER(2),
dnameVARCHAR2(14),
loc VARCHAR2(3),
MEMBER PROCEDURE set_dept_id (d_id NUMBER),
PRAGMA RESTRICT_REFERENCES (set_dept_id,
RNDS,WNDS,RNPS,WNPS),
MEMBER FUNCTION get_dept_id RETURN NUMBER,
PRAGMA RESTRICT_REFERENCES (get_dept_id,
RNDS,WNDS,RNPS,WNPS));
CREATE TYPE BODY dept_type AS
MEMBER PROCEDURE set_dept_id (d_id NUMBER)
IS
BEGIN
dept_id := d_id;
END;
MEMBER FUNCTION get_dept_id
RETURN NUMBER
IS
BEGIN
RETURN (dept_id);
END;
END;

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-9
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Tables

Object table based on object type

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-10 Oracle iDS Reports: Build Internet Reports
Creating Oracle8 Objects
.....................................................................................................................................................

Creating Oracle8 Objects


Introduction
Once you have declared an object type, you can create objects based on the type.

Object Tables
One way to create an object is to create a table whose rows are objects of that object
type.
Here is an example of an object table declaration:
CREATE TABLE o_dept OF dept_type;
SQL and PL/SQL treat object tables very similarly to relational tables, with the
attribute of the object corresponding to the columns of the table. But there are
significant differences. The most important difference is that rows in an object table
are assigned object IDs (OIDs) and can be referenced using a REF type.
Note: REF types are reviewed later.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-11
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Columns

Object column based on object type

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-12 Oracle iDS Reports: Build Internet Reports
Creating Oracle8 Objects
.....................................................................................................................................................

Object Columns
Another construct that can be based on an object type is an object column in a
relational table. Here is an example of a relational table creation statement with an
object column:
CREATE TABLE o_customer (
custid NUMBER (6) NOT NULL,
name VARCHAR2 (45),
repid NUMBER (4) NOT NULL,
creditlimit NUMBER (9,2),
address address_type,
phone phone_type);
In the object table, the rows of a table are objects. In a relational table with an object
column, the column is an object. The table will usually have standard columns, as well
as one or more object column.
Object columns are not assigned object IDs, and therefore cannot be referenced using
object REF values.
Note: Object REFs are reviewed later in this section.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-13
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Views

Object
Object-oriented view Relational
application table

Object views based on object types

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-14 Oracle iDS Reports: Build Internet Reports
Creating Oracle8 Objects
.....................................................................................................................................................

Object Views
Often, the most difficult part of adopting a new technology is the conversion process
itself. For example, a large enterprise might have several applications accessing the
same data stored in relational tables. If such an enterprise decided to start using object-
relational technology, they would not convert all of the applications at once. They
would convert the applications one at a time.
That presents a problem. The applications that have been converted need the data
stored as objects, while the applications that have not been converted need the data
stored in relational tables.
This dilemma is addressed by object views. Like all views, an object view transforms
the way a table appears to a user, without changing the actual structure of the table.
Object views make relational tables look like object tables. This allows the developers
to postpone converting the data from relational structures to object-relational
structures until after all of the applications have been converted. During the
conversion process, the object-relational applications can operate against the object
view, while the relational applications can continue to operate against the relational
tables.
Objects accessed through object views are assigned object IDs, and can be referenced
using Object REFs.
Note: Object REFs are reviewed later in this section.
Here is an example of an object view creation statement:
CREATE VIEW emp_view OF emp_type
WITH OBJECT OID (eno)
AS
SELECT e.empno, e.ename, e.sal, e.job
FROM emp e;

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-15
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

INSTEAD-OF Triggers

DECLARE

BEGIN

EXCEPTION

END;

Nonupdatable INSTEAD-OF
view Trigger

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-16 Oracle iDS Reports: Build Internet Reports
Creating Oracle8 Objects
.....................................................................................................................................................

INSTEAD-OF Triggers
INSTEAD-OF triggers provide a transparent way of modifying views that cannot be
modified directly through SQL DML statements (INSERT, UPDATE, and DELETE).
These triggers are called INSTEAD-OF triggers because, unlike other types of
triggers, Oracle fires the trigger instead of executing the triggering statement. The
trigger performs update, insert, or delete operations directly on the underlying tables.
Users write normal INSERT, DELETE, and UPDATE statements against the view and
the INSTEAD-OF trigger works invisibly in the background to make the right actions
take place.
INSTEAD-OF triggers are activated for each row.
Note: Although INSTEAD-OF triggers can be used with any view, they are typically
needed with object views.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-17
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

References to Objects

OID

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-18 Oracle iDS Reports: Build Internet Reports
Referencing Objects
.....................................................................................................................................................

Referencing Objects
Introduction
In relational databases, primary key values are used to uniquely identify records. In
object-relational databases, OIDs provide an alternate method.
When a row in an object table or object view is created, it is automatically assigned a
unique identifier called an object ID.

Object REFs
With relational tables, you can associate two records by storing the primary key of one
record in one of the columns (the foreign key column) of another.
In a similar way, you can associate a row in a relational table to an object by storing
the OID of an object in a column of a relational table.
You can also associate two objects by storing the OID of one object in an attribute of
another. The stored copy of the OID then becomes a pointer, or reference (REF), to the
original object.
The attribute or column that holds the OID is of datatype REF.
Note: Object columns are not assigned OIDs and cannot be pointed to by a REF.
Here is an example of a table declaration that includes a column with a REF datatype:
CREATE TABLE o_emp
( empno NUMBER(4) NOT NULL,
ename VARCHAR2(10),
job VARCHAR2(10),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
dept REF dept_type SCOPE IS o_dept) ;
Note: The REF is scoped here to restrict the reference to a single table, O_DEPT. The
object itself is not stored in the table, only the OID value for the object.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-19
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Types in Object Navigator

Copyright  Oracle Corporation, 2000. All rights reserved.

Object Type Wizard

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-20 Oracle iDS Reports: Build Internet Reports
Displaying Oracle8 Objects in the Object Navigator
.....................................................................................................................................................

Displaying Oracle8 Objects in the Object Navigator


The Object Navigator lists declared types in the Database Objects section, along with
tables, views, and other Oracle objects.

Object Types
Both the attributes and the methods are listed under each type. Also, the nested types
within address_and_phone_type are displayed in an indented sublevel.
This convention is used for nested object and object type displays throughout Oracle
Developer.

Oracle8 Type Wizard


Object types can be created using the Oracle8 Type wizard. The wizard allows you to
define the attributes and methods.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-21
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Tables in Object Navigator

Copyright  Oracle Corporation, 2000. All rights reserved.

Object Columns in Object Navigator

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-22 Oracle iDS Reports: Build Internet Reports
Displaying Oracle8 Objects in the Object Navigator
.....................................................................................................................................................

Object Tables
Object tables are displayed like relational tables, with the attributes of the object
displayed like columns in a relational table. Also, the object table type name is
displayed in parentheses after the name of the object table.

Object Columns
Object columns are displayed with the object type in parentheses after the column
name, and with the attributes of the type indented underneath the column name.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-23
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object Views in Object Navigator

Copyright  Oracle Corporation, 2000. All rights reserved.

INSTEAD-OF Trigger Dialog Box

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-24 Oracle iDS Reports: Build Internet Reports
Displaying Oracle8 Objects in the Object Navigator
.....................................................................................................................................................

Object Views
Object views are displayed like any other view, except that the object type they are
based on appears in parentheses after the view name.

INSTEAD-OF Triggers
INSTEAD-OF database triggers can now be created through the trigger creation
dialog box, just like any other database trigger.
INSTEAD-OF INSERT, UPDATE, and DELETE triggers allow you to directly insert,
update, and delete against object views. They can also be used with any other type of
view that does not allow direct DML.
When a view has an INSTEAD-OF trigger, the code in the trigger is executed in place
of the triggering DML code.

Reference For more information about INSTEAD-OF triggers, see:


Oracle8 Server SQL Reference Manual
Oracle8 Concepts Manual

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-25
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Object REFs in Object Navigator

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-26 Oracle iDS Reports: Build Internet Reports
Displaying Oracle8 Objects in the Object Navigator
.....................................................................................................................................................

Object REFs
Object types that contain attributes of type REF, and relational tables that have
columns of type REF, display the keyword REF before the name of the object type that
is being referenced.
The attributes of the referenced object type are displayed indented underneath the
column or attribute.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-27
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

Summary

• Oracle8 introduced three scalar datatypes.


• Objects and object types allow representation of
complex data.
• Three kinds of objects are object tables, object
columns, and object views.

Copyright  Oracle Corporation, 2000. All rights reserved.

Summary

• INSTEAD-OF triggers allow DML on object views.


• Object REFs store the object identifier of certain
types of objects.
• The Object Navigator can display certain types of
objects.

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
F-28 Oracle iDS Reports: Build Internet Reports
Summary
.....................................................................................................................................................

Summary
New Oracle8 Datatypes
Oracle8 introduced three new scalar datatypes and new composite dataypes such as
object types.

Objects
Three kinds of objects are object tables, object columns, and object views.
INSTEAD-OF triggers allow DML on object views.
Object REFs store the object identifier of certain types of objects.

Oracle8 Objects in the Object Navigator


The Object Navigator can display certain types of objects.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports F-29
Appendix F: Object Features in Oracle 8i
.....................................................................................................................................................

......................................................................................................................................................
F-30 Oracle iDS Reports: Build Internet Reports
................................
Appendix G: Using the Layout Editor
......................................................................................................................................................

Objectives

After completing this lesson, you should be able to


do the following:
• Control the position and size of objects in a layout
• Add lines and geometric shapes
• Define the colors and fonts used for text
• Color the body and boundaries of objects
• Import images onto the layout

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-2 Oracle iDS Reports: Build Internet Reports
Overview
......................................................................................................................................................

Overview
Introduction
In this lesson, you learn the graphical features of the Layout Editor common to Oracle
Forms Developer and Oracle Reports Developer. This will help you control the visual
arrangement and appearance of objects in your applications.

Objectives
After completing this lesson, you should be able to do the following:
• Control the position and size of objects in a layout
• Add lines and geometric shapes
• Define the colors and fonts used for text
• Color the body and boundaries of objects
• Import images onto the layout

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-3
Appendix G: Using the Layout Editor
......................................................................................................................................................

Using the Layout Editor

Common features:
• Moving and resizing objects and text
• Defining colors and fonts
• Importing and manipulating images and drawings
• Creating geometric lines and shapes

Copyright  Oracle Corporation, 2000. All rights reserved.

Using the Layout Editor

Layout types:
• Canvases in Forms
• Report layouts

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-4 Oracle iDS Reports: Build Internet Reports
Why Use the Layout Editor?
......................................................................................................................................................

Why Use the Layout Editor?


The Layout Editor is a graphical tool for defining the arrangement and appearance of
visual objects. The Layout Editor opens windows in Form Builder and Report Builder
to present the surfaces on which you can arrange objects. Some objects occur only in a
subset of the Oracle Forms Developer and Oracle Reports Developer tools, and so the
associated Layout Editor appears only there.
The following are common to each tool:
• Moving objects to new positions in the layout and aligning them with
each other
• Resizing objects and text
• Defining the colors of text and visual objects
• Creating lines, boxes, and other geometric shapes
• Importing and manipulating images on the layout
• Changing the font style and weight of text
• Accessing the properties of objects that you see in the layout

Layout Types
You can use the Layout Editor to control the visual layout in Oracle Forms Developer
and Oracle Reports Developer. The surfaces include:
• Canvas views in Forms
A canvas is the surface on which you arrange a form’s objects. Its view is the
portion of that canvas that is initially visible in a window at run time. You can also
see stacked or tabbed canvas views in the Layout Editor; their views might overlay
others in the same window. You can also display stacked views in the Layout
Editor.
• Layouts in Reports
Here, the Layout Editor lets you plan the format of a report. This includes the
frame structure of the report, as well as buttons, graphics, and background text
(boilerplate).

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-5
Appendix G: Using the Layout Editor
......................................................................................................................................................

Invoking the Layout Editor

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-6 Oracle iDS Reports: Build Internet Reports
How to Access the Layout Editor
......................................................................................................................................................

How to Access the Layout Editor


You can invoke the Layout Editor from either the builder menus or the Object
Navigator. This applies whether you are doing so for the first time in a session or at a
later stage. If you have minimized an existing Layout Editor window, you can also
reacquire it in the way that you would any window.
Note: Reports has three editors—the Layout Editor, the Data Model Editor, and the
Parameter Form Editor—that are displayed in the same window, one at a time.

Opening from the Object Navigator


• In Forms: Double-click a canvas view icon in a form hierarchy.
• In Reports: Double-click the Layout icon in a report hierarchy.

Opening from the Builder Menus


1 Make sure that you have a context for either a form in Forms or a report
in Reports. You can do this by selecting the appropriate objects in the
Navigator.
2 In Forms, select Tools—>Layout Editor from the builder menu.
In Reports, select View—>Layout Model from the builder menu to set
the context for the editor window.
In Forms, you can open several Layout Editor windows—one for each canvas view.
Make sure that you have the canvas that you want.

Closing the Layout Editor


You can close or minimize the Layout Editor window or windows as you would any
window.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-7
Appendix G: Using the Layout Editor
......................................................................................................................................................

Layout Editor: Components


1
6
3

5 2

4
Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-8 Oracle iDS Reports: Build Internet Reports
Components of the Layout Editor
......................................................................................................................................................

Components of the Layout Editor


Common components of the Layout Editor are:
• Menu facilities
While the Layout Editor window is active, the Main builder menu changes to
include three new items: View, Arrange, and Format. These are submenus for
controlling the Layout Editor.
• Horizontal toolbar
This appears across the top of the window and is a subset of the tools from the
Object Navigator.
• Style bar
This appears under the horizontal toolbar and is a subset of the Format menu. It
may also contain some other tools.
• Vertical toolbar
This contains the tools for creating and modifying objects on the layout. Note that
some tools in the palette may be hidden if you have reduced the size of the Layout
Editor window. If so, scroll buttons appear on the vertical toolbar.
There are three types of tools:
- Graphics tools for creating and modifying lines and shapes
- Product-specific tools
- Manipulation tools for controlling color and patterns
• Rulers and ruler guides
Rulers are horizontal and vertical markers to aid alignment; they appear at the top
and side of the layout region. You can switch these off or have their units altered,
as required. Drag ruler guides from the rulers across the layout region to mark
positions in the layout.
• Layout/Painting region
This is the main central/right area where you can place and manipulate objects. A
grid pattern is displayed in this area to aid alignment of objects. You can switch off
or rescale this grid if required (in Forms, the grid is hidden if the View—>Show
Canvas option is switched on).
• Status line
This appears at the bottom of the window. It shows you the mouse position and
drag distance (when moving objects) and the current magnification level.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-9
Appendix G: Using the Layout Editor
......................................................................................................................................................

Tool Palette

1
2 8
3 9
4 10
5 11
6 12
7 13

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Select 8 Rotate
2 Magnify 9 Reshape
3 Rectangle 10 Line
4 Ellipse 11 Arc
5 Polygon 12 Polyline
6 Rounded rectangle 13 Freehand
7 Text

......................................................................................................................................................
G-10 Oracle iDS Reports: Build Internet Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Creating and Modifying Objects in the Layout


You can perform actions in the Layout Editor by selecting from the vertical toolbar
and the builder menus and by controlling objects directly in the layout region.

Creating Lines and Shapes


Create geometric lines and shapes by selecting from the graphics tools in the vertical
toolbar. These include:
• Rectangles/squares
• Ellipses/circles
• Polygons and polylines
• Lines and arcs
• Freehand tool
The default tool in the vertical toolbar is Select, with which you can select and move
objects.

Creating a New Line or Shape


1 Select the required graphic tool from the vertical toolbar with a mouse
click. This selects the tool for a single operation on the layout (a double-
click causes the tool to remain active for subsequent operations).
2 Position the mouse at the start point for the new object in the layout, and
then click-and-drag to the required size and shape.
3 Release the mouse button.
Notice that the object remains selected after this procedure (selection handles appear
on its boundaries) until you deselect it by clicking elsewhere.
Note: You can produce constrained shapes (for example, a circle instead of an ellipse)
by pressing the [Shift] key during step 2.

Creating Text
The Text tool (T) lets you open a Boilerplate Text object on the layout. You can type
one or more lines of text into this object while it is selected with the Text tool. Uses of
text objects vary according to the Oracle Developer tool in which you create them.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-11
Appendix G: Using the Layout Editor
......................................................................................................................................................

Selecting Objects

Copyright  Oracle Corporation, 2000. All rights reserved.

Manipulating Objects

Expand/contract
in one direction

Expand/contract
diagonally

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-12 Oracle iDS Reports: Build Internet Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Selecting Objects for Modification


With the Select tool active, you can select one or more objects on the layout to move
or modify.
To select one object, do one of the following:
• Click the object with the mouse
• Draw a bounding box around it
If the object is small or narrow, it is sometimes easier to use the second method. Also,
an object may be transparent (No Fill), which can present a similar problem where it
has no center to select.
It is convenient to select several objects, so that an operation can be performed on
them simultaneously.
To select several objects together, do one of the following:
• Hold down the [Shift] key and then click each object to be selected
• Draw a bounding box around the objects (providing the objects are
adjacent to each other)

Changing the Size or Ratio


When an object is selected, two types of selection handles are visible:
• Corner handles: Position the mouse on one of these to change the size or
ratio of the object diagonally.
• Midpoint handles: Position the mouse on one of these to change the size
or ratio in a horizontal or vertical direction.
Note: By holding down the [Shift] key, you can resize an object without changing its
ratios. This means that squares remain as squares, and bit-mapped images do not
become distorted when resized.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-13
Appendix G: Using the Layout Editor
......................................................................................................................................................

Moving, Aligning, and Overlapping

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-14 Oracle iDS Reports: Build Internet Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Moving and Aligning Objects


When one or more objects are selected in the layout, you can:
• Move them to a new location: Do this by dragging to the required
position and releasing the mouse button. You can use the grid and ruler
lines to help you position them properly.
• Align the objects with each other: Objects can be aligned with the
leftmost, rightmost, highest, or lowest object selected. They can also be
centered and aligned with the grid. You can do this using the Alignment
feature in the Arrange menu:
Select Arrange—>Align Objects, and then set the options required in the
Alignment Settings dialog box.

A Note on Grid-Snap Alignment You can ensure that all objects that you move
align with snap points that are defined on the grid. To activate these, select
View—>Snap to Grid from the menu. You can also use the View options to change the
grid-snap spacing and units.
Note: If you position an object using one grid-snap spacing, and then try to position
other objects under different settings, it may prove difficult to align them with each
other.
Try to stick to the same snap units, if you use grid-snap at all.

Overlapping Objects
You can position objects on top of each other. If they are transparent, then one object
can be seen through another (this is explained in detail later in this lesson).
Change the stacking order of overlapping objects by selecting the object to move and
then choosing the following as required, from the Arrange menu:
• Bring to Front
• Send to Back
• Move Forward
• Move Backward

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-15
Appendix G: Using the Layout Editor
......................................................................................................................................................

Groups in the Layout

• Groups allow several objects to be repeatedly


treated as one.
• Groups can be colored, moved, or resized.
• Tool-specific operations exist for groups.
• Groups have a single set of selection handles.
• Members can be added or removed.

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-16 Oracle iDS Reports: Build Internet Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Manipulating Objects As a Group


Sometimes, you want to group objects together in the layout so that they behave as a
single object.

Placing Objects into a Group


1 Select the objects in the layout that are to be grouped together.
2 Select Arrange—>Group from the menu.
You will notice there is now a single set of selection handles for the group, which you
can treat as a single object whenever you select a member within it. The Arrange menu
also gives you options to add and remove members. Resizing, moving, coloring, and
other operations will now apply to the group.

Manipulating Individual Group Members


To manipulate group members individually, select the group and then click the
individual member. You can use options in the Group Operations menu to remove
objects from the group or to reselect the parent group.

Other Tools for Manipulating Objects


• Rotate: You can rotate a line or shape through an angle, using the tool’s
selection handles.
• Reshape: You can change size/ratio of a shape that has been rotated or
change the sweep angle of an arc. You can also reshape a polygon or
polyline.
• Magnify: You can increase magnification when you click at a desired
zoom position on the layout region. [Shift] + click reduces
magnification.
Note: You can undo your previous action in the current Layout Editor session by
selecting Edit—>Undo from the menu.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-17
Appendix G: Using the Layout Editor
......................................................................................................................................................

Format Menu

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-18 Oracle iDS Reports: Build Internet Reports
Formatting Objects in the Layout
......................................................................................................................................................

Formatting Objects in the Layout


The builder’s Format menu provides a variety of facilities for changing the style and
appearance of objects in the layout. These include:
• Font sizes and styles
• Spacing in lines of text
• Alignment of text in a text object
• Line thickness and dashing of lines
• Bevel (3D) effects on objects
• General drawing options (for example, style of curves and corners)
Whichever formatting option you intend to use, first select the objects that you intend
to change on the layout, and then choose the necessary option from the Format menu.
Some of the format options are available from the style bar.

Changing Fonts on Textual Objects


There are a number of ways to change the font characteristics of textual objects,
depending on which builder you are using. The common steps provided by the Layout
Editor are:
1 Select the objects in the layout whose content text you want to change
(these may be boilerplate text objects and other textual object types
supported by the Oracle Developer tool that you are using).
2 Select the font style and size that you require from the style bar or select
Format from the Main Builder menu, and the select the font style and
size that you require.
Note: In Microsoft Windows, selecting Font from the menu opens the standard
Windows Font dialog. In other GUI environments, the font choices may appear in the
Format menu itself. Font settings are ignored if the application is run in character
mode.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-19
Appendix G: Using the Layout Editor
......................................................................................................................................................

Color and Pattern Tools

2
3
4

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Sample window
2 Fill color/pattern
3 Line color
4 Text color

......................................................................................................................................................
G-20 Oracle iDS Reports: Build Internet Reports
Coloring Objects and Text
......................................................................................................................................................

Coloring Objects and Text


There are three tools in the vertical toolbar for coloring objects. These are:
• Fill Color: Use this tool to define the colors and pattern for an object’s
body.
• Line Color: Use this tool to define the color of a line or the boundary line
around an object.
• Text Color: Use this tool to choose the color for the text.

Coloring Objects
You can separately color the fill area (body) of an object and its boundary line (a line
object has no body).

Coloring an Area
1 Select the objects whose color you want to change.
2 Select the Fill Color tool. The color palette appears.
If you want the objects to become transparent, select No Fill at the
bottom of the color palette window.
3 Select a color from those visible. If you want the fill area to be patterned
instead of plain, then select Patterns from the bottom of the color palette,
and follow the next step.
4 If you select Patterns, another window appears with patterns for you to
choose. Select one. You can define separate colors for the two shades of
the pattern by selecting the pattern color buttons at the bottom of the Fill
Pattern palette; each button opens a further color palette.

Coloring a Line
1 With the desired layout objects selected, click the Line Color tool. The
color palette opens.
2 Select the color for lines and bounding lines from this color palette.
Select No Line at the bottom of this window to remove the objects’
boundary lines.
Note: If you set both No Fill and No Line, the affected objects become invisible.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-21
Appendix G: Using the Layout Editor
......................................................................................................................................................

Color and Pattern Tools

2
3
4

Copyright  Oracle Corporation, 2000. All rights reserved.

1 Sample window
2 Fill color/pattern
3 Line color
4 Text color

......................................................................................................................................................
G-22 Oracle iDS Reports: Build Internet Reports
Coloring Objects and Text
......................................................................................................................................................

Coloring Text
1 Select the textual objects whose color you want to change in the layout.
2 Select the Text Color tool. The color palette appears, showing the
available colors.
3 Select a color from those shown (click the appropriate square).
4 Notice that the selected objects on the layout have adopted the chosen
text color. Also, the sample area in the vertical toolbar shows a T with
the selected color, and this color appears next to the Text Color tool. This
indicates the current text color setting.

Altering the Color Palette


By selecting Format—>Layout Options—>Color Palette from the menu, you can edit
the color palette that is presented when selecting colors. This option is available only
when the builder option Color Palette Mode is set to Editable. Changes to the color
palette are saved with the current module.
Note: Modifications to the color palette will not be apparent until you close the
document and reopen it.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-23
Appendix G: Using the Layout Editor
......................................................................................................................................................

Importing Images

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-24 Oracle iDS Reports: Build Internet Reports
Importing Images and Drawings
......................................................................................................................................................

Importing Images and Drawings


Oracle Forms Developer and Oracle Reports Developer allow both static and dynamic
bit-mapped images to be integrated into the application. This section discusses how
you can import static images and drawings—that is, those that are fixed on the layout.
These might include:
• Company logos
• Photographs for inclusion in a report or display
• Background artwork

Importing Drawings
You can import line art onto the layout from either the file system or the database.
Select File—>Import—>Drawing from the menus, and specify the source in the
Import dialog box. The format can be Oracle or a CGM file.

Importing Images
Select File—>Import—>Image from the menus, and set the Import Image options:
Option Description
(Radio buttons) File/Database Where to import from
Filename File to be imported
Format Image format (BMP, TIFF, PCX, PICT, GIF, CALS,
RAS, Oracle Format, and PCD [Kodak Photo CD])
Quality Range from Excellent to Poor. This is a trade-off
between image resolution and memory required.

Manipulating the Imported Image or Drawing


When the imported image or drawing appears on the layout, you can move it or resize
it like other objects on the layout. It is usually better to resize images in Constrained
mode (while pressing the [Shift] key) so the image does not become distorted.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-25
Appendix G: Using the Layout Editor
......................................................................................................................................................

Summary

• You can create objects by:


– Choosing a palette tool
– Clicking and dragging on a layout region
• There are color palette tools for fill area, lines, and
text.
• View, Arrange, and Format menus are available for
layout.
• Objects can be grouped for operations.
• You can import images and drawings by using
File—>Import.

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
G-26 Oracle iDS Reports: Build Internet Reports
Summary
......................................................................................................................................................

Summary
• You can create objects by:
- Choosing the correct toolbar tool
- Clicking and dragging the layout region
• There are color palette tools for fill area, lines, and text.
• View, Arrange, and Format menus are available while you are in the
Layout Editor.
• You can group objects for operations.
• You can import images and drawings by selecting Edit—>Import.

......................................................................................................................................................
Oracle iDS Reports: Build Internet Reports G-27
Appendix G: Using the Layout Editor
......................................................................................................................................................

......................................................................................................................................................
G-28 Oracle iDS Reports: Build Internet Reports

You might also like