Jump to content
Changes to the Jaspersoft community edition download ×

Need to store Group Page Count into Variable

2005 IR Help

Recommended Posts

By: Darren Davis - ddavis539

Need to store Group Page Count into Variable

2005-06-24 13:56

I am using iReport to produce an invoice which may or may not have multiple pages. Each invoice is produced from a data stream which may contain multiple invoices. I've created a group called Invoice, which is reset when the InvoiceId field changes, which allows me to create a new page for each invoice.


I've also figured out how to print page 1/n, where n is the total number of pages for a particular invoice by using using the $V{PAGE_NUMBER} field evaluated for now for the current page and evaluated for the Invoice Group for the total number of pages.


Now I have a requirement to supress some summary fields until I am printing the final page of a group. It seems that I could do this if it were possible to compare the PAGE_NUMBER variable evaluated 'now' against the PAGE_NUMBER variable evaluated at the group inside a "Print when expression" clause. But I don't know how to do that. It doesn't seem that the Variable expression allows me to pull in the evaluation time. All of the summary fields I need to supress are currently found in the Page Footer band.


Is there some way to do this? (I still need to print the labels and boxes for page 1 of 2, but just supress the data until I reach 2/2 or 3/3, etc....)





By: C-Box - c-box

RE: Need to store Group Page Count into Varia

2005-06-26 22:21



Have you already tried to use the LastPageFooter-Band?


I guess it could help you.








By: Todd - tberman333

RE: Need to store Group Page Count into Variable

2005-06-30 11:07

I am trying to do something similar to this... I have a band that I am trying to supress on both the first and last page of a group. To supress the first page was easy, I just added this line to the print when expression :


$V{PAGE_NUMBER}.intValue() == 1 ? Boolean.FALSE : Boolean.TRUE


The problem is I now need to supress it on the last page and the total number of pages can be any number. Does anyone know of there is a way to accomplish this?


Thanks in advance for the help!

Link to comment
Share on other sites

  • 5 months later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

I have the same problem described in this topic and wanted to know if then you are resolutions to resolve the problem.


Moreover I would want to know as you have resolved the problem of the vertical lines in order to delimit the columns in the body of the invoice from the header to the footer.



Link to comment
Share on other sites

The rendering is not done using a multi-pass process, so the filler has no idea what's coming next. The filler only ever knows about the total number of records in a set once it gets to the end of the set. This is why you can't put group totals into a header section unless you calculate them within a subreport (subreports are always rendered before their parent report).



So there is your solution: precalculate everything by putting a subreport into the header section and store the returned values in variables until it's time to use them.



Now remember that calculating the number of pages for each invoice is your problem. You will know how many records there are and you you should know how many records can be displayed on a single page. Go do the math.



The downside is you have to run an additional query to get the totals, but there's no other way around it.




Post edited by: jmurray, at: 2007/02/23 03:47

Link to comment
Share on other sites

It was what I feared… to have to calculate how many lines are between header and footer!


In order to resolve the problem currently I am estimated in the temporary table that step to report the total of the line number; therefore control in the footer that the total calculated in the report is equal to the total in the temporary table.


As far as the vertical lines from the header to the footer… for the moment I have left to lose! I hope that in one of the next versions of iReport lines can be made that they cross the sections!


Thanks however for your precious councils.

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