Creating Parameters Creating XML Data Models

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 Customizing Reports with XML 22-17 SRW.ADD_DEFINITIONlayout; SRW.ADD_DEFINITIONsection name=main; SRW.ADD_DEFINITIONfield name=F_TOTAL_COST source=TOTAL_COST; SRW.ADD_DEFINITIONexception textColor=red; SRW.ADD_DEFINITIONcondition source=TOTAL_COST operator=gt operand1=:hilite_costs; SRW.ADD_DEFINITIONexception; SRW.ADD_DEFINITIONfield; SRW.ADD_DEFINITIONsection; SRW.ADD_DEFINITIONlayout; END IF; SRW.ADD_DEFINITIONreport; SRW.APPLY_DEFINITION; SRW.ADD_DEFINITIONreport name=vidsales_hilite_sales author=Generated DTDVersion=9.0.2.0.0; IF :HILITE_SALES None THEN SRW.ADD_DEFINITIONlayout; SRW.ADD_DEFINITIONsection name=main; SRW.ADD_DEFINITIONfield name=F_TOTAL_SALES source=TOTAL_SALES; SRW.ADD_DEFINITIONexception textColor=red; SRW.ADD_DEFINITIONcondition source=TOTAL_SALES operator=gt operand1=:hilite_sales; SRW.ADD_DEFINITIONexception; SRW.ADD_DEFINITIONfield; SRW.ADD_DEFINITIONsection; SRW.ADD_DEFINITIONlayout; END IF; SRW.ADD_DEFINITIONreport; SRW.APPLY_DEFINITION; SRW.ADD_DEFINITIONreport name=vidsales_hilite_profits author=Generated DTDVersion=9.0.2.0.0; IF :HILITE_PROFITS None THEN SRW.ADD_DEFINITIONlayout; SRW.ADD_DEFINITIONsection name=main; SRW.ADD_DEFINITIONfield name=F_TOTAL_PROFIT source=TOTAL_PROFIT; SRW.ADD_DEFINITIONexception textColor=red; SRW.ADD_DEFINITIONcondition source=TOTAL_PROFIT operator=gt operand1=:hilite_profits; SRW.ADD_DEFINITIONexception; SRW.ADD_DEFINITIONfield; SRW.ADD_DEFINITIONsection; SRW.ADD_DEFINITIONlayout; END IF; SRW.ADD_DEFINITIONreport; SRW.APPLY_DEFINITION; return TRUE; end;

22.4.2 Running an XML Report Definition by Itself

To run an XML report definition by itself, you send a request with an XML file specified in the REPORT or MODULE option. The following command line sends a job request to Oracle Reports Services to run a report, emp.xml, by itself: rwclient USERID=usernamepasswordmy_db REPORT=c:\corp\myreports\emp.xml DESTYPE=file desname=emp.pdf DESFORMAT=pdf SERVER=server_name