How to know total pages in a report

hi every one,
[p] i want total pages in a report, because i want to print continued.. at a page footer if report has more then one page this text doesn't come if it has only one page and not to repeat in last page, this can be achived if able to get the total pages in first page only, please help me on this matter,
[/p]
[p]
$V{PAGE_NUMBER} gives the current page number if i change this variable evaluation time to report then i wil get the total page number but the problem is i can print this number by putting it on report by changing its evalution time but i want it in variable because in my case i have to use this variable in print value expression when? so any one know how to get total pages please help me[/p]

Post edited by: dgmanu, at: 2007/02/15 04:54
Post edited by: dgmanu, at: 2007/02/15 04:54
dgmanu's picture
49
Joined: Oct 15 2006 - 3:30pm
Last seen: 16 years 7 months ago

10 Answers:

Hi,

The evaluationTime attribute is only a rendering/display feature and not a calculation engine feature.
We cannot use late evaluation in variables, so you cannot use the total number of pages the way you mentioned.

Thank you,
Teodor
teodord's picture
47121
Joined: Jun 30 2006 - 9:00am
Last seen: 2 hours 18 min ago
Shit, but how?
xtia004's picture
22
Joined: Jun 18 2007 - 10:26am
Last seen: 15 years 11 months ago
hi

do the jasperrepors masters have some idea of how to solve this issue??

I mean, it's a very usefull skill to perform actions or take decisions at outer levels of report (headers), based on whats going on with detail report data, not just to be able of draw things based on it

I've tried to solve it playing with subreports and retrieving values from them, but always face the same problem: variables placed at headers can't to react based on detail data

please let me know if there's some way to bypass this issue
mauricio's picture
128
Joined: Jan 30 2007 - 1:29am
Last seen: 4 months 1 week ago
Hi,

Maybe I don't fully understand what you are talking about and a better example of what you need to achieve would be more appropriate.

But I just wanted to let you know that scriptlets are a very flexible way of implementing a complex data processing.
You could have a scriptlet that with every detail make the appropriate modifications of some internal data that you can then leverage at higher levels.

I hope this helps.
Teodor
teodord's picture
47121
Joined: Jun 30 2006 - 9:00am
Last seen: 2 hours 18 min ago

I have what I think is a similar problem to the original poster here. And it's not one that can be solved with the "Page i of n" trick.

I have a static set of lines that I want to draw on the background of every page... EXCEPT the last (summary) page. It would be extraordinarily useful to just set the "print when expression" to something like "$V{page_number} < $V{total_pages}" or the equivalent.

The best solution I have so far is to simply draw white lines over top of the background lines in the summary band.... which is, of course, a horrible solution.

Does anyone have anything better?



Post Edited by jbedell at 02/05/2010 19:37
jbedell's picture
68
Joined: Jan 26 2010 - 9:06am
Last seen: 13 years 4 months ago

I've gotten around this problem by adding a column to my query that calculates the total number of rows in the recordset, then divide by the number of rows on a typical page.  This gives me a good estimate of the total number of pages.  I then use this field ($V{total_pages} = $F{cnt}.intValue() / 25) in my 'print when expression'  (ie: print such 'n such if total_pages >10)

The query is similar to the following:

with t2 as (SELECT 
count(acc.account_id) as cnt
FROM
    account acc where amt>10000) 

Select id, name, cnt from t2, account where amt >10000

 

jrechter's picture
477
Joined: Dec 17 2008 - 10:15am
Last seen: 7 years 6 months ago
mailmrsujan's picture
Joined: Dec 5 2006 - 6:25pm
Last seen: 9 years 5 months ago

Hi!

I know this thread is a bit (well, quite) old, but just in case someone is searching for this issue. The easiest way to get the number of total pages is by defining a variable with the next attributes:

Name: total_pages (or any other)
 
Variable class: Integer
 
Calculation: highest
 
Reset type: report
 
Increment type: page
 
Variable expression: ${PAGE_NUMBER}

I hope this may help.

jjcapa's picture
131
Joined: May 5 2015 - 10:21pm
Last seen: 2 years 10 months ago

Has anyone tried method from @jjcapa? Is it working? I got null values only.

riodavid's picture
2575
Joined: Oct 27 2016 - 1:57am
Last seen: 4 years 7 months ago
Feedback
randomness