Jump to content
Changes to the Jaspersoft community edition download ×

Calculate Sum in table column per page

Go to solution Solved by C-Box,

Recommended Posts

Hi there,

I try to do sum in table column per page.Everything is working, but when the one of column have large content, the calculation goes wrong. 







** the total amount for page 11 should be 219,000. But currently it appear 363,000 (plus 144,000) from the next page.  

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution

I guess your detail for the last record is actual started at page 11 and now the enginge recognized that your description is probably StretchWithOverflow=true and that's why the whole content won't fit into the remaining space at page11... so a page-break will be done and the whole detail is transferred to the page 12.

But the variable for your carry is already evaluated, as the band already started. 

So this is what I guess! (not verified, but after "some" years of using JasperReports). 

To prevent this you could either try to set the SplitType of your detail to "PREVENT"....or you could try to create a "dummy group" with an attribute "MinHeightToStartNewPage" > 30px (or an other TrialAndError value)  or you also could use another detail-band for your "splitting" content and just place the "one-line" fields including amount into the first detail.

If you look into the JasperSoft-Tracker you will find a BugReport some years ago, where I discussed the "Strange Carry Calculation" with Teodord Danciu.... When I remember right, the result of this was a new Splitting type "immediate" .... but I forgot unfortunatly what exactly this is doing. (and it just worked for simple layouts, but not complex SubReports Frames Structures)

So finally just give it a try ... the last chance would be to correct it in the generated JasperPrint Object by JavaAPI... (this is, what I did finally  ... so I just "marked" the amount fields and calculate it's contents for a Sum per page and "correct" the JRPrintText of the CarryField at the bottom per page -  not nice, but working at many customers since several years)


hth + regards


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...