a guide to oracle9i1 creating database reports chapter 7

42
A Guide to Oracle9i 1 Creating Database Reports Chapter 7

Upload: fred-glen

Post on 31-Mar-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 1

Creating Database Reports

Chapter 7

Page 2: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 2

Lesson A Objectives

• Understand Reports Builder report styles• Use the Report Wizard to create a report• Configure the appearance of a report• View a report in a Web browser• Create a master-detail report• Create a custom template• Apply a custom template to a report

Page 3: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 3

Introduction to Reports Builder Database Reports

• Reports Builder allows developers to distribute reports as:– Web pages– .pdf files– Printed– And other formats

• Layout styles include:– Tabular– Form– Mailing Label– Form Letter– Matrix

Page 4: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 4

Sample Matrix Report

Page 5: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 5

Using the Report Wizard to Create a Report

• Basic steps using Report Wizard:– Specify the data that the report displays– Select the report style– Configure the report properties and layout

Page 6: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 6

Paper Design Window

Page 7: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 7

Modifying the Report Appearance

• Use Reports Builder environment to modify the report appearance and customize the report features

• Paper design window shows how report appears on paper

• To view as web page– preview paper design as web page

• Make sure form displays correct values before editing design

• Use the Paper Design window to change fonts, item sizes, etc.

Page 8: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 8

Reports Builder Object Navigator

Page 9: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 9

Viewing the Report as a Web Page

• To preview a report as a Web page:– Click the Run Web Layout button on the Reports

Builder toolbar– Creates the Web page source code for the report– Displays as Page Design view without any

formatting changes– To view formatting changes: preview the report

using either a Paginated HTML or a Paginated HTMLCSS format

Page 10: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 10

Viewing a Report as a Web Page

Page 11: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 11

Creating a Master-Detail Report

• Report can display master-detail data• SQL query must retrieve master and detail data• Use Groups page to define master and detail groups• Two report styles:

– Group left: master records appear on the left side of the report; detail records appear in columns to the right of the master records

– Group above: detail records appear below the master records

• Place column names in Levels on Available Columns page

Page 12: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 12

Example Grouped Report

Page 13: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 13

Creating Groups/Levels

Page 14: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 14

Report Templates

• Custom templates store common formatting information such as:– Font– Background color– Graphics

• Stored in .tdf file• Use Paper Layout Template Editor to edit

Page 15: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 15

Paper Layout Template Editor

Page 16: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 16

Applying Custom Templates to Reports

• Templates are applied to reports using Reports Wizard Template page

• Use Template file specification option button to select a custom template

• Or register template as a predefined template:– Modify the Developer user preferences file, so the custom

template appears in the Predefined Templates list– Copy the template file to the Reports Builder templates

folder

Page 17: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 17

Lesson B Objectives

• Understand the components of a report• Modify report components• Modify the format of master-detail reports• Create parameters to allow the user to customize

report data

Page 18: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 18

Report Components

• Data Model– Specifies the data that the report displays

• Paper Layout view– Displays the report components as symbolic

objects

• Report frames– Group related report objects

Page 19: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 19

Data Model Window

Page 20: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 20

Data Model Window

• Modify data model properties using Property Inspector

• Can modify the report’s SQL query• Create a group filter to limit the number of

records that a report query retrieves– Assign a value to the Filter Type property in the

report record group’s Property Inspector– Faster to limit retrieved values with SQL query

where clause

Page 21: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 21

Paper Layout Window

Page 22: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 22

Report Display

• Reports have a header, main section and footer

• Frames– Containers for grouping related report objects – Use to set specific properties for a group of

objects

• Record group– Have corresponding group frame– Encloses a repeating frame and an optional

header frame

Page 23: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 23

Components of a Master-Detail Report

• Master-detail reports:– Display master-detail data– Multiple record groups: master in one, detail in

another– Multiple group frames

Page 24: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 24

Master-Detail Data Model

Page 25: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 25

Master-Detail Report Layout

Page 26: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 26

Master-Detail Group Frame Relationships

Page 27: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 27

Report Parameters

• Specifies how a report appears• Specifies the report’s behavior when it runs• System parameters

– Specify properties that control how the report appears in the user display and how the report application environment behaves

– Examples: currency symbol, whether the print dialog box opens when the user prints the report

• User parameters – Allow the user to select values that specify the data that the report

displays– Example: allow the user to select a specific term ID value from a

list, and the report would then display class lists for that term only

Page 28: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 28

System Parameters

Page 29: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 29

User Parameters

• User selects from parameter list• Inserted into search condition• To create:

– Create the user parameter– Create the parameter list– Modify the report query so it uses the parameter

as a search condition

Page 30: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 30

Lesson C Objectives

• Display image data in a report• Manually create queries and data links• Create summary columns• Create formula columns• Create reports that display formatted data in a Web

browser window

Page 31: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 31

Displaying Image Data In Reports

• Retrieve and display LOB image data on reports• Use Property Inspector to change File Format to

Image to display image data

Page 32: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 32

Report with Images from the Database

Page 33: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 33

Creating Report Queries and Data Links Manually

• To create a query manually:– Open the Data Model window– Select the SQL Query tool on the Data Model tool palette – Click in the painting region, and type the SQL query

• To create a data link:– Select the Data Link tool on the Data Model tool palette– Draw a link between linked objects

• Types of data links:– Query to Query– Group to Group– Column to Column

Page 34: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 34

Manually Creating a Query and Data Link

Page 35: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 35

Creating Reports that Display Calculated Values

• Formula columns– Display values that PL/SQL functions calculate

using report data field values as input parameters

• Summary columns– Perform summary functions (such as SUM,AVG,

or MAX) on report data fields

Page 36: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 36

Example of Calculated Values

Page 37: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 37

Creating Formula Columns

• Formula columns:– Display a value that a user-defined function returns as a

result of performing computations on report data values

• To create:– Create the formula column in the report Data Model– Write the user-defined function that returns the calculated

value for the formula column– Create a layout field in the report to display the formula

column value

Page 38: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 38

Syntax for Formula Column

Page 39: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 39

Creating Summary Columns

• Summary columns:– Return a summary value, such as the sum or

average, of a series of data fields in a repeating frame

• Create summary columns for any report data field using the Totals page in the Report Wizard

• Can also create summary columns manually

Page 40: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 40

Creating Summary Columns with Reports Wizard

Page 41: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 41

Displaying Formatted Reports as Web Pages

• Use Oracle9i Application Server to generate reports dynamically• See Figure 7-70

Page 42: A Guide to Oracle9i1 Creating Database Reports Chapter 7

A Guide to Oracle9i 42

Summary

• Reports Builder creates formatted reports using database data

• Reports are drawn using the Paper Design Window

• Templates can be created to format reports

• Reports can be created to display master-detail data

• Report columns can be set to display calculations, formulas and summary information

• Reports can be generated in paper, pdf, or html format

• Dynamic reports are generated using Oracle9i Application Server