Creating Cross-Product Matrix Groups

Customizing Reports with XML 22-15 If you were using Reports Runtime, then the equivalent command line would be: rwrun REPORT=emp.rdf CUSTOMIZE=D:\CORP\MYREPOORTS\EMP0.XML,D:\CORP\MYREPORTS\EMP1.XML USERID=usernamepasswordmy_db DESTYPE=file DESNAME=emp.pdf DESFORMAT=PDF

22.4.1.3 Applying an XML Report Definition in PLSQL

To apply an XML report definition to an RDF file in PLSQL, use the SRW.APPLY_ DEFINITION and SRW.ADD_DEFINITION built-in procedures in the Before Parameter Form or After Parameter Form trigger. The following sections provide examples of these built-in procedures.

22.4.1.3.1 Applying an XML Definition Stored in a File To apply XML that is stored in the

file system to a report, use the SRW.APPLY_DEFINITION built-in procedure in the Before Parameter Form or After Parameter Form triggers of the report. On Windows: SRW.APPLY_DEFINITION ORACLE_HOME\TOOLS\DOC\US\RBBR\COND.XML; On UNIX: SRW.APPLY_DEFINITION ORACLE_HOMETOOLSDOCUSRBBRCOND.XML; When the report is run, the trigger executes and the specified XML file is applied to the report.

22.4.1.3.2 Applying an XML Definition Stored in Memory To create an XML report definition

in memory, you must add the definition to the document buffer using SRW.ADD_ DEFINITION before applying it using the SRW.APPLY_DEFINITION built-in procedure. The following example illustrates how to build up and apply several definitions in memory based upon parameter values entered by the user. The PLSQL in this example is used in the After Parameter Form trigger of a report called videosales_ custom.rdf. The videosales_custom.rdf file contains PLSQL in its After Parameter Form trigger that does the following: ■ Conditionally highlights fields based upon parameter values entered by the user at runtime. ■ Changes number format masks based upon parameter values entered by the user at runtime. Note: In this example, the CUSTOMIZE value demonstrates a directory path to files stored on a Windows platform. For UNIX, use that platforms standard for specifying directory paths that is, forward slashes instead of backward. Note: For a description of the SRW built-in package, including the SRW.APPLY_DEFINITION and SRW.ADD_DEFINITION built-in procedures, and more information about report triggers, see the Oracle Reports online Help. 22-16 Publishing Reports to the Web with Oracle Reports Services The following tips are useful when looking at this example: ■ Each time you use the SRW.APPLY_DEFINITION built-in procedure, the document buffer is flushed and you must begin building a new XML report definition with SRW.ADD_DEFINITION. ■ Notice the use of the parameters hilite_profits, hilite_costs, hilite_ sales, and money_format to determine what to include in the XML report definition. The hilite_profits, hilite_costs, and hilite_sales parameters are also used in the formatting exceptions to determine which values to highlight. ■ Because of the upper limit on the size of VARCHAR2 columns 4000 bytes, you might need to spread very large XML report definitions across several columns. If so, then you might have to create several definitions in memory and apply them separately rather than creating one large definition and applying it once. function AfterPForm return boolean is begin SRW.ADD_DEFINITIONreport name=vidsales_masks author=Generated DTDVersion=9.0.2.0.0; IF :MONEY_FORMAT=NNNN.00 THEN SRW.ADD_DEFINITIONlayout; SRW.ADD_DEFINITIONsection name=main; SRW.ADD_DEFINITIONfield name=F_TOTAL_PROFIT source=TOTAL_PROFIT formatMask=LNNNNNNNNNNN0D00; SRW.ADD_DEFINITIONfield name=F_TOTAL_SALES source=TOTAL_SALES formatMask=LNNNNNNNNNNN0D00; SRW.ADD_DEFINITIONfield name=F_TOTAL_COST source=TOTAL_COST formatMask=LNNNNNNNNNNN0D00; SRW.ADD_DEFINITIONfield name=F_SumTOTAL_PROFITPerCITY source=SumTOTAL_PROFITPerCITY formatMask=LNNNNNNNNNNN0D00; SRW.ADD_DEFINITIONfield name=F_SumTOTAL_SALESPerCITY source=SumTOTAL_SALESPerCITY formatMask=LNNNNNNNNNNN0D00; SRW.ADD_DEFINITIONfield name=F_SumTOTAL_COSTPerCITY source=SumTOTAL_COSTPerCITY formatMask=LNNNNNNNNNNN0D00; SRW.ADD_DEFINITIONsection; SRW.ADD_DEFINITIONlayout; ELSIF :MONEY_FORMAT=NNNN THEN SRW.ADD_DEFINITIONlayout; SRW.ADD_DEFINITIONsection name=main; SRW.ADD_DEFINITIONfield name=F_TOTAL_PROFIT source=TOTAL_PROFIT formatMask=LNNNNNNNNNNN0; SRW.ADD_DEFINITIONfield name=F_TOTAL_SALES source=TOTAL_SALES formatMask=LNNNNNNNNNNN0; SRW.ADD_DEFINITIONfield name=F_TOTAL_COST source=TOTAL_COST formatMask=LNNNNNNNNNNN0; SRW.ADD_DEFINITIONfield name=F_SumTOTAL_PROFITPerCITY source=SumTOTAL_PROFITPerCITY formatMask=LNNNNNNNNNNN0; SRW.ADD_DEFINITIONfield name=F_SumTOTAL_SALESPerCITY source=SumTOTAL_SALESPerCITY formatMask=LNNNNNNNNNNN0; SRW.ADD_DEFINITIONfield name=F_SumTOTAL_COSTPerCITY source=SumTOTAL_COSTPerCITY formatMask=LNNNNNNNNNNN0; SRW.ADD_DEFINITIONsection; SRW.ADD_DEFINITIONlayout; END IF; SRW.ADD_DEFINITIONreport; SRW.APPLY_DEFINITION; SRW.ADD_DEFINITIONreport name=vidsales_hilite_costs author=Generated DTDVersion=9.0.2.0.0; IF :HILITE_COSTS None THEN