svetok Posted May 26, 2009 Share Posted May 26, 2009 Hello,I have many rows from the datasource in detail band, and I need to show the summary after all of them.BUT, if on the last page there is not enough space for summary, I need the last (or several last) row to be moved to the next page and summary will be showed after them.So, I just don't want to have last page containing only summary.How can I do this?Thanks in advance!Svetlana Post Edited by svetok at 05/26/2009 13:59 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted May 26, 2009 Share Posted May 26, 2009 Hi, You could achieve this easily only if you would know in advance how many rows are there in the report.If you could supply the number of detail rows as a parameter to the report.Otherwise, the report does not know how many records are in the data source until it loops through all of them (reach the end of the report). By that time it is too late as the engine will not go back and move things around. The rendering is done. So, if you know the number of records in advance, a break could be triggered at the desired moment. Thanks,Teodor Link to comment Share on other sites More sharing options...
svetok Posted May 28, 2009 Author Share Posted May 28, 2009 Teodor, thanks much for your reply.I CAN pass the number of rows as parameter. But how exactly I can organize all these? It seems like I should: insert page break just at the end of detail band Regarding that row height and summary height are some fixed values and I want to see together with summary at least 2 rows, in "print when expression" of page break I should write smth like :( ROWS_TOTAL - ROW_COUNT ==2) && ([pixels till the end of page] > = ROW_HEIGHT * 2) && ([pixels till the end of page] <= ROW_HEIGHT * 2 + SUMMARY_HEIGHT ) How can I get to know that [pixels till the end of page] ?Or may be I should use some other criteria?Thanks,SvetlanaPost Edited by svetok at 05/28/2009 08:04 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted May 28, 2009 Share Posted May 28, 2009 Hi, If you know the number of rows, that is good news. Let's say they are N, and that you pass this value as a report parameter called MAX_ROW. Let's also say that you want at least 3 rows to accompany the summary, so that it does not print alone on the last page.You create a report group with empty header and footer sections (height zero). Use the minHeightToStartNewPage property of this group to make sure the group will trigger a page break, if on the current page there is not enough space for 3 detail rows to fit and also the summary.minHeightToStartNewPage >= 3 x detail.height + summary.height Use this expression for the group:<groupExpression>$V{REPORT_COUNT}.intValue() < $P{MAX_ROWS}.intValue - 3 ? null : $V{REPORT_COUNT}</groupExpression> By using this expression you make sure the group does not break before reaching the last 3 rows. And when they are reached, it breaks with every of those 3 remaining rows. The first break would occur just before the first of the last 3 rows and will trigger a page break, if there is not enough space on the current page for all 3 remaining rows and the summary to fit. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
svetok Posted May 28, 2009 Author Share Posted May 28, 2009 Hi, Teodor!Thanks a lot! It works!Svetlana 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