Monday, 9 March 2015

RTF Techniques - Get your report parameters in the XML output

Here in this post, I am telling you how to get the report parameters in XML output.

Should the report parameters of an RDF report be available in the XML output ?

The short but rather mean answer would be 'Yes- they should'. In fact they really should be but they are not available in Oracle Report XML output.

The report parameters will not be available in the XML output unless you are passing the parameter value to a formula column/placeholder col. You can however display the parameter values in the template after you run the concurrent request in the apps and put the below code in your template...

Enter <?param@begin:P_START_DATE?> into a Text Form Field at the top of the RTF and then create another Text Form Field to display <?$P_START_DATE?>.

Update the template in the Apps and then run the concurrent request for the report.

That will display the parameter P_START_DATE.

<?param@begin:PARAMTER_NAME?> where parameter name refers to the internal name on the concurrent  program form

to reference the value in the template either to display it or perform calculations on it use
<?$PARAMETER_NAME?> - note the '$' sign.

At runtime the concurrent  manager will pass these values to the template. Remember they will not magically appear on the template you must create the reference to them (param@begin) and then use them in the template explicitly.

You need to be on 11.5.10.2 or higher to get this functionality, the publisher level does not matter.

Sample codes
<?param@begin:P_WEEK_ENDING_DATE_FROM?>             -- Initialize the parameter - token name
<?xdofx:(substr($P_WEEK_ENDING_DATE_FROM,9,2)||'-'||
  decode(substr($P_WEEK_ENDING_DATE_FROM,6,2),'01','JAN','02','FEB','03','MAR','04','APR','05','MAY',
                                              '06','JUN','07','JUL','08','AUG','09','SEP','10','OCT',
                                              '11','NOV','12','DEC')||'-'||
         substr($P_WEEK_ENDING_DATE_FROM,1,4))
?>                                                   -- To format the date parameter in RTF.


Hint: you got to have the data in xml as this format:
YYYY-MM-DDThh:mm:ss+HH:MM or YYYY-MM-DD to format those fields.


For any suggestion or issues with the above code, please leave your comments. I will try to reply back as soon as possible. 

1 comment:

  1. Thanks for this.Would it be possible to call the parameter multiple times in the same RTF template ?
    for example, i am using the begin param syntax in the title of the report but i also want to show all the parameters selected separately in the report. in that case can i use the same sytax twice ?

    ReplyDelete