Jump to content
Changes to the Jaspersoft community edition download ×

SubReport and Map data source


Recommended Posts

By: Tony Piselli - tpiselli

SubReport and Map data source

2006-05-18 11:24

Hi folks,

I'd like to know if its possible to use a datasource that's declared as:

Map<String, Set<PojoBean>> data = new HashMap<String, Set<PojoBean>>();

 

And, more importantly, is it possible to have the same subreport repeated for each key in the map?

For example, if I have a map where the key is a department name and the value is a set of person beans I'd like to have the sub report repeated for each department.

Finally, each subreport would have to have a page break between them.

Thanks,

Tony

 

 

 

 

By: Lucian Chirita - lucianc

RE: SubReport and Map data source

2006-05-24 23:07

Hi

 

You need to write a simple JRDataSource implementation that iterates on a map and provides the key and value as report fields.

 

Then, you can use the built-in JRBeanCollectionDataSource for the bean set as datasource for the subreport (you can have the same subreport repeated for each entry in the map).

 

To have a page break between each subreport, you can create a dummy group with isStartNewPage set.

 

HTH,

Lucian

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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