Chapter 7 Lesson B

advertisement
CHAPTER 7
LESSON B
Creating Database Reports
Lesson B Objectives
2




Describe 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
Report Components
3


In order to make more advanced modifications to
reports, it is necessary to understand and work with
the underlying components
These include the Data Model, Paper Layout view,
and report frames
The Data Model Window
4



The Data Model window shows the SQL query for a
report and the report record groups
A report record group contains the data fields
retrieved by the query
The Data Model button is used to open the Data
Model window.
The Data Model Window
5




The Data Model window is shown in Figure 7-23.
As shown in the figure, a data link connects the
query with the record group showing the
relationship between them
Generally a report record group is named
G_first_query_field
The Property Inspector is used to view and edit
properties of objects in the Data Model window
The Data Model Window
6
The Data Model Window
7



A group filter is used to limit the amount of data returned
by a query
It is applied by setting the Filter Type property for the
report record group using the Property Inspector
The property can be set to:




First (returns a specified number from the beginning of the query
results)
Last (same as first, but from the end of the results)
or PL/SQL
The PL/SQL option specifies that a PL/SQL function will be
used to evaluate each record to determine whether it should
be returned
Understanding Report Objects
8






In the Paper Layout view, repeating rows are used to
display a list of data
In a set of repeating rows, the data fields are the same
but the data for each row is different
A report has three sections: header, body, and trailer.
The header section is displayed at the beginning of the
entire report, and the trailer at the end
The body contains the report data
Buttons on the toolbar are used to navigate between
the sections. Within the report body, both the margins,
and body of the report can be edited
Understanding Report Objects
9


The Paper Layout window displays layout fields that
correspond to the report record group columns in
the Data Model
Each field is named F_column_name by default.
Report Frames
10







As in the Paper Layout Template Editor window, frames are used to
group related components in the Paper Layout window
Frames are not always easily seen because they appear one on top
of the other
Each record group in a report has a group frame
It contains a repeating frame and a header frame (which is
optional)
The repeating frame encloses repeating data rows
Repeating frames have variable sizing—they shrink and grow
depending on the amount of data found in the database
The header frame contains the column headings for a record group.
Report Frames
11





Objects cannot be moved outside of their enclosing
frames
If a developer attempts to do this, an error will appear
The best way to select a frame is to select an object
within the frame, then press the Select Parent Frame
button
The Property Inspector can be used to verify the name
of the selected frame
The Property Inspector can also be used to modify
frame properties
Components of a Master-Detail Report
12

A master-detail report contains multiple record
groups and group frames
Master-Detail Data Model
13

Each group created on the Groups page of the
Report Wizard represents a report record group in
the Data Model for a master-detail report
Master-Detail Report Frames
14



The frames of the report are stacked on top of
each other
The Select Parent Frame button is used to select
each frame
As usual, the Property Inspector should be used to
verify the name of the selected frame
Modifying Master-Detail Report Properties
15

Page breaks can be created by setting the
Maximum Records per Page Property; a value of 1
means that only one record will be printed on each
page
Modifying Master-Detail Report Properties
16




When moving form objects, it is important not to
move an item outside of its frame
Reports Builder has a feature called confine mode,
which prevents a developer from accidentally
moving an item outside of its parent frame
When this mode is on, it is impossible to move the
object out of its frame
It is best to leave confine mode on.
Modifying Master-Detail Report Properties
17





Flex mode causes a frame to become larger when an
object is moved outside of the frame borders
In addition, flex mode causes surrounding frames to be
resized as well
It is a good idea to use flex mode when making frames
longer but not when making them wider
This is because there is normally extra space at the end
of the form but not on the sides
It should be noted that flex mode overrides confine
mode, and will resize frames whether confine mode is
enabled or disabled
Modifying Master-Detail Report Properties
18




A field’s elasticity determines whether the field
remains a fixed size or can expand and contract
based on the data displayed in the field
There are several options for field elasticity
The elasticity is indicated by markings that appear
on the field edges
The options for elasticity are vertical, horizontal, or
fixed
Modifying Master-Detail Report Properties
19




Contract elasticity means the field will get smaller
to match the data, while Expand means it will get
larger to match the data
Variable elasticity means that the field will get
smaller or larger as needed
Mixed elasticity means that the horizontal and
vertical elasticity settings are different
Elasticity is adjusted using the Property Inspector
Report Parameters
20


Report parameters specify how a report appears
or control the report behavior as it runs
There are two types of report parameters:
 System
parameters control the appearance of the
report and the report application environment
 User parameters provide data values that will be used
in report queries
System Parameters
21



The report system parameters are summarized in
Table 7-3 in the book
The Property Inspector is used to modify system
parameters
In most cases, the default values for system
parameters are used.
User Parameters
22



Users select user parameters from a parameter list
The parameter value is inserted into the query that
generates the report data
The procedure for creating user parameters
includes creating the parameter, creating the
parameter list, and using the parameter in the
report search query
User Parameters
23






A user parameter is created using the Object Navigator
Once it has been created, the values are set using the Property
Inspector
The parameter object name is used to reference the
parameter within Reports Builder
It also appears next to the parameter list when prompting the
user to select the parameter value
When displaying the parameter object name as a label,
uppercase is converted to mixed case and underscores (_) are
converted to spaces
Therefore, the parameter object name TERM_DESCRIPTION
becomes Term Description.
User Parameters
24



The parameter data type must match the data type
of the database column for which the parameter is
used in the search query
It is better to use number fields as user parameters
than character fields due to the extra spaces
sometimes inserted into character fields by Oracle
10g applications
When using a number field, the parameter list can
be configured to display associated character data.
User Parameters
25



The List of Values property for the user parameter
controls the parameter list
It can contain either a static list or an SQL query
that generates a dynamic list
If a List of Values is not specified, the user will be
able to enter any text value
User Parameters
26


The report query must be modified to include a
reference to the user parameter
The parameter value selected by the user is inserted
into the query using the syntax :parameter_name.
User Parameters
27


When a report has a user parameter, the
parameter form is displayed before the report is
generated
This form contains the Lists of Values, allowing the
user to select the parameters
Customizing the Report Parameter Form
28



The report parameter form can be customized to
display different text, additional images, and
different formatting from the standard parameter
form
The Parameter Form Builder is used to modify the
parameter form
The Reports Builder Paper Parameter Form Builder
is used to adjust the display of the parameter form
Download