Reports 6i

23
Course Title : Reports 6i

description

Oracle Reports

Transcript of Reports 6i

Page 1: Reports 6i

Course Title : Reports 6i

Page 2: Reports 6i

Common report styles required in a business report

Page 3: Reports 6i

Various report destinations

Page 4: Reports 6i

Main Report executables

Main components of Report Builder

Page 5: Reports 6i

• Main objects in a report

Different methods of building the report query

Page 6: Reports 6i

• Live Pre-viewer– viewing of a reports output format without printing

it.– It also provides a set of tools to allow the format of

the report to be altered. – These include:

• Precision of numbers

• Left, right and centering of text

• Bold, underline, italic options

• Font type and size

• add dollar signs, change colors etc.

Page 7: Reports 6i

• Add page number and current date to a report– Create a report using the report wizard with no

template.– Display the report in the Pre-Viewer.– Click on the menu option insert

–Click on the date option and select the position of thedate and the format of the date required.–Click on the ‘Page Number’ option and select the page number type and location.

Page 8: Reports 6i

Report Columns• Database columns

– Columns associated with the columns retrieved from the database by the query.

• Summary columns– Summarizes another column and may recalculate for each

group.

• Formula columns– Uses a formula written in PL/SQL to calculate a value from one

or more other columnsExampleFunction salcomm return Number is

BeginReturn(:sal+nvl(:comm,0));

End;

• Placeholder columns– Holds a value that has been calculated and placed into by

formula column.

Page 9: Reports 6i

/* Does this child record compare to the max sal

for the dept ? If yes, and placeholder already

set (i.e. we have more than one max sal) set the

placeholder to the concatenated string. Else

set the placeholder to the employee's name */

if (:sal = :max_dept_sal) then

if (:highest_paid_emp <> ' ') then

:highest_paid_emp := :highest_paid_emp||' and ' ||:ename;

else

:highest_paid_emp := :ename;

end if;

end if;

return (:highest_paid_emp);

end;

Page 10: Reports 6i

Adding ChartsUsing Chart Wizard

Page 11: Reports 6i

Report Runtime Parameter Form

Page 12: Reports 6i
Page 13: Reports 6i

Triggers Categories

• Report triggers– After Parameter Form trigger – After Report trigger – Before Parameter Form trigger – Before Report trigger – Between Pages trigger

• Data triggers– Formula Triggers– Validation Triggers

Page 14: Reports 6i

PL/SQL Editor

Page 15: Reports 6i

• After Parameter Form trigger : ---------------------------------• Example :Build a dynamic where clauseFunction AfterPForm RETURN BOOLEAN ISBEGINif :P_CUSTOMER is NULL then :p_where_clause:= ' ';else :p_where_clause := 'where id >= :p_customer';end if;return(true);end;Query Syntax :-----------------SELECT ID,NAME FROM CUSTOMER &P_WHERE_CLAUSE

ORDER BY NAME

Page 16: Reports 6i

• FORMAT TRIGGER :

--------------------------EXAMPLE : HIDE FIELDS DYNAMICALLY

FORMAT TRIGGER ON SALARY FIELD

FUNCTION PAY_CLERKS_SEE_THIS RETURN BOOLEAN IS

BEGIN

IF STANDARD.USER = 'PAY_CLERK' THEN

RETURN(TRUE);

ELSE

RETURN(FALSE);

END IF;

END;

Page 17: Reports 6i

EXAMPLE : CONDITANALLY SET THE ATTRIBUTES if salary equals 2000.

FORMAT TRIGGER ON FIELD salaryFUNCTION sal_mask RETURN BOOLEAN ISBEGIN

IF :SALARY = 2000 THENSRW.ATTR.MASK :=SRW.WEIGHT_ATTR +

SRW.STYLE_ATTR +SRW.GCOLOR_ATTR +SRW.HJUST_ATTR;

SRW.ATTR.WEIGHT :=SRW.BOLD_WEIGHT;SRW.ATTR.STYLE :=SRW.UNDERLINE_STYLE;SRW.ATTR.GCOLOR := 'MAGENTA';SRW.SET_ATTR(0, SRW.ATTR);

END IF;RETURN(TRUE);END;

Page 18: Reports 6i

format trigger to add an alternating color scheme

•Highlight R_G_CATEGORY node in the Object Navigator•Move the mouse to the Layout Editor without clicking on anything.•Click the Fill Color icon and select the ‘Custom1’ color button•Click the Fill Color icon again, set the ‘Patterns’ option to ‘Transparent’•Click the Line Color icon and set it to ‘No Line’

Page 19: Reports 6i

Managing Report Templates

In a new template under the body node • default node• override node.

The default attributes of a template can be applied to any style of report. E.g. The font of data in a template can be applied to the report, regardless of its style. The override attribute of a template, are attributes which can be applied only to certain styles of reports.

Page 20: Reports 6i

Register a customized template in the predefined template list

– To make file PORT.TDF available in the Reports Wizard, predefined templates list do the following:-

– Search for file CAGPREFS.ORA, this is the reports global preferences file name under windows.

– To the Reports.xxx_Template_Desc list, add the description that you want to appear on the Template page of the Report Wizard.

– To the corresponding Reports.xxx _Template_File list, add the file name of your template in the same position as the addition you made to the description list.

– Copy the template file (filename.tdf) to ORACLE_HOME/REPORT60/ADMIN/TEMPLATE/US.

Page 21: Reports 6i

Sample image of your template in Report Wizard:

– For each report style (tabular, group left, etc.) for which the template is defined, apply the template to a sample report.

– Use a screen capture tool to capture a portion of each sample report (no larger than 2 inches wide and 3 inches high) in .bmp format using the naming convention like yyyz.bmp where

– yyy matches the filename specified in the Reports.xxx_Template_File list

Page 22: Reports 6i

• z identifies the report style:– a Group Above

– f Form-like

– g Matrix with Group

– l Group Left

– m Mailing Label

– r Form Letter

– t Tabular

– X Matrix

– Copy or create the .bmp file you want to use as a default (i.e., displays if no bitmap exists for a specific report style) and name it yyy.bmp.

– Copy each .bmp file to ORACLE_HOME/REPORT60/ADMIN/TEMPLATE/US.

Page 23: Reports 6i

Creating an additional report layout

• Used when different queries need to be placed in different styles. To do this :– In the Layout Model view, click in the tool palette.

– Click and drag a rectangular area for the default layout to display the Report Wizard.

– Follow the wizard to select the data to display in the new layout section.

– To reorder the layout sections, click and drag them to new positions in the Layout Model view.

– Modify the report output in the Live Previewer view, or choose Tools Report Wizard to re-enter the wizard.