lrey Posted August 30, 2010 Share Posted August 30, 2010 I've been stuck on this problem for a few days now. I have searched the forums for quite a while and tried many suggestions. My problem is that I'm trying to create a multi-page report per iteration through a custom datasource. For example: I have my JRTableModelDataSource containing students and their grades. I would like to have in my report, all students, two pages per student. So each iteration through the datasource would give one student, two pages.Now, the closest example I could find on the forums was here:http://www2.jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=12317This seems to be very similar to my issue but I was unable to understand it well enough to execute it myself.Also I tried a different way around it attempting to use larger bands found in the tips and tricks section. This way gave me the two pages I wanted but only returned 1 student and did not iterate through because it was not in the detail band.The majority of my time was spent attempting to use subreports. I saved the two pages as different reports and was able to get each one of them working seperately with the correct data and all of the students. When I added them as subreports I was never able to display either of them. Most likely because I was passing the data wrong, or I was getting confused about where I was in the datasource and it would iterate in the master and subreports. When I did attempt to pass the data to the subreports, I did make sure to change the type in the subreport expression. I was unsure if I needed to pass the built-in datasource parameter or to add the JRTableModelDataSource to my hashmap of parameters in my java code and create a parameter for it and pass it to my subreport.In the end, when dealing with the subreports I only see blank pages or it hangs when JasperFillManager.fillReport() is called. I realize there are many many posts about blank sub reports and have taken a look at some of them but it seems none of the cases are similar to mine.I apologize for such a poor explanation of my problem and will be glad to explain more. I have only been working in iReport for a few days now and am trying to understand it better.Thank you for your time and help Post Edited by lrey at 08/31/2010 15:59 Link to comment Share on other sites More sharing options...
lrey Posted August 31, 2010 Author Share Posted August 31, 2010 After some more work on this I created a master report and in the detail of it ,I put a subreport containing the 2 pages I want per student. In the subreport I put page1 in the title and page 2 in the summary and made it put the summary on a new page. With this I am able to get the 2 pages per student that I want, but the field data is only being displayed in the first one. Oh, and also I am passing the datasource as an object . So now I am needing the data to display for all of the students, not just the first one.It's possible, that maybe I need to rewind the datasource? If this is the case I believe I would need two datasources and from what I understand iReport doesnt work too well with multiple datasource iteration.Thanks again for your time and help!Post Edited by lrey at 08/31/2010 15:58 Link to comment Share on other sites More sharing options...
lasp Posted September 1, 2010 Share Posted September 1, 2010 I would also like to know a solution. Link to comment Share on other sites More sharing options...
lrey Posted September 1, 2010 Author Share Posted September 1, 2010 Because of time constraints, I am forced to complete this the only way I know how, and that is passing all of the items I need from the master report to the subreport through parameters. This is by no means elegant considering I have to pass around 500 parameters. I really really did not want to have to do this but I dont know any other way. Although, I would still like to know a solution as I am sure i will stumble across this issue in the future.Thank you. Link to comment Share on other sites More sharing options...
plastical Posted January 24, 2011 Share Posted January 24, 2011 I've faced exactly the same problem, please post the solution if some! Link to comment Share on other sites More sharing options...
plastical Posted January 26, 2011 Share Posted January 26, 2011 solved: http://stackoverflow.com/questions/4802453/multi-page-jasper-report 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