This is a common problem with ireport but no formal ansvwer yet but some workarounds do exist and I will show you one.
Here is the problem: I have a report with a numeric column(suppose its name is quantity) per row which I want to show summation of that column for all records in every page, the desired value will calculate from summation of quantity columns in current page and all previous pages(suppose its name is qSum). If i allow splitting for Detail band rows, there is no problem, but when I prevent splitting, the quantity column value of splitted row will add to calculated summation (qSum) of current page, but the row itself will shown in the next page!
In order words how can I force the summation to be only for the row appearing on that page. (excluding the transferred row)
My column summation is the column footer.
Workaround: the key thing to do here is to create a dummy group for each row based on their primary key.
How ?
Whenever a row spread over two consecutives pages ireport becomes confused. Instead of using split type= prevent as option in the detail band , set it to split type= Stretch. Then create a dummy group (by primary key of the row) with group header and footer enabled that will act as a container for each row . Dummy group option are: reprint header=true, Min Height to start new= value of detail band height, Footer Position= normal, Keep together= true.
Now if each is processed as group and will be forwarded to next page it cannot fit a the current one. This scenario is common with financial accounting report when you have credit , debit and has to calculate a running balance with carry forward and bring forward totals.
I will try on my next post to illustrate this solution with some screenshots, but for now I hope you have got some ideas at least. Feel free to comment or knock me.
Here is the problem: I have a report with a numeric column(suppose its name is quantity) per row which I want to show summation of that column for all records in every page, the desired value will calculate from summation of quantity columns in current page and all previous pages(suppose its name is qSum). If i allow splitting for Detail band rows, there is no problem, but when I prevent splitting, the quantity column value of splitted row will add to calculated summation (qSum) of current page, but the row itself will shown in the next page!
In order words how can I force the summation to be only for the row appearing on that page. (excluding the transferred row)
My column summation is the column footer.
Workaround: the key thing to do here is to create a dummy group for each row based on their primary key.
How ?
Whenever a row spread over two consecutives pages ireport becomes confused. Instead of using split type= prevent as option in the detail band , set it to split type= Stretch. Then create a dummy group (by primary key of the row) with group header and footer enabled that will act as a container for each row . Dummy group option are: reprint header=true, Min Height to start new= value of detail band height, Footer Position= normal, Keep together= true.
Now if each is processed as group and will be forwarded to next page it cannot fit a the current one. This scenario is common with financial accounting report when you have credit , debit and has to calculate a running balance with carry forward and bring forward totals.
I will try on my next post to illustrate this solution with some screenshots, but for now I hope you have got some ideas at least. Feel free to comment or knock me.
I have same problem, but your solution don't work to me :(
ReplyDeletePlease see my ask in your post in StackOverlfow:
http://stackoverflow.com/a/19835315/2258970
Thanks.
Excellent!, thank you
ReplyDelete