2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now