Skip to Content
0
Former Member
May 21, 2010 at 04:35 AM

Modify parameter before PDF export

18 Views

Dear all,

I have 2 issues in exporting PDF in RAS 12.1.0.882/ CR 2008 [designer]

1) I want to get the Total No of pages before exporing a report to PDF

2) I want to use this number to be displayed on top like page 1 of N format

The reason I am not using TotalPageCount is performance issue. For only certain customers, we want to enable this on PDF export.

[Note if I use TotalPageCount in a conditional manner, still report goes for an extra pass]

To avoid this and enable page total based on demand, I created a parameter 'totalpages' [hidden param] in that report

For 1) Still I have to figure out getLastPage() or so to find the total pages.

For 2) I modified the parameter and set it back in Viewer, it does nt work.

Please help to programatically set parameter to be reflected in PDF export

// Setting Parameter Snippet

if (paramName.equals("pagetotal")) {

ParameterField newPf = (ParameterField) srcField.clone(true);

Values pvls = new Values();

ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();

String val = "11"; //Dummy value as Total Page

pfdv.setValue(val);

pfdv.setDescription("pagetotal");

pvls.add(pfdv);

newPf.setCurrentValues(pvls);

newPf.setReportName(srcField.getReportName())

}

// Viewer Snippet

ReportExportControl expViewer = new ReportExportControl();

expViewer.setReportSource( csb.getRcd().getReportSource());

if (csb.getNewFields() != null) //if there are parameters

{

expViewer.setParameterFields(csb.getNewFields());

//expViewer.setEnableParameterPrompt(false); - tried not working

//expViewer.setReuseParameterValuesOnRefresh(true); - tried not working

//expViewer.refresh(); - tried not working

expViewer.setOwnPage(false);

}

ExportOptions expOpt = new ExportOptions();

expOpt.setExportFormatType(expFormat); // In this case PDF

expViewer.setExportOptions(expOpt);

expViewer.setExportAsAttachment(true);

expViewer.processHttpRequest(request,response,servletContext,null);

Thanks,

Sumathi