Jump to content
We've recently updated our Privacy Statement, available here ×

Calculate Sum in table column per page


zaila_1
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. 

 

total_per_page.png.66e085f8fb94154ae8a088eb1038a7b7.png

table.png.03295fb7d3669a5e3ef75311345e2f55.png

 

sample_0.png.506ed837d7cfc611509a30027d348c49.png

 

** 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

C-Box

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...