|
Re: Reports Run Multiple Times [message #547378 is a reply to message #547208] |
Fri, 16 July 2010 13:55 |
|
Select the data source/data set in the outline view and then select the
advanced tab in the properties view. There is a property called New
handler on each event. Verify that it is set to false.
Jason
On 7/15/2010 7:07 PM, Brian wrote:
> I am using a scripted data source. Now every time that a report is run,
> it calls the scripted data source multiple times. In most cases 5 times,
> but some reports it happens 7 times. I am not sure why this is
> happening, I have it is a feeling that it has to do with the way the
> .rtpdesign files are setup. I would really like to fix this, the reports
> will run a lot faster. Some of the reports take like 20 minutes to run.
>
> The Reports were made in 2.3.0, I am upgraded to 2.6 in hopes might fix
> the issue, however, this was not the case. Any help would welcomed very
> much.
>
>
> Thanks
|
|
|
Re: Reports Run Multiple Times [message #547379 is a reply to message #547378] |
Fri, 16 July 2010 14:08 |
Brian Messages: 8 Registered: May 2010 Location: Madison |
Junior Member |
|
|
Thanks for the help. It is set to false for both the data set and data source.
A co-worker thinks that it might have something to do with the data cube that are are using in most of the reports. I checked, New handler on each event is also false for the data cube. I am not sure if this information helps.
[Updated on: Fri, 16 July 2010 14:15] Report message to a moderator
|
|
|
|
Re: Reports Run Multiple Times [message #547845 is a reply to message #547412] |
Mon, 19 July 2010 18:36 |
|
Could you not cache the data in a hash in the Java code?
On 7/16/2010 12:46 PM, Brian wrote:
> OK I tracked the problem down. Not sure how to fix it. We are using a
> crosstab. The Data source is scripted. The script goes to java code,
> that hits the db and enriches the data. It then returns a vector of
> string[ ] to Birt. The data cube for the crosstab it seems the more
> groups I have in the data cube the more the we going back to the script
> and run the same java code again. The number of times this happens
> depends on the number of groups we have in the data cube for the
> crosstab. This is not to say that we are just putting everything in the
> cube, just an empirical observation. I would like to make it so that we
> are going to the db and enriching data just once.
>
> Thanks in advance.
|
|
|
|
|
|
Re: Reports Run Multiple Times [message #1016294 is a reply to message #1016037] |
Tue, 05 March 2013 21:32 |
Michael Tuzhilov Messages: 2 Registered: March 2013 |
Junior Member |
|
|
I got around this problem by using Java Objects as Event Handlers. Basically, instead of using script, use a Java Class by extending the ScriptedDataSetEventAdapter. Make sure to specify this class name in the Data Set -> property editor -> Event Handler. In this class you can override methods beforeOpen, open, and fetch. This is very similarly as you would do in the script. The trick is to read data in the beforeOpen method. The open method simply resets the currentrow variable to 0. This way Birt framework only calls the database one time per the report instance no matter how many times you access the dataset.
@Override
public void beforeOpen(IDataSetInstance dataSet,
IReportContext reportContext) throws ScriptException {
super.beforeOpen(dataSet, reportContext);
data = dataset.readData()
totalrows = data.size();
}
@Override
public void open(IDataSetInstance dataSet) throws ScriptException {
super.open(dataSet);
currentrow = 0;
}
@Override
public boolean fetch(IDataSetInstance dataSet, IUpdatableDataSetRow row)
throws ScriptException {
if (currentrow >= totalrows) {
return false;
}
Object[] datarow = data.get(currentrow);
row.setColumnValue("Date", datarow[0]);
row.setColumnValue("Type", datarow[1]);
row.setColumnValue("Volume", datarow[2]);
currentrow++;
return true;
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03422 seconds