Jump to content

fill report using many JRBeanCollectionDataSource


nagaraju

Recommended Posts

Hi,

I would like to fill a .jasper fill with multiple JRBeanCollectionDataSource before exporting it into pdf. Report should have table and multiple charts. Each chart is from different Collection object. I managed to fill a report from one JRBeanCollectionDataSource. I am not able to fill multiple JRBeanCollectionDataSource into single .japser.

Can anybody please help regarding this?

Thanks in advance.

Regards,

Nagaraju Bandaru

 

 

Link to comment
Share on other sites

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

Top Posters In This Topic

Ideally a report can have single datasource - say Create an Object that has all the object arrays (your collection Objects) that you require for the report and pass this single object as bean data source and fill your report.

 

one more solution - Print all your bean collection DS separately and later stich it.

Link to comment
Share on other sites

Hi,

 

It depends on how you want the looping through your list of JRBeanCollectionDataSource instances to be performed.

You could make a FOR loop yourself in your application and produce multiple JasperPrint objects that then you export to the target format using what we call batch export. Just provide the list of JasperPrint objects to the exporter as the JASPER_PRINT_LIST parameter.

 

A different approach would be to wrap your list of JRBeanCollectionDataSource instances into yet another JRBeanCollectionDataSource.

With this master data source you fill a master report which in its detail band contains the normal report as subreport.

You then make sure that in your master report, you declare a field called _THIS, to point to the current bean data source coming from the master's data source and pass that to the subreport as <dataSourceExpression>.

 

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