Report Views - Ms. Aisha Al

advertisement
1
More about Reports: part 2
Aisha AlArfaj
2
Introduction
• A report is a summary view of database data that
users can view on a screen display or print on
paper.
• Reports retrieve database data using SQL
queries, perform mathematical or summary
calculations on the data, and format the output
to create documents such as tabular reports,
invoices, or form letters.
3
Report Views
• The purpose of this section is to take a closer
look at the three different views and how they
can be used to help with report creation.
• The three views are
 paper design
 Data Model
 Layout Model
4
Paper design
• The paper design view should be most familiar
to you.
• It is used to preview how the final report will
look, and it contains tools to help you
manipulate the look of the report using real data.
• Although the paper design does a good job of
showing what the finished report will look like.
• The paper design, shown in Figure 9.15, contains
a grid and tools useful to creating and modifying
the layout.
5
FIGURE 9.15
The finished Matrix with Group report.
6
Report Views
• You have already had experience moving and
resizing data and fields in paper design mode.
• You can also change the colour of text.
 Select the field heading Sales Representative.
 Then click on the lowest colour palette in the
vertical tool palette on the left.
 This allows you to change the text colour and
make the field heading to stand out from the
actual data.
• You can also use the tool palette on the left to
add graphical elements to your report.
7
FIGURE 9.17
The tool palette with short descriptions of each tool.
8
• As you look through the various views, you will
notice that the vertical tool palette on the left
adjusts to the environment.
• Even though a tool will be available in one view,
it will not be available in another.
• Therefore, it is important to pay close attention
to the view you are using and what it is capable
of doing.
9
Data Model
• The Data Model
 view is the least-used report view for simple
reports like the ones used as examples.
 is a work area to define the data used in your
report.
 The view really becomes useful when you’re
trying to understand how a bunch of tables and
columns have been combined to create a report.
• Figure 9.18 shows an example of a Matrix with
Group report in the Data Model view.
10
FIGURE 9.18
The Data Model view of the Matrix with Group report.
11
Report Views: Data Model
• Notice how both the toolbar and the tool palette
have adjusted for the environment.
• Most of the buttons on the toolbar should be
familiar to you.
• As Figure 9.18 points out, however, the Data
Wizard tool has been added.
• Most of the screens in the Data Wizard tool are
derived from the Report Wizard and should look
very familiar.
• You can use the Data Wizard to help create
queries for your report.
12
Report Views: Data Model
• The tool palette, as shown in Figure 9.19, should
look completely different from any other in
magnify
Report Builder.
select
Data
link
Cross
product
SQL
query
Summary
column
Formula
column
Placeholder
Column
JDBC
query
Ref
cursor
query
OLAP
query
XML
query
Text query
Express
FIGURE 9.19
server query
The tool palette with short descriptions for the
Data Model view.
13
Report Views: Data Model
• Select—This is the default tool. Use it to select various
objects on the report. You can then move, resize, or delete the
object.
• Magnify—Similar to the Zoom In and Zoom Out buttons on
the toolbar, except that you can specify the center of the zoom
area. To zoom out, hold the Shift key and click on the canvas.
• SQL Query—Invokes the screen from the Report Wizard
that is used to enter a query for the report. Multiple queries
can be used in the same report.
• Ref Cursor Query—Invokes the Procedure Builder with the
stubs to build a ref cursor query.
14
• Data Link—Enables you to create relationships
between two queries. The relationship can take the form
of a query to query, group to group, or column to column
link.
• Summary Column—Creates a summary column in the
Data Model view.
• Formula Column—Creates a formula column in the
Data Model view.
• Placeholder Column—Creates a placeholder column
in the Data Model view.
• Cross Product—Enables you to create a cross product
(one of each combination) of two groups.
15
Report Views: Data Model
• When creating a report without using the Report
Wizard, you would first go into the Data Model
view and define the query and information to be
used.
16
Report Views: Layout Model
• The Layout Model view has been used in some of
the previous examples to adjust the layout of a
report.
• A report is made up of three parts:
 the header
 the main
 the trailer.
• The Layout Model view allows you to edit all
three parts, as well as modify margins.
17
Report Views: Layout Model
• You have been exposed to editing the body of a
report using only the Layout Model view.
• Figure 9.20 shows the Layout Model view.
• Notice the buttons that appear on the toolbar
that are not present in the paper design view.
18
FIGURE 9.20
The Layout Model view.
19
Report Views: Layout Model
• Header—Edits the header section of the report.
• Main—Edits the main or body section of the
report. This is the default setting.
• Trailer—Edits the trailer section of the report.
• Edit Margins—Allows you to change the
margins for the report. Using the File, Page
Setup menu choice will adjust the margins for
the printed page, but might truncate the report.
20
Report Views: Layout Model
Some additions to the tool palette don’t appear in the Live
Previewer view. They include the following:
• Frame Select—Allows you to select a frame or repeating
frame along with all the objects inside.
• Rotate—Rotates a selected object. This is especially
useful if you want the text to be vertical rather than
horizontal. There are several restrictions on rotated text,
but the most important is that it is not supported on all
operating systems nor all report objects. If you are having
trouble rotating text, use the online help to see whether it
is valid for a given object.
• Reshape—Reshapes a selected object. This is mostly used
with drawn objects such as lines, rectangles, arcs, and
polygons.
• Polygon—Places a polygon on the boilerplate of the
report. Remember to double-click the final point to end
the polygon.
21
Report Views: Layout Model
• Frame—Places a frame in the report. Most often
used when creating a report without the help of the
Report Wizard.
• Repeating Frame—Places a repeating frame in
the report. Most often used when creating a report
without the help of the Report Wizard.
• Chart—Places a chart object in the report.
• Anchor—Enables you to anchor two objects
together.
• Polyline—Places a polyline on the report.
Remember to double-click the final point to end the
polyline.
• Freehand—Places a freehand-drawn object on the
boilerplate of the form.
22
Report Views: Layout Model
• The primary use of the Layout Model view is to
 fine-tune the layout of your reports.
 to create additional templates.
