Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Crystal Report Paging Post Reply Post New Topic
Page  of 2 Next >>
Author Message
nehaojha
Newbie
Newbie
Avatar

Joined: 29 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote nehaojha Replybullet Topic: Crystal Report Paging
     Posted: 03 May 2010 at 3:25am
Hello

I have two sub-reports added in the header of the Main Report.
Each sub-report has a header that has to be repeated on each page. To do that I had added a formula whilereadingrecords and added a group on it. Now I can have the header in all pages. But there is no such provision for footer.
And I want page number in footer.
As a work around I tried adding page number in header. Now, the Page number is visible but the problem is that page number on subreport is not continous. the page number on the second subreport starts with one.
eg main report has 10 pages
subreport1 start with 1 ends at page number 4
subreport2 again starts with 1 and ends at 6
I want subreport1 to start at 1 and subreport2 to start with 5
also if any one can tell me how to put them in footer
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 5:43am
use a shared variable, set it in subreport 1 and then use it to add to the page number in subreport 2.
 
something like:
subreport1:
 shared numbervar totPages:=TotalPageCount //maybe in the report footer??
 
subreport2:
 shared numbervar totPages;
 
 "Page " + totext(totPages + PageNumber,"",0)  //wherever you want the page # to print.
 
HTH
IP IP Logged
nehaojha
Newbie
Newbie
Avatar

Joined: 29 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote nehaojha Replybullet Posted: 03 May 2010 at 8:01am
This is the error I got please let me know how to fix this

Error in formula . 'shared numbervar totPages; ' Bad number format string. Details: errorKind
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 03 May 2010 at 8:24am
Which formula was the error in?  And can you copy and paste the code you entered?
 
Thanks. 
IP IP Logged
nehaojha
Newbie
Newbie
Avatar

Joined: 29 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote nehaojha Replybullet Posted: 03 May 2010 at 8:33am
well In Mu subreport1 I added a new formula and named it PageNumber. and then I copied what you wrote

shared numbervar totPages:=TotalPageCount

then In Subreport2 again made new formula called it page number
the formula is
shared numbervar totPages;

"Page " + totext(totPages + PageNumber,"",0)

This is my first time with CR so i apologize if i made a very stupid mistake
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 03 May 2010 at 9:15am
I did a test report using the formulas supplied by lockwelle.  I did not get an error, but the shared numbervar totPages was a huge number.  I am not sure if you can pass a shared value back to a subreport.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 03 May 2010 at 9:41am
You definately can pass variables between subreports (according to the documentation).  The issue I believe goes to the 'TotalPageCount'.  Once the first subreport is processed.   The 'TotalPageCount' from the first subreport becomes undefined. 
 
Lockwelle, do you have any ideas.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 11:55am
Hmmm....  I actually don't use subreports that often.  I would have thougth that the totalPageCount would have been valid at the time that it was assigned, and that would be that...
 
Next thought, is to just put the page counter in the page footer....I know, he wants to do something different different(which I don't know how to do)with the footer, but the page of the report should be same regardless of subreport.
 
Well, that is what I would try next.
 
HTH
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 03 May 2010 at 12:24pm
I just tried that, it doesn't change the counter when the subreport is being generated.  This is going to take some more thought. 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 03 May 2010 at 12:28pm
I just put in the 'page N of M' in the main report page footer and that seems to work as expected.  I do not know if nehaojha has tried this.
IP IP Logged
Page  of 2 Next >>
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