Reports Run Multiple Times [message #547208] |
Thu, 15 July 2010 19:07  |
Eclipse User |
|
|
|
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 #1016025 is a reply to message #1015692] |
Mon, 04 March 2013 11:06   |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
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 #1016294 is a reply to message #1016037] |
Tue, 05 March 2013 16:32   |
Eclipse User |
|
|
|
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;
}
|
|
|
Re: Reports Run Multiple Times [message #1837359 is a reply to message #547208] |
Thu, 28 January 2021 07:47  |
Eclipse User |
|
|
|
I got a workaround where I am following below steps:
1. Create a table from data set(dragging it in layout and set visibility hide if require).
2. on 'onFetch' method of data set, copy the values and put into arrayList
3. Now prepare a scripted data set from this arrayList
4. Create a data cube from this scripted Data set
5. Create crosstab from this data cube.
|
|
|
Powered by
FUDForum. Page generated in 0.08241 seconds