Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Reports Run Multiple Times(Every time you run a report it gots the DB 5 times or more.)
Reports Run Multiple Times [message #547208] Thu, 15 July 2010 19:07 Go to next message
Brian is currently offline Brian
Messages: 8
Registered: May 2010
Location: Madison
Junior Member
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 #547378 is a reply to message #547208] Fri, 16 July 2010 09:55 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

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


Jason Weathersby

BIRT Exchange
Re: Reports Run Multiple Times [message #547379 is a reply to message #547378] Fri, 16 July 2010 10:08 Go to previous messageGo to next message
Brian is currently offline 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 10:15]

Report message to a moderator

Re: Reports Run Multiple Times [message #547412 is a reply to message #547208] Fri, 16 July 2010 12:46 Go to previous messageGo to next message
Brian is currently offline Brian
Messages: 8
Registered: May 2010
Location: Madison
Junior Member
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 #547845 is a reply to message #547412] Mon, 19 July 2010 14:36 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

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.


Jason Weathersby

BIRT Exchange
Re: Reports Run Multiple Times [message #1015692 is a reply to message #547845] Fri, 01 March 2013 13:55 Go to previous messageGo to next message
Michael Tuzhilov is currently offline Michael Tuzhilov
Messages: 2
Registered: March 2013
Junior Member
I have this exact problem. I am using a Cross Tab with a scripted data source that goes to Java as well which then goes to DB to retrieve the data. The Cross Tab is causing the Java code to execute multiple times. I don't think that caching data in Java is the correct solution. Birt Framework should be smart enough to not call the scripted data source multiple times for each grouping in the Cross Tab. Has anyone solved this problem?
Re: Reports Run Multiple Times [message #1016025 is a reply to message #1015692] Mon, 04 March 2013 11:06 Go to previous messageGo to next message
Jakob Altenstein is currently offline Jakob Altenstein
Messages: 19
Registered: February 2013
Junior Member
I don't have a solution but I have the same problem. It seems to me that it is not only valid for scripted datasets but also for normal SQL data sources. I did some simple logging in a dataset's beforeOpen() method and discovered that the beforeOpen() method is called five times, although I only produce one chart from the data (the dataset feeds a joint dataset, the joint dataset feeds a cube, and the cube feeds the chart). It may be due to the different layers feeding each other, but nevertheless, normally one should think that if I have one dataset, this dataset should only be queried once and everything else should be done inside BIRT!
Re: Reports Run Multiple Times [message #1016037 is a reply to message #1016025] Mon, 04 March 2013 11:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Jakob

Can you post the design where you logged the beforeOpen?

Jason


Jason Weathersby

BIRT Exchange
Re: Reports Run Multiple Times [message #1016294 is a reply to message #1016037] Tue, 05 March 2013 16:32 Go to previous message
Michael Tuzhilov is currently offline 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;
}
Previous Topic:Integrating birt perspective into new rcp-application
Next Topic:Update BIRT 4.2.1 to BIRT 4.2.2 / Eclipse Juno: Conflicting dependency
Goto Forum:
  


Current Time: Fri Apr 18 06:41:58 EDT 2014

Powered by FUDForum. Page generated in 0.03422 seconds