Академический Документы
Профессиональный Документы
Культура Документы
Release 6i
An Oracle Technical White Paper
April 2000
Personalized Reporting with Oracle Developer
Release 6i
INTRODUCTION
One of the powerful new features in Oracle Developer Release 6i is the ability to change the appearance and
content of a report at runtime. This feature empowers end users by letting them choose how a report will
look when they run it. It also makes it possible for report developers to create a single report definition file
(.RDF file) that serves multiple audiences. For example, you could build a report that, based upon user input,
could fetch and format additional data, and alter the formatting characteristics of all of the data.
In Release 6i, Oracle Developer can merge report definitions built from XML tags with existing .RDF files at
runtime and then execute the combination of the two.1 Thus, you can personalize a report by allowing users
to choose which XML report definitions to apply to the base .RDF file at runtime.
1
It should be noted here that you can also use XML report definitions for other things as well. For example, you can
build a complete report definition in XML that can be run by itself, without an existing .RDF file. Another possible
usage is to make batch modifications using XML report definitions with RWCON60.
Note: The XML for the personalization feature can be coded by the report developer and stored in files or
generated from some meta data source (e.g., a database). In all cases, the XML should be built by the report
developer, not the end user.
The personalizations that you need to enable for this base report are:
• Adding a summary to the beginning of the report that contains hyperlinks to the more detailed sections
of the base report.
• HILITE_COSTS, HILITE_PROFITS, and HILITE_SALES are the values above which data should be
highlighted.
• WRITE_TO_FILE is a parameter with Yes or No as its possible values. If this parameter is set to Yes,
the XML used to personalize the report is written to a file. The files generated in this way can be a
valuable testing tool to ensure that the XML is being created properly.
The Runtime Parameter Form for this report would look something like the following:
Tip: To control the location of the personalization files, you could also declare a variable in which to place the
desired path information.
ora_dir_var VARCHAR2(20);
Before you begin adding lines to the personalization file, you need to check whether the user wants the
personalizations to be written to a file and, if they do, open it for writing.
Tool_Env.Getvar('ORACLE_HOME', ora_dir_var);
:file_directory := ora_dir_var || '\';
IF :WRITE_TO_FILE='Yes' THEN
custom_summary := Text_IO.Fopen(:file_directory ||
'vid_summ_per.xml','w');
END IF;
Whenever you need to write a line, you call the AddaLine procedure as follows:
AddaLine('<report name="video_custom" author="Generated"
DTDVersion="1.0">', custom_summary);
Note the only name and source are specified for the summary data when writing the output. It is best to let
the defaulting mechanism within Reports choose any additional values for the summary data (such as reset)
based on the location of the fields in the report layout.
AddaLine(' <summary name="SumTOTAL_SALESPerCITY1"
source="total_sales1"/> ', custom_summary);
AddaLine(' <summary name="SumTOTAL_COSTPerCITY1"
source="total_cost1"/> ', custom_summary);
AddaLine(' <summary name="SumTOTAL_PROFITPerCITY1"
source="total_profit1"/> ', custom_summary);
This last line is a counter which is used to alternate the shading of the records. This shading occurs in the
F_shadingFormatTrigger which is shown later in this paper. This counter does not appear in the report
output.
AddaLine(' <summary name="CS_Count1" source="city1" function="count"
reset="Report"/>', custom_summary);
AddaLine(' </data> ', custom_summary);
The format for the monetary values parameter is interrogated and the correct format mask applied based on
the user selection.
IF :MONEY_FORMAT='$NNNN' THEN
AddaLine(' formatMask="LNNNNNNNNNNN0">',
custom_summary);
ELSIF :MONEY_FORMAT='$NNNN.00' THEN
AddaLine(' formatMask="LNNNNNNNNNNN0D00">',
custom_summary);
ELSE
AddaLine(' formatMask="LNNNGNNNGNNNGNN0D00">',
custom_summary);
END IF;
The following field definition is for the CS_Count1 summary. The F_CS_Count1FormatTrigger is used to
hide this field from the report output.
AddaLine(' <field name="f_CS_Count1" source="CS_Count1"',
custom_summary);
AddaLine(' label="" font="Arial" fontSize="9"',
custom_summary);
AddaLine(' formatTrigger="F_CS_Count1FormatTrigger">',
custom_summary);
SUMMARY
To give your users more freedom to control report output, you can code report personalizations in XML.
Users can then choose which of these XML personalizations they want to use at runtime. The best way to
implement complex personalizations is through PL/SQL where you have conditional control.
All of the examples in this paper can be viewed and testing using the video_custom.rdf report which is
contained on the Oracle Forms and Reports demo cd release 6i.
RELATED DOCUMENTATION
Publishing Reports, Part No. A73072
Oracle Forms and Reports Demos, Part No. A84469-01
For other white papers and examples about Oracle Developer, please visit the Reports Developer page on the
Oracle Technology Network Web site (http://technet.oracle.com/products/reports/).
Worldwide Inquiries:
+1.415.506.7000
Fax +1.415.506.7200
http://www.oracle.com/