Required XML Tags Creating XML Customizations

22-8 Publishing Reports to the Web with Oracle Reports Services data dataSource name=Q_summary selectselect portid ports, locname locations from portdescselect dataSource data layout section name=header tabular name=M_summary template=BLAFbeige.tdf labelAttribute font=Arial fontSize=10 fontStyle=bold textColor=white field name=F_ports source=ports label=Port IDs font=Arial fontSize=10 field name=F_locations source=locations label=Port Names font=Arial fontSize=10 tabular section layout report This example XML can be run by itself because it has both a data model and a complete layout. Use aliases in your SELECT statements to ensure the uniqueness of your column names. If you do not use an alias, then the default name of the report column is used and could be something different from the name you expect for example, portid1 instead of portid. This becomes important when you must specify the source attribute of the field tag, which requires you to supply the correct name of the source column the field. The labelAttribute element defines the formatting for the field labels in the layout. Because it lies outside of the open and close field tag, it applies to all the labels in the tabular layout. If you wanted it to pertain to only one of the fields, then you place it inside the fieldfield tag pair. If there is both a global and local labelAttribute element one outside and one inside the fieldfield tag pair, the local overrides the global.

22.2.7 Encoding the URL

To ensure that spaces and control characters are passed correctly, you may need to turn URL encoding on or off for the fields in your report. You can turn URL encoding on or off with the RW:FIELD tag in a report: rw:field ... urlEncode=yes|no ... The default value for urlEncode is no.

22.3 Creating XML Data Models

Oracle Reports Services introduces a greater level of sophistication in the types of data models you can create using Oracle Reports XML tags. Use XML for: ■ Creating Multiple Data Sources ■ Linking Between Data Sources ■ Creating Group Hierarchies Within Each Data Source Customizing Reports with XML 22-9 ■ Creating Cross-Product Matrix Groups ■ Creating Formulas, Summaries, and Placeholders at Any Level ■ Creating Parameters This section provides examples of these uses of XML. In addition to these data model types, Oracle Reports Services provides support for using PLSQL in your XML. This includes support for local program units, report-level triggers, and attached PLSQL libraries.

22.3.1 Creating Multiple Data Sources

The data tag now supports the creation of multiple data sources as well as the new pluggable data sources. Each data source is enclosed within its own dataSource tag. The data type definition for the dataSource element is: ELEMENT dataSource select|plugin|plsql, comment?, displayInfo?, formula, group ATTLIST dataSource name CDATA IMPLIED defaultGroupName CDATA IMPLIED maximumRowsToFetch CDATA IMPLIED The following example creates two SQL data sources and names them Q_1 and Q_2. It also creates all the necessary columns for the data sources and the default group—giving the group the specified defaultGroupName or defaulting its own name if defaultGroupName is not specified. report name=anyname DTDVersion=9.0.2.0.0 data dataSource name=Q_1 defaultGroupName=G_DEPARTMENTS select select from departments select dataSource dataSource name=Q_2 defaultGroupName=G_EMPLOYEES select select from employees select dataSource data report

22.3.2 Linking Between Data Sources

In the presence of multiple data sources, it may be desirable to link the data sources together to create the appropriate data model. Oracle Reports data model link objects have also been exposed through Oracle Reports XML. They support both group- and column-level links. You can specify any number of links to create the required data model. The data type definition for the link element is: ELEMENT link EMPTY ATTLIST link name CDATA IMPLIED