Skip to main content



      Home
Home » Archived » BIRT » Report parameters problem....
Report parameters problem.... [message #248818] Thu, 19 July 2007 06:55 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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();
>
Previous Topic:Problem with the ppt emitter - with sample report
Next Topic:Custom ODA data source, want different behavior during preview vs. actual usage?
Goto Forum:
  


Current Time: Tue Jul 22 11:12:16 EDT 2025

Powered by FUDForum. Page generated in 0.03484 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top