Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Page Counter in Rpt w/ sub reports

Status
Not open for further replies.

denko

Programmer
May 17, 2001
70
US

I've got pretty complicated report, it contains about 15 subreports, and I force page brakes almost before every sub report. I also reset page counter before beginning of two different groups.
I need to create another page counter that just counts pages and ignores any resets. It should work like something that you'd see in the right top corner of a preview window in Crystal - 1 of 129. I can not use any of a page counter functions since i reset them.
I tried to use this formula

WhilePrintingRecords ;
NumberVar PageCounter := PageCounter + 1 ;
"Page " + ToText(PageCounter, 0)

but it does not work correctly. Conter starts from 2 and if I move back and force in the report, counter starts to repeat page number like Page 2, Page 3, Page 4, Page 4, Page 4, Page 4, Page 8, Page 9, Page 10 and then again it would repeat a certain page number. I know that it caused by my grouping and page braking but can not modify groups and brakes.
I'm using CR Version 6 and Visual Basic. Any help will be appreciated.
Thanks
denko




 
if you just place the special field page counter function in the page footer it should do a normal count. if your running into an issue because you are address the page counter function directly in formulas, create a formula with a different name that contains the page counter function within it.
-Bruce Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
I can not use PageNumber function because I reset page counter before I begin another Group.
Thanks
 
to do this manually, Crystal recommends the following:
V7 and higher require you to download this ufl for this formula to work:

and search for Uflstore.zip.

formula as follows:

1. On the 'Insert' menu, click 'Formula Fields' and create these two formulas:

//@Set

WhilePrintingRecords;
NumberVar PageNum := 0


//@PageNumber

WhilePrintingRecords;
NumberVar PageNum := PageNum + 1;
StoreNumberVar("PageN", PageNum)


2. Place the formulas on the report:

· Place {@Set} in the Report Header section. You can suppress this formula if you want.

· Place {@PageNumber} in the Page Header or Page Footer section.

These formulas keep track and display the page number value that also exports to RTF.


3. (Optional) You can place a text object in the Page Header or Page Footer sections that says 'Page Number {@PageNumber}".

· On the 'Insert' menu, click 'Text Object'.

· Place the text object either the Page Header or Page Footer section.

· Double-click the text object to put it in edit mode. Type "Page # " in the text object

· On the 'Insert' menu, click 'Formula Field'. Select and drag the {@PageNumber} formula into the text object.

The text object now looks like similar to this in the Design Tab:

[Page # {@PAGE NUMBER}]

Let me know if this works
-Bruce Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
Unfortunately it doesn't, looks like Store formula did not do anything.
PageNumber formula gives me the same result that my formula calculates - repeats and skips pages (seemy explanation above) and when I tried to put in to footer it starts with page 2 and if I go back a few pages it screws up count completly again - repeats and skips pages.
This all happens because I force new pages afer certain groups and display data from sub reports, but sub data takes up the whole page and Crystal Page counter (in upper left corner) shows a correct page number but mine(yours) does not.
Any other ideas
Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top