Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Multiple Page Counts in Report Post Reply Post New Topic
Page  of 2 Next >>
Author Message
mjsmith
Newbie
Newbie


Joined: 20 Nov 2013
Location: United States
Online Status: Offline
Posts: 6
Quote mjsmith Replybullet Topic: Multiple Page Counts in Report
    Posted: 20 Nov 2013 at 7:29am
I have a report structured in the following manner:

Report Header
Page Header
Group Header (Total Page Count for each group)
Details
Group Footer
Page Footer (Page N of M for each detail)
Report Footer

I'm trying to get two independent page counts working. The first is a "Total Page Count" for each group and appears in the group header. The second is a "Page N of M" for the details section and appears in the page footer. The problem is that the two counts can't be reset independently, so only one will work at a given time. Does anyone know how to solve this issue? Thanks in advance.

Edited by mjsmith - 20 Nov 2013 at 9:39am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 20 Nov 2013 at 8:10am
The only thought that comes mind is using a variable...but that cannot go in the group header as the data has not been read/pages generated.

Probably the best approximation that you can get is to count the number of lines for each group and if you know how many detail lines fit on a page, you can approximate the number of pages.

It's a thought. Perhaps someone else has a better idea.

Just as an odd question...is the report footer a total of the pages in the report? Seems odd that you would have something like, on page 4 of 25, there are 10 pages for this group, and you would show page 5 of 25 with or without the group header. Just seems odd and confusing to me. Unless that you mean the Report footer would display page 1 of 10, and then in the next group page 1 of 4 (for example)...If so, you would think that you could access the count of pages for the group..

And I've been wrong before
IP IP Logged
mjsmith
Newbie
Newbie


Joined: 20 Nov 2013
Location: United States
Online Status: Offline
Posts: 6
Quote mjsmith Replybullet Posted: 20 Nov 2013 at 9:25am
Thanks for the response! I made a mistake in my original post. The Page N of M should have been in the Page Footer. I've corrected it now.

Could you please go into more detail about how to use a variable to solve the problem?

Each group in the report is a fax recipient and each detail record is a collection of several subreports that collectively form one or more documents to be faxed. Here's an example of a report with five records and two recipients broken down by page along with the desired page number print-out in parenthesis:

Fax Cover Sheet to Recipient X (7 Total Pages) Group Header 1
First Fax (Page 1 of 2) Detail 1
First Fax (Page 2 of 2) Detail 1
Second Fax (Page 1 of 3) Detail 2
Second Fax (Page 2 of 3) Detail 2
Second Fax (Page 3 of 3) Detail 2
Third Fax (Page 1 of 1) Detail 3
Fax Cover Sheet to Recipient Y (4 Total Pages) Group Header 2
Fourth Fax (Page 1 of 1) Detail 4
Fifth Fax (Page 1 of 2) Detail 5
Fifth Fax (Page 2 of 2) Detail 5

Of course the ideal solution would allow for any number of details records grouped into any number of recipients. As I mentioned before, the two page counts need to operate independently of each other, but resetting the page count will reset both. Thanks again for your response.

Edited by mjsmith - 20 Nov 2013 at 9:43am
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 21 Nov 2013 at 12:37am
Hi
 
Getting total page count on group header :
 
Create a formula like :
@count
if isnull({Groupfield}) then 0 else 1 
 
Place the above formula in detail section and insert summary and place the summary on your group header. ( If u want u can suppress this formula )
summary formula :
@pcount
sum({@count},Groupfield)+1 (to include Fax Cover sheet) 
( I think each detail is prining in a separate page )
 
Now create a manual running total to print page numbers like 1 of 10 etc..
 
@Init
Whileprintingrecords; 
Numbervar x:=0;
 
Place the above in your group header and suppress it.
 
@Accu
Whileprintingrecords;
Numbervar x:=x+1;
"Page "&x&" of  "&{@Pcount}
 
Place this formula in page footer to print page N of M
 
Hope this helps
 
 


Edited by Sastry - 21 Nov 2013 at 12:47am
Thanks,
Sastry
IP IP Logged
mjsmith
Newbie
Newbie


Joined: 20 Nov 2013
Location: United States
Online Status: Offline
Posts: 6
Quote mjsmith Replybullet Posted: 21 Nov 2013 at 6:55am
Sastry,

Thanks a lot for your detailed reply!

Unfortunately, the solution you provided only works if there is one detail per page. In most cases, there will be three to four pages per record, so what I really need to count is pages and not records.

Please let me know if you have any other solutions. Thanks again!

Edited by mjsmith - 21 Nov 2013 at 6:56am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Nov 2013 at 8:24am
what version are you on?

in XI, in the Section Expert, you can reset the page numbering...which I would guess would allow you to know the number of pages in that section, and you can change numbering in both a group header and the detail section, so you might be able to accomplish what you are after.

No, I have never done this myself (at least not in a very long time) and never with multiple sections being renumbered.

It's worth a try.
IP IP Logged
mjsmith
Newbie
Newbie


Joined: 20 Nov 2013
Location: United States
Online Status: Offline
Posts: 6
Quote mjsmith Replybullet Posted: 21 Nov 2013 at 10:09am
Thanks for the reply! I'm using Crystal Reports 2008 Version 12.0.0.549.

In section expert, I am able to reset the page number for the group, which gives me the correct Total Page Count for the cover sheet, or for the details, which gives me the correct Page N of M page counts for the individual sections, but only one will work at a time.

I'm not sure what you mean by changing the numbering in the group header and details section. Could you please elaborate?

Thank you!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Nov 2013 at 11:01am
what I was thinking was that in the group header you would reset the page number, and grab the total pages for the group, then in the detail you would change it again, and it would be the values as described in the sample above...

so all the values would be correct.

Again, I haven't done this, but I would think that from inside the group header you could write a formula or access the special value of total pages and display it in the group header. It will change in a instance as you enter the detail section, but then you have the value that you after.

That was my idea...I could be wrong and it won't work, hence, worth a try.

Changing the numbering is Resetting the page number.

HTH
IP IP Logged
mjsmith
Newbie
Newbie


Joined: 20 Nov 2013
Location: United States
Online Status: Offline
Posts: 6
Quote mjsmith Replybullet Posted: 21 Nov 2013 at 11:26am
Thanks for the reply, I understand now. Resetting the page number anywhere in the Section Expert (Report/Page/Group/Detail) resets it globally, so setting the page number to be reset in the Details and the Group resets it twice for both.

I'm not sure if there is a bug in CR or there's something that I'm missing, but Sastry's response seems like it should work if the @pcount formula is placed in the page footer instead of the details view, but despite being printed on every page, it is only incremented once per record.

Thanks again.

Edited by mjsmith - 21 Nov 2013 at 11:26am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Nov 2013 at 11:28am
ok...well, it was worth a try.

Go with Sastry's solution then
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.032 seconds.