Oracle® Fusion Middleware Publishing Reports to the Web with Oracle Reports Services 11g Release 1 (11.1.1) B32121-01 |
|
![]() Previous |
![]() Next |
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 19.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). |
The way you specify a printer name differs between Windows and UNIX. The first example is for Windows. The second is for 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="\\server_name\printer_name" instance="this"> <include src="report"/> </printer> </foreach>
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.
<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>
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, 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_&<department_id>.pdf"
.
The examples in this section include:
This example will yield one file named report.pdf
that contains the entire report.
<file id="a1" name="c:\reports\report.pdf" format="pdf"> <include src="report"/> </file>
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.
<printer id="a1" name="\\neptune\prtr20"> <include src="headerSection"/> <include src="mainSection"/> </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.
<foreach> <printer id="prt20" name="\\neptune\prtr20" instance="all"> <include src="report"/> </printer> </foreach>
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
.
<foreach> <printer id="prt20" name="\\neptune\prtr20" instance="this"> <include src="mainSection"/> <include src="trailerSection"/> </printer> </foreach>
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 19.4.9, "destype". The examples in this section include the following destinations:
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>
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. |