Oracle XML Publisher implementation for PeopleSoft has a little known feature which is passing custom parameters to the RTF template. This could be well appreciated if we consider the following:
I have a rowset based RTF template. The rowset is populated using some PeopleCode based upon certain run control parameters. Now since my rowset does not contain the run control record, then how is it possible to print the run control parameter in my RTF template?
The simplest and the most flexible (**my opinion**) is passing run control parameters as custom parameter to the XML Publisher Report and to retrieve and use those in your RTF template.
The ReportDefn class contain a method "SetRuntimeProperties" which accept two parameters: one is the array of parameter names and other is an array of parameter values.
You must call this method before the "ProcessReport" method of the ReportDefn class.
Lets assume I want to pass BUSINESS_UNIT and PROJECT_ID as custom parameters to the report (possibly derived from a run control record). The sample code is:
(the imports and fully classified class names have been omitted. You have to use fully qualified classnames).
Local ReportDefn &ReportDefn;
&ReportDefn = Create ReportDefn("MYREPORT");
&ReportDefn.Get();
Local Array of String &ParamNames, &ParamValues;
Local String &BU,&Project_id;
&BU=RUNREC.BUSINESS_UNIT.Value;
&Project_id=RUNREC.PROJECT_ID.Value;
&ParamNames = createarray("xslt.BUSINESS_UNIT","xslt.PROJECT_ID");
&ParamValues = createarray(&BU,&Project_id);
&ReportDefn.SetRuntimeDataRowset(&SomeRowset);
&ReportDefn.SetRuntimeProperties(&ParamNames, &ParamValues);
&ReportDefn.ProcessReport.......
(code below processreport not shown..its your code dude!).
Now in your RTF template do the following:
1. Declare the custom parameters: Insert a form field and write the following in the "help text".
<?param@begin:BUSINESS_UNIT?><?param@begin:PROJECT_ID?>
2. To use the parameter (probably for printing): Insert a form field and write the following in the help text:
<?$BUSINESS_UNIT?>
or
<?$PROJECT_ID?>
Thus in order to retrieve the values of the "defined" parameter we use a "$" before the parameter name.
This method makes it quite easy to pass anything from PeopleCode to the RTF template without actually getting into the trouble to modifying the rowsets or the records.

I have a rowset based RTF template. The rowset is populated using some PeopleCode based upon certain run control parameters. Now since my rowset does not contain the run control record, then how is it possible to print the run control parameter in my RTF template?
The simplest and the most flexible (**my opinion**) is passing run control parameters as custom parameter to the XML Publisher Report and to retrieve and use those in your RTF template.
The ReportDefn class contain a method "SetRuntimeProperties" which accept two parameters: one is the array of parameter names and other is an array of parameter values.
You must call this method before the "ProcessReport" method of the ReportDefn class.
Lets assume I want to pass BUSINESS_UNIT and PROJECT_ID as custom parameters to the report (possibly derived from a run control record). The sample code is:
(the imports and fully classified class names have been omitted. You have to use fully qualified classnames).
Local ReportDefn &ReportDefn;
&ReportDefn = Create ReportDefn("MYREPORT");
&ReportDefn.Get();
Local Array of String &ParamNames, &ParamValues;
Local String &BU,&Project_id;
&BU=RUNREC.BUSINESS_UNIT.Value;
&Project_id=RUNREC.PROJECT_ID.Value;
&ParamNames = createarray("xslt.BUSINESS_UNIT","xslt.PROJECT_ID");
&ParamValues = createarray(&BU,&Project_id);
&ReportDefn.SetRuntimeDataRowset(&SomeRowset);
&ReportDefn.SetRuntimeProperties(&ParamNames, &ParamValues);
&ReportDefn.ProcessReport.......
(code below processreport not shown..its your code dude!).
Now in your RTF template do the following:
1. Declare the custom parameters: Insert a form field and write the following in the "help text".
<?param@begin:BUSINESS_UNIT?><?param@begin:PROJECT_ID?>
2. To use the parameter (probably for printing): Insert a form field and write the following in the help text:
<?$BUSINESS_UNIT?>
or
<?$PROJECT_ID?>
Thus in order to retrieve the values of the "defined" parameter we use a "$" before the parameter name.
This method makes it quite easy to pass anything from PeopleCode to the RTF template without actually getting into the trouble to modifying the rowsets or the records.

No comments:
Post a Comment