Jump to content
Changes to the Jaspersoft community edition download ×

Some rows get duplicated while generating report.


ville

Recommended Posts

Hi,

 

My problem is, that when I am generating report with Jasper, some rows are duplicating. For Jasper/Spring framework, I pass a collection of beans (each containing information for one row in the

report to be generated) and when the report is ready, there is more rows in the report than elements in the

collection just passed for the Jasper/Spring framework. By viewing the generated report I noticed that the reason for the increased amount of rows was that some information was duplicated.

 

If I removed something from the collection passed to Jasper, duplicates were still generated but

now completely different rows were duplicated and I couldn't see that there was any link between the content of the row and duplication occuring. I also tried collections with many different sizes but always some duplicates were generated. For example collection of size 77 generated 1 duplicate and size of 2000 generated about 100 duplicates. One interesting thing I noticed was that, when I replaced information of all the rows (collection's bean fields) under two of my report's columns with some static text, duplicates didn't appear. I also tested different types of report formats like CSV, PDF and HTML...and duplicates were always generated.

 

 

So, my questions are, why these duplicates appear and what I can do to prevent them appearing?

 

Here is some kind of description about the sw-architecture where this phenomenon is occuring:

 

I have Spring/Jasper implementation.

 

I am extending ParametrizableViewController in one class

-in handleRequestInternal-method I construct the model and create and return the ModelAndView-class.

 

-the model contains the collection returned by another class.

 

-the view of the ModelAndView is defined in XML based view-resolver as below:

 

<bean id="iacCsvReportView" class="org.springframework.web.servlet.view.jasperreports.JasperReportsCsvView">

<property name="reportDataKey" value="reportData"/>

<property name="url" value="/WEB-INF/jrxml/i_a_c_csv.jrxml"/>

<property name="exporterParameters">

<map>

<entry key="net.sf.jasperreports.engine.export.JRCsvExporterParameter.FIELD_DELIMITER" value=";"/>

</map>

</property>

</bean>

 

If I check the size of the collection in the ModelAndView-object just before returning it in the

handleRequestInternal-method It has the right amount of rows. After that everything is done automatically

by the already existing Spring and Jasper implementations, the CSV report gets ready and it contains some duplicates.

 

If you have some kind of knowledge about this kind of problem, please guide me. If I'm not giving enough information about my situation just ask me and I will tell more.

 

If this is not the right/best possible forum to ask this kind of question let me know.

 

Thanks for your interest.

 

-Ville

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

I don't think the duplication could be related to JasperReports.

It is the first time I hear about such a problem and our bean collection data source implementation was published years ago.

You could try put aside JasperReports for a moment and check your collection of beans by iterating through it.

What implementing class it behind your bean collection?

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...