Report parameters problem.... [message #248818] |
Thu, 19 July 2007 06:55  |
Eclipse User |
|
|
|
Originally posted by: wkrugiolka.poczta.onet.pl
Hi!!
My problem is that i want to set some parameters before render task - not
befor run task.
When i set some parameters before run
task.setParameterValue("dummy", "dupa");
it works fine.
But is it possible to set parameters after run and before render ?
I'd like to run report just once and render it a lot of time......
My piece of code:
IReportRunnable design = null;
design = this.reportEngine.openReportDesign(this.reportEngineHome +
"Reports/" + pReportName + ".rptdesign");
IRunTask task = this.reportEngine.createRunTask(design);
String reportDocName = this.reportEngineHome + "Reports/" + pReportName +
".rptdocument";
task.setParameterValue("dummy", "dupa"); // IT WORSK FINE
task.run(reportDocName);
IReportDocument reportDocument =
this.reportEngine.openReportDocument(reportDocName);
IRenderOption options = new RenderOption();
options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);
options.setOutputStream(pOutputStream);
IRenderTask renderTask =
this.reportEngine.createRenderTask(reportDocument);
renderTask.setRenderOption(options);
renderTask.setParameterValue("dummy", "dupa"); // IT DOESNT WORK :-(
renderTask.setAppContext(params);
renderTask.render();
renderTask.close();
--
Pozdro, Wojtas
http://www.e-krug.com/
|
|
|
Re: Report parameters problem.... [message #248933 is a reply to message #248818] |
Thu, 19 July 2007 12:18  |
Eclipse User |
|
|
|
news.onet.pl,
I think the best bet would be to save the parameter values off as global
values. The following code should save the value of a parameter named aParam
to a global variable named gParam. The second line of code retrieves the
gParam value for use later in the report.
Why am I using the .value you might ask? Parameters are accessed as scriptable
objects. Since I assume you want to work with the value of the parameter
and not the parameter object, I just save off the value.
reportContext.setPersistentGlobalVariable("gParam", params["aParam"].value)
reportContext.getGlobalVariable("gParam")
Hope this helps,
Scott Rosenbaum
> Hi!!
>
> My problem is that i want to set some parameters before render task -
> not
> befor run task.
> When i set some parameters before run
> task.setParameterValue("dummy", "dupa");
> it works fine.
> But is it possible to set parameters after run and before render ? I'd
> like to run report just once and render it a lot of time......
>
> My piece of code:
>
> IReportRunnable design = null;
> design = this.reportEngine.openReportDesign(this.reportEngineHome +
> "Reports/" + pReportName + ".rptdesign");
> IRunTask task = this.reportEngine.createRunTask(design);
> String reportDocName = this.reportEngineHome + "Reports/" +
> pReportName +
> ".rptdocument";
> task.setParameterValue("dummy", "dupa"); // IT WORSK FINE
> task.run(reportDocName);
> IReportDocument reportDocument =
> this.reportEngine.openReportDocument(reportDocName);
>
> IRenderOption options = new RenderOption();
> options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);
> options.setOutputStream(pOutputStream);
> IRenderTask renderTask =
> this.reportEngine.createRenderTask(reportDocument);
>
> renderTask.setRenderOption(options);
>
> renderTask.setParameterValue("dummy", "dupa"); // IT DOESNT WORK
> :-(
> renderTask.setAppContext(params);
> renderTask.render();
>
> renderTask.close();
>
|
|
|
Powered by
FUDForum. Page generated in 0.03484 seconds