Skip Headers
Oracle® Fusion Middleware Publishing Reports to the Web with Oracle Reports Services
11g Release 1 (11.1.1)

Part Number B32121-06
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

20.5 Distribution XML File Examples

This section provides examples, from simple to complex, of distribution XML elements. They are organized according to the main distribution.dtd elements:

20.5.1 foreach Examples

The examples in this section include:

20.5.1.1 Single E-Mail with Report Groups as Separate Attachments

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.

20.5.1.2 Separate E-Mail for Each Group Instance

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>

20.5.1.3 Separate E-Mails with Separate Sections as Attachments

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>

20.5.1.4 Separate File for Each Section

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_&amp;&lt;department_id&gt;.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 20.3.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).

Oracle Reports 11g Release 1 (11.1.1) supports PDF encryption in distribution and bursting of Reports. With this feature, you can secure your Reports output through PDF Security in the following way.

<foreach>
  <file id="a10" name="department_&amp;&lt;department_id&gt;.pdf" instance="this">
    <property name="pdfuser" value="&amp;&lt;department_id&gt;"/>
     <include src="mainSection"/>
  </file>
</foreach>

To open the generated PDF output, you must provide the password as departmentid.

20.5.1.5 Separate Print Run for Each Report

The way you specify a printer name differs between Windows and UNIX. The first example is for Windows. The second is for UNIX.

20.5.1.5.1 Windows

In this example, assuming that the report is grouped on department_id, a report will be printed for each department.

<foreach>
  <printer id="a7" name="\\server_name\printer_name" instance="this">
    <include src="report"/>
  </printer>
</foreach>

20.5.1.5.2 UNIX

In this example, assuming that the report is grouped on department_id, a report will be printed for each department.

<foreach>
  <printer id="a7" name="printer_alias" instance="this">
    <include src="report"/>
  </printer>
</foreach>

20.5.2 mail Examples

The examples in this section include:

20.5.2.1 E-Mail with a Whole Report as the Body

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>

20.5.2.2 E-Mail with a Section of a Report as the Body

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 &amp;Report. At runtime, the variable &amp;Report will be replaced with the name of the report.

20.5.2.3 E-Mail with Two Report Sections as the Body

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>

20.5.2.4 E-Mail with External File as Body and Report as Attachment

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.

20.5.2.4.1 Windows

<mail id="XQRSN" to="accounting@mycompany.com" subject="Salaries">
 <body srcType="file">
  <include src="c:\mail\body.html"/>
 </body>
 <attach format="pdf" name="salaries.pdf" srcType="report">
  <include src="report"/>
 </attach>
</mail>

20.5.2.4.2 UNIX

<mail id="XQRSN" to="accounting@mycompany.com" subject="Salaries">
 <body srcType="file">
  <include src="/mail/body.html"/>
 </body>
  <attach format="pdf" name="salaries.pdf" srcType="report">
   <include src="report"/>
 </attach>
</mail>

20.5.2.5 E-Mail with Whole Report and Grouped Sections Attached

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>

20.5.2.6 E-Mail to Relevant Manager and Department

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="&amp;&lt;manager&gt;@mycompany.com">
  <attach format="pdf" name="attach.pdf" srcType="report" instance="this">
    <include src="mainSection"/>
   </attach>
  </mail>
</foreach>

Oracle Reports 11g Release 1 (11.1.1) supports PDF encryption in distribution and bursting of reports. With this feature, you can secure Reports output through PDF Security in the following way:

<foreach>
 <mail id="mgr1090" to="&amp;&lt;manager&gt;@mycompany.com">
   <property name="pdfuser" value="&amp;&lt;manager&gt;" />
  <attach format="pdf" name="attach.pdf" srcType="report" instance="this">
   <include src="mainSection"/>
  </attach>
 </mail>
</foreach

20.5.3 file Examples

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, and so on. You will end up with only one report, that of the final department. 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_&amp;&lt;department_id&gt;.pdf".

The examples in this section include:

20.5.3.1 File for Whole Report

This example will yield one file named report.pdf that contains the entire report.

20.5.3.1.1 Windows

<file id="a1" name="c:\reports\report.pdf" format="pdf">
  <include src="report"/>
</file>

20.5.3.1.2 UNIX

<file id="a1" name="/reports/report.pdf" format="pdf">
  <include src="report"/>
</file>

20.5.3.2 File for Combined Report Sections

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>

20.5.3.3 File for Each Group of Combined Sections

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_&amp;&lt;department_id&gt;.pdf" instance="this">
  <include src="mainSection"/>
  <include src="trailerSection"/>
 </file>
</foreach>

20.5.3.4 File for Each Report Group Instance

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_&amp;&lt;department_id&gt;.pdf" instance="this">
  <include src="report"/>
 </file>
</foreach>

20.5.4 printer Examples

The examples in this section include:

The way printer names are specified, differs between Windows and UNIX. Each example demonstrates both ways.

20.5.4.1 Print Whole Report

In this example, the entire report will be sent to the specified printer.

20.5.4.1.1 Windows

<printer id="a80" name="\\neptune\prtr20">
  <include src="report"/>
</printer>

20.5.4.1.2 UNIX

<printer id="a80" name="10th_floor_printer">
  <include src="report"/>
</printer>

20.5.4.2 Print Two Sections of a Report

In this example, two sections of a report will be sent to the printer.

20.5.4.2.1 Windows

<printer id="a1" name="\\neptune\prtr20">
  <include src="headerSection"/>
  <include src="mainSection"/>
</printer>

20.5.4.2.2 UNIX

<printer id="a1" name="10th_floor_printer">
  <include src="headerSection"/>
  <include src="mainSection"/>
</printer>

20.5.4.3 Print Grouped Report

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.

20.5.4.3.1 Windows

<foreach>
 <printer id="prt20" name="\\neptune\prtr20" instance="all">
  <include src="report"/>
 </printer>
</foreach>

20.5.4.3.2 UNIX

<foreach>
<printer id="prt20" name="10th_floor_printer" instance="all">
<include src="report"/>
</printer>
</foreach>

20.5.4.4 Print Combined Sections for Each Group Instance

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.

20.5.4.4.1 Windows

<foreach>
 <printer id="prt20" name="\\neptune\prtr20" instance="this">
  <include src="mainSection"/>
  <include src="trailerSection"/>
 </printer>
</foreach>

20.5.4.4.2 UNIX

<foreach>
 <printer id="prt20" name="10th_floor_printer" instance="this">
   <include src="mainSection"/>
   <include src="trailerSection"/>
 </printer>
</foreach>

20.5.4.5 Print Relevant Instance of a Report to Its Relevant Printer

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="&amp;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

20.5.5 destype Examples

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 20.4.9, "destype". The examples in this section include the following destinations:

20.5.5.1 Oracle Portal Destination

This example shows the generic tag structure for sending report output to the Oracle Portal destination. When you push report output to Oracle 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="pagegroup" value="REPORTS_OUTPUT"/> 
    <property name="itemtitle" value="MyReport"/> 
    <include src="report"/> 
  </destype> 
</destinations>

20.5.5.2 FTP Destination

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_&amp;&lt;
    DEPARTMENT_NAME&gt;.pdf"/>
                    <include src="mainSection"/>
  </destype>
 </foreach>
</destinations>

20.5.5.3 WebDAV Destination

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_&amp;&lt;
    DEPARTMENT_NAME&gt;.pdf"/>
    <include src="mainSection"/>
  </destype>
 </foreach>
</destinations>

20.5.5.4 Fax Destination

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 must do after you modify the distribution.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.