Oracle® Application Server Reports Services Publishing Reports to the Web
10g Release 2 (10.1.2) B14048-02 |
|
Previous |
Next |
When you wish to define an advanced distribution for your report, you can design the distribution by developing a distribution XML file. In this file, you can specify the destination and format of output for each section of a report. In one distribution XML file, you can specify many different destinations, including custom (pluggable) destinations that you design (see Section 15.3.9, "destype").
Note: An example distribution XML file (distribution.xml ) is shipped with Oracle Reports in the ORACLE_HOME \samples\demo directory. You can reuse this file for your own purposes so that you do not have to create one from scratch.
|
This chapter provides information on creating a distribution XML file and some example use cases. It includes the following main sections:
Although distribution XML files are not required for specifying the distribution of report output, they are useful for complex distributions. For example, there may be times when you want to publish the output of one report in a variety of ways. You might want to send an executive summary of a report to senior management while mailing detailed breakdowns to individual managers. In this case, you might produce a single report with two report sections: a portrait-sized summary section and a landscape-sized detail section. You would associate the detail section with a data model group that lists the managers, then alter the destination on each instance of the group to send each department's output to its related manager.
The distribution XML file simplifies distribution complexity by enabling you to define multiple outputs for a given report in one XML file, then call that file from a command line or URL.
This section discusses the use of XML files related to distribution:
When you create a distribution XML file, you follow the syntax defined in the distribution.dtd
file located in the following directory on both Windows and UNIX:
ORACLE_HOME\reports\dtd
As you look through the following sections, it may be useful to you to print the distribution.dtd
file and refer to it as various elements and attributes are described.
Note: Information provided in the distribution XML file is case-sensitive. You must preserve case of various elements and attributes as specified in thedistribution.dtd file.
|
The distribution.dtd
file lists all elements that are valid within a distribution XML file. Each of these elements have attributes. Attributes that come with default values need not be specified, unless you wish to override the default.
You can create a dynamic distribution by introducing variable values into many different attributes. Variable values reference columns that are present in the report that is using the distribution XML file.
You can use variables within attributes by entering &column_name
or &<column_name>
in the place of a static value.
Note: The ampersand (&) and less-than symbol (<) have specific meanings in XML, but they are also required symbols for certain Oracle Reports command line options (for example, lexical parameters require the ampersand symbol). To avoid conflict with the XML meanings of these symbols when you set up variables, specify the encoded version of the ampersand (& ) and less-than and greater-than symbols (< and > ). For example:
Here is what the variable looks like improperly coded in an XML file: <mail id="a1" to="&<manager>@mycompany.com" … Here is what the variable looks like properly coded in an XML file: <mail id="a1" to="&<manager>@mycompany.com" …> There is no special requirement for the greater-than symbol (>) used with variables, but for consistency, we recommend that you use the encoded version ( |
The variable syntax you use depends on whether the value is expressed by itself or in combination with other values or strings. For example, a value for a to
attribute in a mail element might be expressed as either:
<mail id="a2" to="&email" …>
or
<mail id="a3" to="&<first_name>.&<last_name>@myco.com …>
In the first example (id="a2"
), the variable's referenced column (email
) contains a full e-mail address and does not require additional information. The second example (id="a3"
) uses a combination of variable values (first_name
and last_name
) and static text to construct an e-mail address (static text is the period after first_name
and @myco.com
). In both cases, you will get dynamic e-mail addressing. The example you use will depend on whether the variable contains all the information you need or requires additional information in order to be complete.
For more complex layouts, you can also reference report columns you created with PL/SQL formulas. For example, in your report you may define the PL/SQL column:
PL/SQL formula CF_MAILID: return(:first_name||'.'||:last_name)
You'd reference this column in the distribution XML file as:
to="&<CF_MAILID>@mycompany.com"
The elements of a distribution XML file include:
Most of these elements have attributes that define the behavior of the element. The following sections describe the distribution XML file elements and their associated attributes. Section 15.4, "Distribution XML File Examples" provides use cases that demonstrate the distribution XML file elements and attributes in typical scenarios.
Example
<destinations>
one or more distribution specifications
</destinations>
Required/Optional
Required. You must have no more or less than one destinations
element in your distribution XML file.
Description
The destinations
element opens and closes the content area of the distribution XML file. In terms of the distribution XML file's tagging hierarchy, all the other elements are subordinate to the destinations
element.
Example
<foreach> <mail id="a1" to="my_addressee@mycompany.com" subject="Fourth Quarter Results"> <attach format="pdf" name="dept_&<department_ID>.pdf' srcType="report" instance="this"> <include src="mainSection"/> </attach> </mail> </foreach>
or
<mail id="a4" to="recipient@mycompany.com" subject="Regional Results"> <foreach> <attach format="pdf" name="report.pdf" srcType="report" instance="all"> <include src="mainSection"/> </attach> </foreach> </mail>
Required/Optional
Optional. You can have as many foreach
elements as you require.
Description
Use the foreach
element to burst your distribution against a repeating group. You can use foreach
only when the associated report definition file (either RDF, JSP, or XML) has its Repeat On property for the section that will be burst set to an appropriate group. The foreach
element specifies that the distribution defined between its open and close tags should be performed for each repeating group.
The Repeat On property can be set for a report section (Header, Main, and Trailer) to associate a data model break group to a section. By setting the Repeat On property for a section, you can generate multiple instances of a section, or a repeating section.
When you implement bursting and distribution in a report, you can generate section-level distribution by setting the Repeat On property for a section to a data model break group, which generates an instance of the section for each column record of that break group. Then, you can distribute each instance of the section as appropriate (for example, to individual managers in the MANAGER
group).
If you set the Repeat On property for more than one of the Header, Main, and Trailer sections of a report, all Repeat On property values must be set to the same data model break group. If the Repeat On property for any one of the Header, Main, and Trailer sections is set to a different data model break group, Oracle Reports raises the following messages:
REP-177: Error while running in remote server REP-34320: Report sections used in destination '<destination id>' do not repeat on the same group
You can also use the foreach
element as a sub-element of the mail element, as depicted in the second example provided at the start of this section. (In this example, assuming that mainSection
repeats on G_DEPARTMENT_ID
, the example will produce a single attachment with all the instances of the report's mainSection in a single file.)
The foreach
element works closely with the instance
attribute of the attach and file elements. While foreach
specifies that the distribution should be performed according to record groups, instance
specifies whether the burst groups should be distributed in one file (instance="all"
) or distributed as separate files: one file for each group instance (instance="this"
).
When used with the mail
element, foreach
can mean different things according to its position relative to the mail
element:
When foreach
precedes the mail
element and instance="this"
, each group instance is dispatched as a separate mail. For example:
<foreach> <mail id="a1" to="managers@mycompany.com" subject="results"> <attach name="department_&<department_id>.pdf" instance="this"> <include src="mainSection" /> </attach> </mail> </foreach>
If the report is grouped according to department_id
, and there are four departments, then there are four group instances. This means four e-mails per recipient, each e-mail with its own group instance attached: one e-mail has department 10's report attached; another e-mail has department 20's report attached; and so on. Each recipient receives all four e-mails.
When foreach
follows the mail element and instance="this"
, each group instance is attached to one e-mail going to each recipient. For example:
<mail id="a1" to="managers@mycompany.com" subject="results"> <foreach> <attach name="department_&<department_id>.pdf" instance="this"> <include src="mainSection" /> </attach> </foreach> </mail>
Example
<mail id="a1" to="jsmith@foo.com" subject="Results"> <body srcType="text"> Attached are quarterly results. </body> <attach srcType="report"> <include src="headerSection"/> <include src="mainSection"/> </attach> </mail>
or
<mail id="a4" to="recipient@mycompany.com" subject="Regional Results"> <foreach> <attach format="pdf" name="report.pdf" srcType="report" instance="this"> <include src="mainSection"/> </attach> </foreach> </mail>
Required/Optional
Optional. You can have as many mail
elements as you require.
Description
Use the mail
element to specify distributions through an outgoing SMTP-based mail server. Use it to specify the recipients, the subject, and the priority of the e-mail.
Between an open and close tag of the mail
element, there can be only one body
sub-element and anywhere from zero to multiple attach
and foreach
sub-elements.
The mail
element also has a set of related attributes. These are expressed within the mail
tag. For example, the id
, to
, and subject
attributes are expressed:
<mail id="a1" to="jsmith@foo.com" subject="Recent Hires">
Table 15-1 lists and describes the attributes of the mail
element.
Table 15-1 Attributes of the mail Element
Attribute | Valid Values | Description |
---|---|---|
string |
Required. A keyword, unique within a given distribution XML file, that identifies a particular mail element. This can be a combination of a text string and one or more numbers, for example |
|
string |
Required. Variable values allowed. The recipient(s) of the e-mail. Contains the full, formal e-mail address, for example:
Multiple recipients must be separated with commas. Can also contain variable values that reference columns used in the associated report. See Section 15.2.2 for more information. |
|
string |
Optional. Variable values allowed. The recipient(s) to receive a copy of the e-mail. |
|
string |
Optional. Variable values allowed. The recipient(s) to receive a blind copy of the e-mail. |
|
string |
Optional. Variable values allowed. The sender of the e-mail. |
|
string |
Optional. Variable values allowed. The e-mail account where replies should be sent. |
|
string |
Default: Mail Sent from Optional. Variable values allowed. The subject of the e-mail. In the absence of a specified subject, the subject line will read: Mail Sent from [ |
|
|
Default: The e-mail's delivery priority. |
|
|
Default: Indication of whether the replyto individual or account should be notified when the e-mail is received. |
|
string |
Optional. Variable values allowed. The name of the organization distributing the e-mail, for example: organization="Region 10 Sales" Or organization="&department_name" |
Note: For the mail element to work properly, the Reports Server must know which outgoing SMTP mail server to send mail to. You specify this information in the Reports Server configuration file (server_name .conf ). This file has a pluginParam element where you can enter the name of a mail server. For example:
<pluginParam name=mailServer>smtp01.mycorp.com</pluginParam> For more information, see Chapter 3, "Configuring OracleAS Reports Services". |
Example
On Windows
<mail id="a1" to="jsmith@foo.com" subject="Results"> <body srcType="file"> <include src="c:\mail\body.html"/> </body> </mail>
On UNIX
<mail id="a1" to="jsmith@foo.com" subject="Results"> <body srcType="file"> <include src="/mail/body.html"/> </body> </mail>
Required/Optional
Optional. You can have a maximum of one body element associated with a given mail element.
Description
The body
element acts as a sub-element to the mail
element. It specifies the content (or body
) of the e-mail. With body
, you can type a text string between the open and close tags of the body
element or use an include sub-element to specify either an external file, a report, or a section of a report. For example:
<mail id="a1" to="jsmith@foo.com" subject="Results"> <body srcType="text"> Attached are quarterly results. </body> …
or
<mail id="a1" to="jsmith@foo.com" subject="Results"> <body srcType="file"> <include src="d:/reports/admin/results.html"/> </body> …
or
<mail id="a1" to="&<first_name>.&<last_name>@myco.com" subject="Quarterly Results"> <body srcType="report" format="html"> <include src="headerSection"/> </body> …
The body
element has three attributes: srcType
, format
, and instance
, described in Table 15-2.
Table 15-2 Attributes of the body Sub-Element of mail
Attribute | Valid Values | Description |
---|---|---|
|
Default: The source for content of an e-mail. The content is displayed in the body of the e-mail. In the absence of a specified |
|
|
Default: Required when |
|
|
Default: Used when the foreach element is also present. With a grouped report that is burst into separate reports, |
Example
<mail id="a1" to="jsmith@foo.com" subject="Results"> <body srcType="text">
Attached are quarterly results.
</body> <foreach>
<attach format="html" name="contacts.htm" srcType="report" instance="all">
<include src="headerSection"/> <include src="mainSection"/>
</attach>
</foreach>
</mail>
Required/Optional
Optional. You can have as many attach
elements as you require with a mail
element. Note that attach
is also a sub-element of foreach, and foreach
requires that at least one of its sub-elements be used (out of mail,file,printer,destype,
and attach
).
Description
The attach
element specifies attachments to the e-mail. Additionally, attach
must have at least one include sub-element, and can have more than one if srcType="report"
.
Table 15-3 lists and describes the attributes of the attach
element.
Table 15-3 Attributes of the attach Sub-Element of mail
Attribute | Valid Values | Description |
---|---|---|
|
Default: Required when |
|
|
Optional. Variable values allowed. The filename of the attached material. Can also contain variable values that reference columns used in the associated report. See Section 15.2.2 for more information. |
|
|
Default: The source of the attachment, either a file, a report, or text. |
|
|
Default: Used when the foreach element is also present. With a grouped report that is burst into separate reports, |
Using these attributes in conjunction with the foreach element, you can design a destination that will repeat on a group instance and generate an e-mail for each group attachment. For example:
<foreach>
<mail id="a2" to="first.name@myco.com,second.name@myco.com, third.name@myco.com, fourth.name@myco.com" subject="Department Summaries">
<body srcType="text">
Attached is the breakdown of department summaries for the last quarter.
</body> <attach format="htmlcss" name="deptsum.html" srcType="report" instance="this">
<include src="report"/>
</attach>
</mail>
</foreach>
By moving the location of the foreach
element, you can generate one e-mail with multiple attachments: a separate one for each group instance.
<mail id="a2" to="first.name@myco.com,second.name@myco.com, third.name@myco.com, fourth.name@myco.com" subject="Department Summaries">
<body srcType="text">
Attached is the breakdown of department summaries for the last quarter.
</body> <foreach>
<attach format="htmlcss" name="deptsum.html" srcType="report" instance="this">
<include src="report"/>
</attach>
</foreach>
</mail>
Example
<mail id="a1" to="jsmith@foo.com" subject="Q4">
<body srcType="text">
Attached are quarterly results.
</body> <attach srcType="report" format="pdf">
<include src="report"/>
</attach>
</mail>
or
<mail id="a1" to="jsmith@foo.com" subject="Q4">
<body srcType="text">
Attached are quarterly results.
</body> <attach srcType="report" format="htmlcss">
<include src="headerSection"/>
</attach>
</mail>
or
<mail id="a1" to="jsmith@foo.com" subject="Q4">
<body srcType="text">
Attached are quarterly results.
</body> <attach srcType="file">
<include src="d:/management/reports/current/Q4.htm"/>
</attach>
</mail>
Required/Optional
Required when used with body
and attach
when srcType
is report
or file
, but not when srcType
is text
. Also required for file
, printer
, and destype
. In the instances where it is required, you must have one and can have more than one include
.
Description
The include
element is available for use with the body, attach, file, printer, and destype elements. It specifies the file, report, or report section to be included in the body of an e-mail, as an attachment to an e-mail, in the content of a file, in the printer output, or in the content of a custom destination type.
If you want to specify more than one section, but not the entire report, enter an include
for each required section. For example:
<mail id="a1" to="jsmith@foo.com" subject="Results">
<body srcType="text">
Attached are quarterly results.
</body> <attach srcType="report" format="htmlcss">
<include src="headerSection"/> <include src="mainSection"/>
</attach>
</mail>
If the preceding body
or attach
element has srcType
of file
, the subsequent include
can specify the file either with a directory path and filename or with just the filename, provided the file is located in a directory listed in the REPORTS_PATH
environment variable. For example:
<mail id="a1" to="jsmith@foo.com">
<body srcType="file">
<include src="q4sales.pdf"/>
</body>
</mail>
If you do specify a path, use the appropriate standard for your platform. For example:
On Windows:
<include src="c:\management\reports\current\Q4.htm"/>
On UNIX:
<include src="/management/reports/current/Q4.htm"/>
No other XML elements are placed between an include
element's open and close tag.
Table 15-4 describes the src
attribute of the include
element.
Table 15-4 Attributes of the include Sub-Element When Used with body or attach
Attribute | Valid Values | Description |
---|---|---|
|
Required. The source of material specified in the preceding Because the distribution XML file is called when you run a specific report, there is no need to specify the report's name or location in the
Other values: When the preceding |
Example
On Windows
<file id="a7" name="c:\management\reports\report.pdf" format="pdf">
<include src="report"/>
</file>
On UNIX
<file id="a7" name="/management/reports/report.pdf" format="pdf">
<include src="report"/>
</file>
or
<foreach>
<file id="a7" name="section&<department_id>.pdf" format="pdf" instance="this">
<include src="mainSection"/>
</file>
</foreach>
Required/Optional
Optional. You can have as many file
elements as you require.
Description
Use the file
element to specify distributions to a file. The file
element has one sub-element: include. There must be at least one include
sub-element and there may be more between an open and close tag of the file
element.
When used with the foreach element and the instance="this"
attribute, the file
element can distribute each group instance of a grouped report to separate files. For example, if you group a report on department_id
, and there are four departments, you can use the foreach
/file
/instance="this"
combination to generate four files, each with a separate department's report. In this case, the file
entry in the distribution XML file might look like this:
<foreach>
<file id="a3" name="dept_&<department_id>.pdf" format="pdf" instance="this"> <include src="report"/>
</file>
</foreach>
In this example, all report sections (header, main, and trailer) must repeat on the same group instance (for example, department_id
).
Table 15-5 lists and describes the attributes of the file
element.
Table 15-5 Attributes of the file Element
Attribute | Valid Values | Description |
---|---|---|
string |
Required. A keyword, unique within a given distribution XML file, that identifies a particular file element. This can be a combination of a text string and one or more numbers, for example |
|
string |
Required. Variable values allowed. The location and filename of the destination file. Enter a directory path. Include the filename. For example: Windows: UNIX: Can also contain variable values that reference columns used in the associated report. See Section 15.2.2 for more information. |
|
|
Default: The destination file format, for example:
|
|
|
Default: Used when the foreach element is also present. With a grouped report that is burst into separate reports, |
Example
On Windows
<printer id="a1" name="\\server_name\printer_name" copies="5">
<include src="report"/>
</printer>
On UNIX
<printer id="a1" name="alias_to_registered_printer" copies="5" instance="all">
<include src="report"/>
</printer>
Required/Optional
Optional. You can have as many printer
elements as you require.
Description
Use the printer
element to specify distributions to a printer. The printer
element has one sub-element: include. There must be at least one include
sub-element and there may be more between the open and close tags of the printer
element.
When used with the foreach element and the instance="this"
attribute, the printer
element can distribute each group instance of a grouped report to a separate print job. For example, if you group a report on department_id
, and there are four departments, you can use the foreach
/printer
/instance="this"
combination to generate four printed reports, each containing a separate department's report. In this case, the printer
entry in the distribution XML file might look like this:
<foreach>
<printer id="a7" name="\\server_name\printer_name" instance="this">
<include src="report"/>
</printer>
</foreach>
In this example, all report sections (header, main, and trailer) must repeat on the same group instance (for example, department_id
).
Table 15-6 lists and describes the attributes of the printer
element.
Table 15-6 Attributes of the printer Element
Attribute | Valid Values | Description |
---|---|---|
string |
Required. A keyword, unique within a given distribution XML file, that identifies a particular file element. This can be a combination of a text string and one or more numbers, for example |
|
string |
Required. Variable values allowed. The destination printer. How you enter this information differs between Windows and UNIX. For Windows, specify the printer server name and the printer name. For example: name="\\server_name\printer_name" For UNIX, specify the alias assigned to a registered printer. For example: name="sales_printer" Can also contain variable values that reference columns used in the associated report. See Section 15.2.2 for more information. |
|
string |
Default: Number of copies of each report or each report group instance to print. |
|
|
Default: Used when the foreach element is also present. With a grouped report that is burst into separate reports, |
Example
<destype id="acustom1" name="fax">
<include src="headerSection"/> <property name="number" value="914925551212"/> </destype>
See Section 15.4, "Distribution XML File Examples" for examples of using the destype
element in a distribution.xml
file to specify distribution to the following destinations: OracleAS Portal, FTP, WebDAV, and fax.
Required/Optional
Optional. You can have as many destype
elements as you require.
Description
Use the destype
element to specify distribution to a custom destination, such as a fax machine or an FTP site. You also use destype
to specify distribution to a portal created with OracleAS Portal. The destype
element allows for the use of two sub-elements: property and include. At least one include
is required.
Note: The inclusion of a custom destination type requires that you have a defined distribution handler in place to usher report content to the custom output destination. Build a custom destination type through the OracleAS Reports Services Destinations API.For more information on the available APIs for Oracle Reports, refer to the Reports Software Development Kit (RSDK) on the Oracle Technology Network (OTN): on the Oracle Reports 10g page ( |
When used with the foreach element and the instance="this"
attribute, the destype
element can distribute each group instance of a grouped report to a separate destype
instance (for example, a separate fax). For example, if you group a report on department_id
, and there are four departments, you can generate four destype
instances, each containing a separate department's report. In this case, the destype
entry in the distribution XML file might look like this:
<foreach>
<destype id="a9" name="fax" instance="this">
<include src="report"/> <property name="number" value="&<fax_number>"/>
</destype>
</foreach>
In this example, all report sections (header, main, and trailer) must repeat on the same group instance (for example, fax_number
).
Custom destination types also have a set of related attributes. These are expressed within the destype
tag. For example, the id
, name
, and instance
attributes are expressed:
<foreach>
<destype id="a1" name="name_of_destination_type" instance="all">
<include src='report'/>
</destype>
</foreach>
Table 15-7 lists and describes the attributes of the destype
element.
Table 15-7 Attributes of the destype Element
Attribute | Valid Values | Description |
---|---|---|
string |
Required. A keyword, unique within a given distribution XML file, that identifies a particular file element. This can be a combination of a text string and one or more numbers, for example |
|
string |
Required. The name of the custom destination. For example, for a fax, this might be:
For a portal built with OracleAS Portal:
|
|
|
Default: Used when the foreach element is also present. With a grouped report that is burst into separate reports, For example, if you custom destination type is a fax, |
Example
<foreach>
<destype id="custom1" name="fax" instance="all">
<include src="headerSection"/> <property name="number" value="914925551212"/>
</destype>
</foreach>
Required/Optional
Optional. You can have as many properties as you require under a destype
element.
Description
The property
element allows for the inclusion of name/value pairs expressed in terms recognized by a custom destination type (destype). Properties are merely passed along to the destination handler. They serve no function within OracleAS Reports Services. How you specify properties is entirely dependent on the requirements of your custom destination.
This section provides examples, from simple to complex, of distribution XML elements. They are organized according to the main distribution.dtd
elements:
The examples in this section include:
In this example, each attachment contains the corresponding instance from the header, main, and trailer sections. That is, if the report is grouped on department_id
, and the first department is department 10
, the first attachment will be a report with header, main, and trailer sections all containing department 10 information. This example is valid only if the header, main, and trailer sections repeat on the same group instance, in this case department_id
.
<mail id="a1" to="managers@mycompany.com" subject="New Hires">
<foreach>
<attach format="html" srcType="report" instance="this">
<include src="report"/>
</attach>
</foreach>
</mail>
First of all, assume in this example that managers@mycompany.com
goes to a mailing list that distributes to each department manager. If there are four departments: 10, 20, 30, and 40, the first attachment will contain header, main, and trailer sections corresponding to department 10; the second to 20; and so on. This example will yield one e-mail per recipient, each with four attachments.
In this example, each recipient will receive a separate e-mail for each grouped report. For example, if the report is grouped on department_id
, and there are four departments, one recipient will receive four e-mails, each with a separate department's report attached.
<foreach>
<mail id="weeklies" to="managers@mycompany.com">
<attach format="htmlcss" srcType="report" instance="this">
<include src="mainSection"/>
</attach>
</mail>
</foreach>
In this example, different sections repeat on different groups. The distribution is set up so that each recipient will receive a separate e-mail with attachment for each grouped main section and for each grouped trailer section.
<foreach>
<mail id="a6" to="managers@mycompany.com" subject="Personnel Reports">
<attach format="pdf" name="attach.pdf" srcType="report" instance="this">
<include src="mainSection"/>
</attach> <attach format="rtf" name="attach.rtf" srcType="report" instance="this">
<include src="trailerSection"/>
</attach>
</mail>
</foreach>
In this example, a separate file is generated for each group instance. Groups repeat on department_id
. Each file is named with the relevant department ID.
<foreach>
<file id="a10" name="department_&<department_id>.pdf" instance="this">
<include src="mainSection"/>
</file>
</foreach>
Assuming that there are four departments, 10 through 40, this example will result in the creation of four files, named in turn department_10.pdf
, department_20.pdf
, and so on.
The format
attribute is not included in the file
element because it is not required when the srcType
is file
or text
. It is required when the srcType
is report
.
Note: If you do not specify unique filenames through the use of variable values (see Section 15.2.2), in this example, each successively created file will overwrite the previously created file. That is, the department.pdf file for department 20 will overwrite the department.pdf file for department 10, and so on, until there is only one file left, department.pdf, with information from the last department report created (for example, department 40). |
The way you specify a printer name differs between Windows and UNIX. The first example is for Windows. The second is for UNIX.
The examples in this section include:
The report will comprise the content of this e-mail. That is, when recipients open this e-mail, they will see the report.
<mail id="a5" to="managers@mycompany.com" subject="Quarterly Report">
<body srcType="report" format="html">
<include src="report"/>
</body>
</mail>
A section of a report will comprise the content of this e-mail. That is, when recipients open this e-mail, they will see a section of the report.
<mail id="a6" to="employees@mycompany.com">
<body srcType="report" format="html">
<include src="mainSection"/>
</body>
</mail>
The subject
attribute is not included in this mail
element, so the default subject will be used: Mail Sent From &Report
. At runtime, the variable &Report
will be replaced with the name of the report.
Two sections of a report will comprise the body of this e-mail. That is, when recipients open this e-mail, they'll see two sections, headerSection and mainSection, joined together in one report.
<mail id="emp_addresses" to="employees@mycompany.com" subject="Employee Address List">
<body srcType="report" format="html">
<include src="headerSection"/> <include src="mainSection"/>
</body>
</mail>
The contents of the body for this email will be an external file, and the report will go along as an attachment. The path to the file is expressed differently for Windows and UNIX.
In this example, recipients receive one e-mail with multiple attachments: one attachment for each group instance and an additional attachment that contains the entire report. If the report is grouped on department_id
and there are four departments, recipients will receive five attachments: one for each department and one whole report.
<mail id="grx90" to="sales@mycompany.com">
<body srcType="text"> Attached you will find the summary report and breakdown by department of weekly totals. </body> <attach format="rtf" name="myAttach.rtf" srcType="report">
<include src="report"/>
</attach> <foreach>
<attach format="pdf" name="myattach.pdf" srcType="report" instance="this">
<include src="mainSection"/>
</attach>
</foreach>
</mail>
In this example, the manager for department 10 gets department 10's report; the manager for department 20 gets department 20's report; and so on. For this tag set to be valid, the variable must refer to a column that is included in the "repeat on" group used with the attached section. That is, if the section repeats on G_department_id
, manager
must be a column in that group.
<foreach>
<mail id="mgr1090" to="&<manager>@mycompany.com">
<attach format="pdf" name="attach.pdf" srcType="report" instance="this">
<include src="mainSection"/>
</attach>
</mail>
</foreach>
Whenever you burst and distribute grouped reports to files, be sure to specify filenames with variable values based on the repeating group or some other variable information. Otherwise, you run the risk of having each successive file that is created overwrite the previously created file. For example, if you specify an output filename of department.pdf
, and you output separate instances of each department's report, the second department.pdf
file will overwrite the first department.pdf file; the third will overwrite the second; an so on. You will end up with only one report, that of the final department to be output. Instead, with grouped reports that you want to output separately according to each group instance, use variable values to specify filenames, for example: name="department_&<department_id>.pdf"
.
The examples in this section include:
This example will yield one file named report.pdf that contains the entire report.
This example will yield one file named sections.pdf that contains a report consisting of the header section and the main section of the report.
<file id="a2" name="sections.pdf" format="pdf">
<include src="headerSection"/> <include scr="mainSection"/>
</file>
In this example, a separate file will be created for each repeating group. Each file will contain a report that combines the relevant group main and trailer sections. The main and trailer sections must repeat on the same group, and the variable file name must refer to a column contained within the "repeat on" group. That is, if the report repeats on department_id
, and you have four departments, 10 through 40, then one file will contain the main and trailer sections of department 10; the next will contain the main and trailer sections of department 20; and so on. The variable value under name
must refer to a column that is within the G_department_id
group.
<foreach>
<file id="file9" name="department_&<department_id>.pdf" instance="this">
<include src="mainSection"/> <include src="trailerSection"/>
</file>
</foreach>
In this example, assuming the report is grouped on department_id
and there are four departments, 10 through 40, you will end up with four files respectively named: department_10.pdf
, department_20.pdf
, department_30.pdf
, and department_40.pdf
.
<foreach>
<file id="a20" name="department_&<department_id>.pdf" instance="this">
<include src="report"/>
</file>
</foreach>
The examples in this section include:
The way printer names are specified, differs between Windows and UNIX. Each example demonstrates both ways.
In this example, the entire report will be sent to the specified printer.
In this example, two sections of a report will be sent to the printer.
In this example, one report will be printed. The report will be grouped by, for example, department_id
. For this to work, all sections of the report must repeat on the same group.
This example will yield a number of print jobs: one for each group instance. The combined sections must repeat on the same group. If the report repeats on department_id
, and you have four departments, 10 through 40, you will end up with four print jobs: one for department 10; one for department 20; and so on. The main and trailer sections must both repeat on department_id
.
For this example to work, the repeat on
group must contain a column of printer names appropriate to the host platform (for example, the printer_name column must contain an appropriate printer alias on UNIX and a printer server/name combination on Windows). For example, if the report is grouped by department_id
, then G_department_id
must also have a printer_name
column. Assuming the printer_name
is tied to a department, then department 10's report would be printed on department 10's printer; department 20's report would be printed on department 20's printer; and so on.
<foreach>
<printer id="a60" name="&printer_name" instance="this">
<include src="mainSection"/>
</printer>
</foreach>
Each group instance equals a separate print job. Each print job goes to the relevant department's printer
You can use destype
to define a custom destination or pluggable destination that can be used by Oracle Reports during distribution. For more information, see Section 15.3.9, "destype". The examples in this section include the following destinations:
This example shows the generic tag structure for sending report output to the OracleAS Portal destination. When you push report output to OracleAS Portal using DESTYPE=ORACLEPORTAL
, the report output is created in the PAGEGROUP folder.
See Also: Appendix A, "Command Line Keywords" for more information on the properties shown in the examples. |
<destinations> <destype id="customforPortal" name="oraclePortal"> <property name="outputpage" value="sample_report"/> <property name="statuspage" value="Reports_Status"/> <property name="desformat" value="pdf"/> <property name="pagegroup" value="REPORTS_OUTPUT"/> <property name="itemtitle" value="MyReport"/> <include src="report"/> </destype> </destinations>
This example shows the generic tag structure for sending report output to the FTP destination.
<destinations> <foreach> <destype id="ftp1" name="ftp" instance="this" format="pdf"> <property name="desname" value="ftp://username:passwd@ftpServer/dir/myreport_&< DEPARTMENT_NAME>.pdf"/> <include src="mainSection"/> </destype> </foreach> </destinations>
This example shows the generic tag structure for sending report output to the WebDAV destination.
<destinations> <foreach> <destype id="webdav1" name="webdav" instance="this" format="pdf"> <property name="desname" value="http://user:passwd@WebDAVServer/dir/myreport_&< DEPARTMENT_NAME>.pdf"/> <include src="mainSection"/> </destype> </foreach> </destinations>
This example shows the generic tag structure for sending report output to the fax destination.
<destype id="faxdest" name="fax"> <property name="number" value="123456789"/> <include src="report"/> </destype>
Alternatively, for ease of use, you can specify a custom, more specific tag structure:
<fax id="faxdest" number="123456789"> <include src="report"/> </fax>
Note: All you need to do after you modify thedistribution.xsl file is save it back to the same location under the same file name. Oracle Reports will automatically look for this file when resolving distributions.
|
The method for using a distribution XML file at runtime is essentially the same whether you use it in a URL or a command line. Include the options:
destination=filename.xml distribute=yes
where filename
is the name of the distribution XML file. You are required to specify either the relative or absolute path of the XML file. For example, for Windows, you might specify:
destination=c:\%ORACLE_HOME%\reports\distribution\filename.xml distribute=yes
For UNIX, you might specify:
destination=$ORACLE_HOME/reports/distribution/filename.xml distribute=yes
For example, the full command in a URL would be similar to:
http://your_server:port/reports/rwservlet?report=rep.jsp&userid=db_credentials &destination=$ORACLE_HOME/reports/distribution/distribution.xml&distribute=yes
The paths in these examples are used for illustrative purposes only. There is no requirement for where you store your distribution XML files. You can store them wherever you like.
Note: In some cases, Microsoft Internet Explorer ignores the mimetype of a URL's return stream and instead sets the type by looking at the URL. This can be a problem when you are using the distribution feature of OracleAS Reports Services because your URL might end with thedestination parameter; for example:
In this scenario, your URL ends with the extension |
For detailed information on running reports from command lines and URLs and using the cgicmd.dat
file, see Chapter 13, "Running Report Requests".
This section outlines the limitations with using distribution in Oracle Reports:
Beginning with Oracle9i Reports Release 2 (9.0.2), Oracle Reports supports OracleAS Portal as a destination. By using DESTYPE=ORACLEPORTAL
, you can push a report to an output page specified in OracleAS Portal.
However, there are a few limitations in using this destination:
The ORACLEPORTAL
destination cannot be used with distribution. Instead, you can use DESTYPE=WEBDAV
for advanced XML-based distribution to OracleAS Portal.
Note: Ensure that the OracleAS Portal instance is WebDAV-enabled. Refer to the OracleAS Portal online Help for more information on how to enable WebDAV.For more information on how to use WebDAV for distribution to OracleAS Portal, refer to Note 241821.1 on Oracle MetaLink at |
The DESTYPE=ORACLEPORTAL
destination cannot be used with the rwrun
executable as it causes Reports Server to stop responding. Use this destination only with rwservlet
, rwclient
, or rwcgi
.
Using reference parameters for report bursting (that is, by specifying instance=this
) is not supported for XML output. If used, it results in the following error message:
REP-34310 "Reference parameter not allowed in distribution list for XML destination files"
You can use the XML format in distribution without the reference parameter.
Distribution and bursting are not supported in delimited output. You cannot specify a DELIMITED
or DELIMITED
DATA output format in a distribution.xml
file.
Distribution and bursting are not supported in spreadsheet output. You cannot specify a SPREADSHEET
output format in a distribution.xml
file. Thus, the current mode of generating paginated default output in a distribution module will not work for spreadsheet output.
XML distribution supports only static values for the format
attribute (as seen in distribution.dtd
). Thus, you cannot specify lexical parameters (to be resolved at runtime) for the format attribute. Hence the format cannot be dynamically determined either for the entire report or for a specific section.