• Even though Report Builder ships with several
report templates, you will likely create additional
templates specifically designed for your needs.
23
Creating and Modifying Report
Templates
• The report templates included with Oracle Reports
do a good job of showing you what is possible with
Report Builder, but they will need to be modified to
be useful for you and your company.
• The templates using the Oracle buildings on the
report show that complex graphics can be added to
reports.
• However, the graphic will need to be changed to
incorporate your company logo or desired graphic.
24
Report parameters
• A report parameter specifies how a report
appears, or specifies the report's behavior when
it runs.
• Reports have two types of parameters:
▫ system parameters
▫ user parameters.
• System parameters specify properties that
control how the report appears in the user
display and how the report application
environment behaves. A table of system report
parameters is in slide 26.
• User parameters allow the user to select values
that specify the data that the report displays.
25
Report parameters
• Examples of system parameters include the
currency symbol that appears, and whether the
print dialog box opens when the user prints the
report.
• A user parameter in the Class List report would
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.
26
Report system parameter
Parameter Name
specifies
Background
Whether the report should run in the foreground or the
background of the current application
Copies
The number of report copies that are made when the report is
printed
Currency
The symbol for the currency indicator such as “$”or “£”
Decimal
The symbol for the decimal indicator , such as “.”
Desformat
The output device format, which indicates whether to create PDF
or HTML output when sending a report to a file
Desname
The name of the output device, such as the filename, printer name,
or e-mail, or printer.
Destype
The type of device to which to send the report output, such as
screen, email, or printer
Mode
Whether the report should run in character or bitmap mode
Orientation
The report print direction (landscape or portrait)
Printjop
Whether the Print Job dialog box should appear before the report
runs
Thousands
The symbol for the thousands indicator, such as “,”
27
Parameter Forms
• The reports used as examples in this book return a
relatively small amount of data.
• In a production environment, this will rarely be the
case.
• For example, sometimes you might want to see a list
of employees only in the accounting department.
• Up to this point, you would have had to create a
report that shows all the employees and sorts them
by department.
• Now, I’ll show you how parameter forms can be
used to restrict the report query to provide only a
subset of rows.
28
Parameter Forms Con.
• At the beginning of the chapter, you created a
report to show all the employees in the database.
• The report was called groupmatrix.
• You will modify that report now to show
employees for only a given department.
29
Parameter Forms Con.
• Start by opening the report that shows all the
employees in the database table.
• If you did not save the report, re-create it now
using the Report Wizard.
• By now, you should be pretty good at using the
Report Builder and it should not take too long to
create a simple report.
30
Parameter Forms Con.
• Next, define a user parameter to serve as a
placeholder for the department in which the
report will be run.
• To do this, expand the Data Model branch in the
Object Navigator, click on User Parameters, and
then click on Create in the vertical toolbar.
• The object should have a name like P_1.
• Change the object’s name t P_Department.
31
• Now select the Tools, Parameter Form Builder
menu option and you should see a dialog similar
to Figure 9.25. Scroll down to the last parameter
and you will see P_Department.
• Change the label to Department, and click on the
P_Department parameter name so that it is
highlighted. Then click OK.
32
• As you scrolled through the Parameter Form
Builder’s parameters, you probably noticed all
the different system parameters that could be
added to a parameter form.
• Normally, you will not need to add them to the
form, but if you are not happy with the defaults,
you can have them specified at runtime.
33
FIGURE 9.25
The Parameter Form Builder used to build a parameter form used by reports.
34
• The Report Editor Parameter Form should now
be displayed.
• You can modify any of the default labels to make
them more explicit if you want.
• Select the PF_P_Department field from the
form and open the Property Palette.
• To make the form more usable, take advantage
of the List of Values property found at the
bottom.
• Double-click the property value and you can
specify a list of values. Use the following
SELECT statement for this example:
35
• Also be sure to click the Hide First Column
option. Remember how the list of values works:
• The first column corresponds to the value stored
in the database, and the second column refers to
what is displayed.
36
• The final step for the parameter form is to
specify the limiting criteria in the report query.
• Open the Report Wizard and click on the Data
tab.
• Modify the code in the WHERE clause so that it
reads
37
• Then click Finish and the report will be run. The
parameter form should look similar to Figure
9.26.
• Choose the department for which you would like
to run the report, and click the Run Report
button.
• Now, only those employees in the specified
department are displayed in the report.
38
FIGURE 9.26
The completed parameter form used to limit the rows returned by the employee
report.
39
Summary
• You should now be very comfortable using
Report Builder.
• This chapter showed you how to create a report
using each of the eight different report styles.
• Each of the three different report views was
explained.
• You were shown how to modify and create
templates.
• Finally, you were also shown how to create a
parameter form and integrate it into your report.
Download