JimmyP Posted June 19, 2007 Share Posted June 19, 2007 Hi,thank you in advance for your time. I have to create an excel report that has a one to many relationship. For example if I have an array of beans and each bean represents the data for one row then jasper reports knows to iterate through the array and map each field in the report to each field in the bean. My problem is I have an Array of Arrays. Where each row is represented by one bean plus if one of the beans fields is an Array(String[]) how can get jasper to print those values out ? Link to comment Share on other sites More sharing options...
lucianc Posted June 19, 2007 Share Posted June 19, 2007 If you want all String values printed in the same text field, you could write a Java method (or use org.apache.commons.lang.StringUtils) to concatenate the values into a single String value. Otherwise, you would need to use a subreport for the second level arrays. For this, you would also need to somehow wrap the String array into a JasperReports data source (you can either write a simple data source implementation or convert the String array into a bean/map array/collection so that you would leverage existing data source implementations). Regards,Lucian Link to comment Share on other sites More sharing options...
JimmyP Posted June 20, 2007 Author Share Posted June 20, 2007 Thank you Lucianc for your reply. After some thought I decide to just change the data structure and make it all one to one (an array of one String only, no sub arrays, completely flat). The result sets that I'm working with can be quite large (1000 records and each sub record containing as man as 10 records, 1000x10= Large). So creating a datasource for each sub array I thought would be very expensive. Thank you again for your help, maybe in a future release someone will consider implementing type of structure. Jimmy 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