Home » Archived » BIRT » Argument passing to ScriptedDataSetEventHandler
|
Re: Argument passing to ScriptedDataSetEventHandler [message #481878 is a reply to message #481780] |
Mon, 24 August 2009 15:42 |
|
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 |
Eclipse User |
|
|
|
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 |
|
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 |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Thu Mar 28 21:00:33 GMT 2024
Powered by FUDForum. Page generated in 0.02364 seconds
|