Distribution Overview Oracle Fusion Middleware Online Documentation Library

Creating Advanced Distributions 20-5 Description The destinations element opens and closes the content area of the distribution XML file. In terms of the distribution XML files tagging hierarchy, all the other elements are subordinate to the destinations element.

20.4.2 foreach

Example foreach mail id=a1 to=my_addresseemycompany.com subject=Fourth Quarter Results attach format=pdf name=dept_amp;lt;department_IDgt;.pdf srcType=report instance=this include src=mainSection attach mail foreach or mail id=a4 to=recipientmycompany.com subject=Regional Results foreach attach format=pdf name=report.pdf srcType=report instance=all include src=mainSection attach foreach mail RequiredOptional 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 20-6 Publishing Reports to the Web with Oracle Reports Services 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 reports 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=managersmycompany.com subject=results attach name=department_amp;lt;department_idgt;.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 10s report attached; another e-mail has department 20s 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=managersmycompany.com subject=results foreach attach name=department_amp;lt;department_idgt;.pdf instance=this include src=mainSection attach foreach mail

20.4.3 mail

Example mail id=a1 to=jsmithfoo.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=recipientmycompany.com subject=Regional Results foreach attach format=pdf name=report.pdf srcType=report instance=this