Professional Documents
Culture Documents
Objectives
Generating Reports as per required format and selection criteria Oracle Reports Features and Benefits Developing and executing Reports
Agenda Report Builder Components Data Model Editor Layout Editor Parameter Form Report Triggers & Program Units SRW Packages Report Types Matrix Report
3
Parameters
Default (system parameters) User-created (bind and lexical parameters)
11
Lexical References
Use a lexical reference when you want the parameter to substitute multiple values at runtime. Precede a lexical reference with an ampersand (&), eg:
The Parameters will be automatically created if not available. Set the value of Lexical parameters in Before report trigger as per business requirement, eg:
If :P_PONO is NULL then :wh := 'AND PURC_ORDER.SUPPLIER_NO ='''||:P_SUPPLIERNO||''''; End if;
12
User Parameter
On the parameter property sheet, you can specify the list of values can be derived from a SELECT statement or from static values that you specify. Enter the parameter's data type and size. Initial Value is the default value for the parameter.
13
14
Layout Editor
15
Layout
Layout objects define a report's format; i.e., the positioning and appearance of data, text, and graphics in the report output. It has 3 sections Main Section Header Section Trailer Section In every section there is Margin where you can put fields or Boiler plate texts. Various Layout Objects are Frames Repeating Frames Fields Boilerplate Text
16
Layout -Frames
A frame contains data and other report objects. It prints only as often as the object by which it is enclosed. A frame is not record-related It looks like a rectangle with two diamond shapes on both vertical sides. Create frames to group together objects to ensure they maintain their relative positions during printing It demarcates sections in your report
17
Layout Fields
Fields refer to columns and parameters viz: &Current Date &Logical Page Number &Total Logical Pages For manually created fields the source need to be associated appropriately.
19
Layout Boilerplate
Boilerplate is text, lines, or graphics not fetched by a query, yet appearing in the report output. Use boilerplate to customize your report, such as creating heading pages, adding graphics, etc. Boilerplate from Files If you have a text or graphic file that you would like to display as boilerplate in your report, you can: Import the contents of the file using the Import dialog box When you import a file, a boilerplate object is created and the contents of the file are placed in the boilerplate object. The boilerplate object's contents are static. They remain the same even if you later change the contents of the file. Link to the file Linking to a file means that the contents of the file are pulled into the boilerplate object each time the report is run. In this way, you can ensure that your output includes the most recent changes to the file.
20
21
Parameter Form
23
Boilerpla te
Field
24
25
26
27
Report Triggers
Report triggers are PL/SQL subprograms that fire at specific times during report execution and formatting. Report triggers govern conditional printing. Report triggers have PL/SQL packages that enable changing of the format attributes of an object at run time. Report triggers enable changing of properties such as color, style, format mask, spacing of a field or a boilerplate text. List of Report Triggers in the order of execution: Before Form After Form Before Report Between Pages After Report
28
Report Triggers
Before Form Fires before the Runtime Parameter form is displayed. This trigger enables accessing and changing the values of parameters, PL/SQL global variables and report level columns.
After Form Fires after the Runtime Parameter form is displayed. This trigger enables accessing parameters and checking their values. This trigger can also be used to change parameter vales or, if an error occurs, return to the Runtime Parameter Form. Columns from the data model are not accessible from this trigger.
Before Report Fires before the report is executed but after queries are parsed and data is fetched. Between Pages Fires before each page of the report is formatted, except the very first page. This trigger can be used for customized page formatting. After Report Fires after the Previewer is exited, or after report output is sent to a specified destination, such as a file, a printer. This trigger can be used to clean up any initial processing that was done, such as deleting tables. This trigger always fires irrespective of whether or not the report completes successfully.
29
Create a PL/SQL
Report program units are packages, functions, or procedures that you can reference from any PL/SQL within the current report. In the Object Navigator, select the Program Units node, then select Navigator->Create (or the Create tool). In the Program Unit editor, click in the Source Text field and type or modify the text of the subprogram.
30
Open a PL/SQL
In the Object Navigator: Double-click on the P icon in the subprogram under the Program Units node. Or, if you know what object references the PL/SQL, double-click on the PL/SQL icon in the node that represents the object. In the Program Unit editor, modify the text of the subprogram as desired.
31
SRW Packages
32
SRW Packages
Oracle Reports is shipped with a collection of PL/SQL constructs called SRW (SQL Report Writer) package which contain many functions, procedures and exceptions that can be referenced in your libraries or reports viz. SRW.MESSAGE(msg_number NUMBER, msg_text CHAR); Displays a specified message and message number. SRW.DO_SQL(sql_statement CHAR); Executes specified SQL statement. SRW.DO_SQL_FAILURE; Stops report execution upon SRW.DO_SQL failure. SRW.PROGRAM_ABORT; Stops execution of report when raised. SRW.RUN_REPORT(command_line CHAR); Executes specified R25RUN command SRW.RUN_REPORT_FAILURE; Stops report execution when failure of SRW.RUN_REPORT occurs.
33
Report Types
34
Report Types Tabular Mailing Label Form Letter Master/Master Report Master/Detail Report Group Left
Group Above
35
Tabular Report A tabular report is the most basic type of report you can build. The report output is organized in a multi-column, multi-row format, with each column corresponding to a column in the database table.
36
Mailing Label Report A mailing label report consists of data displayed in a format suitable for use as address labels on envelopes. The labels can be printed in one or many columns, and can begin at any position.
37
38
Master/Master Report
A master/master report displays at least two sets of data which are not directly related--that is, the records constituting the data are fetched using at least two separate queries
39
Break Report (Group Left) Break reports divide the rows of a table into "sets," based on a common value in one of the columns.
40
Create a break report when you want to prevent a column from repeatedly displaying the same value while other column values in the rows change. A break report resembles a master/detail (or parent/child) report in that one master record prints, followed by all the detail records with which the master has something in common. Reset Level The reset level, also known as the reset group, determines when to reset the value of the summary column to zero--in other words, how much of the source column to summarize.
41
42
Master/Detail Report A simple master/detail report contains two groups of data: the master group and the detail group. Master/detail reports are similar to break reports in the way they fetch data; for every master or break group, related detail records are fetched.
43
Matrix Report A matrix (cross tab) report contains one row of labels, one column of labels, and information in a grid format that is related to the row and column labels. A distinguishing feature of matrix reports is that the number of columns is not known until the data is fetched from the database.
44
Matrix Report
A matrix report is a cross-tabulation of four sets of data: One set of data is displayed across the page. One set of data is displayed down the page. One set of data is the cross-product, which determines all possible locations where the across and down data relate and places a cell in those locations. One set of data is displayed as the "filler" of the cells.
45
Matrix Report
Queries Although matrix report always require at least four groups, they can be built with any number of queries. If you build a matrix report with only one query (usually the most efficient structure), you must create at least three groups manually in addition to the one created by default.
46
47
Matrix Layout
A Matrix Report Layout should contain: At least two repeating frames, one with a print direction of down and one with a print direction of across A matrix object created for the cross product group, inside of which reside the cells of the matrix Boilerplate for each column and row of values, as well as for summaries .
48
Thank You
49