Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Argument passing to ScriptedDataSetEventHandler
Argument passing to ScriptedDataSetEventHandler [message #481780] Mon, 24 August 2009 09:51 Go to next message
Jacques is currently offline JacquesFriend
Messages: 4
Registered: July 2009
Junior Member
Hello,

I have a method that gathers data for the report, and then runs the
report, which uses a scripted data source. The scripted data sets then
retrieve the data that is to be put into the report over a singelton
class that provides the report data.

Currently this method has to be synchronized, because when it is called
a second time while the first call is still reading the report data, it
may happen that the report data that is read by the first caller is
overwritten by the second caller.

So my question is: Is there a way to pass some kind of argument to a
DataSetEventAdapter, such that it knows which report data to use and to
avoid race conditions?

Thanks!

Jacques Stadler
Re: Argument passing to ScriptedDataSetEventHandler [message #481878 is a reply to message #481780] Mon, 24 August 2009 15:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Jacques,

Are you using the Report Engine API to run the report? If so you can
get your data and put it in the application context object, which your
scripted dataset can then access.

IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName("output/resample/test.html");
options.setOutputFormat("html");
task.setRenderOption(options);
task.getAppContext().put("mydataobject", mdo);
The scripted ds would then be able to access the mdo object like:
mydataobject.size(); //assuming mdo is a HashMap



Jason



Jacques wrote:
> Hello,
>
> I have a method that gathers data for the report, and then runs the
> report, which uses a scripted data source. The scripted data sets then
> retrieve the data that is to be put into the report over a singelton
> class that provides the report data.
>
> Currently this method has to be synchronized, because when it is called
> a second time while the first call is still reading the report data, it
> may happen that the report data that is read by the first caller is
> overwritten by the second caller.
>
> So my question is: Is there a way to pass some kind of argument to a
> DataSetEventAdapter, such that it knows which report data to use and to
> avoid race conditions?
>
> Thanks!
>
> Jacques Stadler
Re: Argument passing to ScriptedDataSetEventHandler [message #481896 is a reply to message #481878] Mon, 24 August 2009 16:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jst.ivyteam.ch

Well, sounds good, but does not work yet.
The thing is that I use a Java DataSet, not javascript.
Any idea how I can access the Application Context there?
Thanks!
Jacques

Jason Weathersby schrieb:
> Jacques,
>
> Are you using the Report Engine API to run the report? If so you can
> get your data and put it in the application context object, which your
> scripted dataset can then access.
>
> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
> HTMLRenderOption options = new HTMLRenderOption();
> options.setOutputFileName("output/resample/test.html");
> options.setOutputFormat("html");
> task.setRenderOption(options);
> task.getAppContext().put("mydataobject", mdo);
> The scripted ds would then be able to access the mdo object like:
> mydataobject.size(); //assuming mdo is a HashMap
>
>
>
> Jason
>
>
>
> Jacques wrote:
>> Hello,
>>
>> I have a method that gathers data for the report, and then runs the
>> report, which uses a scripted data source. The scripted data sets then
>> retrieve the data that is to be put into the report over a singelton
>> class that provides the report data.
>>
>> Currently this method has to be synchronized, because when it is
>> called a second time while the first call is still reading the report
>> data, it may happen that the report data that is read by the first
>> caller is overwritten by the second caller.
>>
>> So my question is: Is there a way to pass some kind of argument to a
>> DataSetEventAdapter, such that it knows which report data to use and
>> to avoid race conditions?
>>
>> Thanks!
>>
>> Jacques Stadler
Re: Argument passing to ScriptedDataSetEventHandler [message #481929 is a reply to message #481896] Mon, 24 August 2009 18:13 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You should be able to get it like:

reportContext.getAppContext().get(Object)

The beforeOpen is passed the reportContext object.

Jason

Jacques Stadler wrote:
> Well, sounds good, but does not work yet.
> The thing is that I use a Java DataSet, not javascript.
> Any idea how I can access the Application Context there?
> Thanks!
> Jacques
>
> Jason Weathersby schrieb:
>> Jacques,
>>
>> Are you using the Report Engine API to run the report? If so you can
>> get your data and put it in the application context object, which your
>> scripted dataset can then access.
>>
>> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
>> HTMLRenderOption options = new HTMLRenderOption();
>> options.setOutputFileName("output/resample/test.html");
>> options.setOutputFormat("html");
>> task.setRenderOption(options);
>> task.getAppContext().put("mydataobject", mdo);
>> The scripted ds would then be able to access the mdo object like:
>> mydataobject.size(); //assuming mdo is a HashMap
>>
>>
>>
>> Jason
>>
>>
>>
>> Jacques wrote:
>>> Hello,
>>>
>>> I have a method that gathers data for the report, and then runs the
>>> report, which uses a scripted data source. The scripted data sets
>>> then retrieve the data that is to be put into the report over a
>>> singelton class that provides the report data.
>>>
>>> Currently this method has to be synchronized, because when it is
>>> called a second time while the first call is still reading the report
>>> data, it may happen that the report data that is read by the first
>>> caller is overwritten by the second caller.
>>>
>>> So my question is: Is there a way to pass some kind of argument to a
>>> DataSetEventAdapter, such that it knows which report data to use and
>>> to avoid race conditions?
>>>
>>> Thanks!
>>>
>>> Jacques Stadler
Re: Argument passing to ScriptedDataSetEventHandler [message #482037 is a reply to message #481929] Tue, 25 August 2009 08:04 Go to previous message
Eclipse UserFriend
Originally posted by: jst.ivyteam.ch

This works perfectly!
Thank you very much!

Jacques

Jason Weathersby schrieb:
> You should be able to get it like:
>
> reportContext.getAppContext().get(Object)
>
> The beforeOpen is passed the reportContext object.
>
> Jason
>
> Jacques Stadler wrote:
>> Well, sounds good, but does not work yet.
>> The thing is that I use a Java DataSet, not javascript.
>> Any idea how I can access the Application Context there?
>> Thanks!
>> Jacques
>>
>> Jason Weathersby schrieb:
>>> Jacques,
>>>
>>> Are you using the Report Engine API to run the report? If so you can
>>> get your data and put it in the application context object, which
>>> your scripted dataset can then access.
>>>
>>> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
>>> HTMLRenderOption options = new HTMLRenderOption();
>>> options.setOutputFileName("output/resample/test.html");
>>> options.setOutputFormat("html");
>>> task.setRenderOption(options);
>>> task.getAppContext().put("mydataobject", mdo);
>>> The scripted ds would then be able to access the mdo object like:
>>> mydataobject.size(); //assuming mdo is a HashMap
>>>
>>>
>>>
>>> Jason
>>>
>>>
>>>
>>> Jacques wrote:
>>>> Hello,
>>>>
>>>> I have a method that gathers data for the report, and then runs the
>>>> report, which uses a scripted data source. The scripted data sets
>>>> then retrieve the data that is to be put into the report over a
>>>> singelton class that provides the report data.
>>>>
>>>> Currently this method has to be synchronized, because when it is
>>>> called a second time while the first call is still reading the
>>>> report data, it may happen that the report data that is read by the
>>>> first caller is overwritten by the second caller.
>>>>
>>>> So my question is: Is there a way to pass some kind of argument to a
>>>> DataSetEventAdapter, such that it knows which report data to use and
>>>> to avoid race conditions?
>>>>
>>>> Thanks!
>>>>
>>>> Jacques Stadler
Previous Topic:pie chart from single row with multiple columns containing numbers
Next Topic:The cols width been fixed when export the report to a "xls" type
Goto Forum:
  


Current Time: Thu Mar 28 21:00:33 GMT 2024

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

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

Back to the top