Jump to content
Changes to the Jaspersoft community edition download ×

Multiple instance of a datasource


Recommended Posts



I've a report with 2 subreports. I want to use the same CVS datasource for all the reports. But when i did that, the 1rst subreport is ok but the 2nd has no data and the main report is cut. It seems that all the datasource has been read. Is it possible to have multiple instances of the same datasource?

If yes, how?


Thanks for your help.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic



You have to make sure that the two subreports use TWO different instances of a JRCsvDataSource class that wrap the SAME CSV file.

If you use the same instance, the first subreport "consumes" the data by moving the record pointer after the last record, from where the second subreport takes it.


I hope this helps.


Link to comment
Share on other sites

this is really not a replay for ur prb but myself also have the same issue. In my case also i want to multiple data source, i am using JRBeanCollectionDataSource.


(JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(reportDataList);


JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds); ) simply this code to set data source and fill the report with data sorce. Please help me, how to add another JRBeanCollectionDataSource object to this, or anyother way to add another data source.


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...