Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Page Number Reference Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Topic: Page Number Reference
     Posted: 01 Jan 2015 at 11:22pm
Hi Guys,

Has anyone got a method of referencing a Page Number?

For Example; there is text in 'Group Header A'. What I want to do is pull the page number from that section (and others) and display it in the Report Header.

Using the PageNumber function obviously then displays the page number of the Report Header.
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 02 Jan 2015 at 3:14am
Update: Everything I have tried thus far (Arrays, ToText, ToWord, ToNumber etc etc) has resulted in the PageNumber function being recalculated and displayed incorrectly (Page 3 instead of Page 4).

My current thinking is to have:

1) Formula in Page 4 to return "4" as the output
2) A Second formula on Page 3 to reference the first formula and display as "4".

The problem is I cannot think of a way to have "4" displayed as when I reference the first formula it recalculates due to the PageNumber function being used.
IP IP Logged
adavis
Senior Member
Senior Member


Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Quote adavis Replybullet Posted: 02 Jan 2015 at 3:59am
Sorry Dr4ke, I do not have a suggestion for you, but I am curious about this, so I am going to follow this post.
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 02 Jan 2015 at 4:12am
Hi Adavis, no worries! If this is possible it would be a much easier way of creating a Table Of Contents without the requirement to write back to the database.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jan 2015 at 5:38am
maybe look at some of the third party tools for this
 
 
 
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 04 Jan 2015 at 10:04pm
Thanks DBlank - I was trying to avoid using a Third Party tool. Is this not possible without one?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Jan 2015 at 4:07am
I believe I have seen this with some sort of sub report using shared variables inside the subreport to build a text string in that report footer and passing that back to the main report as a string to be displayed in the
 main report header.
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 05 Jan 2015 at 10:22pm
ah ok I see! I'll give it a go.

Thanks for your help.
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 06 Jan 2015 at 12:11am
Ok - I have it working, sort of! I have created a test report to test the method and have 3 sections, each is presented on its own page:

1) Report Header
2) Details a
3) Details b

in Details a the following formula has been created:

 Shared StringVar PageNum:= ToText(PageNumber); 


a Subreport was then inserted and the below formula inserted into the Report Footer

 Shared StringVar PageNum;

Shared StringVar PageNumA:= PageNum;

PageNumA;



A third formula has now been created (below) and placed in the Main Report Header. Unfortunately the field is then completely blank; when placed in Details a or Details b it works and shows the Details a page number. I am assuming this is because the formula's are calculated after the Report Header section. Using 'Whileprintingrecords' doesn't work; I believe because PageNumber is always printed at that stage anyway. Any suggestions?

 Shared StringVar PageNumA; 
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 09 Jan 2015 at 12:31am
Anyone have any suggestions?
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