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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting Page Numbers in Crystal Reports

Status
Not open for further replies.

N11689

Programmer
Jan 29, 2002
113
US
I used Ken Hamady's formulas for Unique Page Numbering, it was a great help, but I am still having problems with page numbering.

Example:
I have a 3 page report made up of 2 pages of details sections and 1 page of terms and conditions [T&C] (the T&C is located in the last group footer section). I have 'New Page Before' checked in the section expert for this T&C section. I would expect the T&C page to print page number 3. The problem is the T&C is printing as page number 2. The report is numbered as Page 1, Page 2, Page 2 rather than Page 1, Page 2, Page 3.

I am grouping by quote number. The page number is located in the Page Header section.

I suspect the problem is there is no more data to print (in any details section) for this quote . As a result, the report wants to print the group footer and finish the report. Because of this, the report does not need to print the Group Header for this last T&C page.

How can I get the T&C page to print Page 3?
 
What formulas are you referring to for "Unique Page Numbers"? I must be getting old. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
This was the information you had suggested about unique page numbers:

---------------------------------------------------------

PROBLEM
Using the built PageNumber function will consecutively number the pages.
You want to implement Page Numbering distinct for each record in sample report(where record ID is primary key).

SAMPLE REPORT
Record ID 1 (spans 2 pages)
Result from Page Number Function: Page 1, 2
Desired Result: Page 1, 2
Detail Name
Datil Address

Record ID 2 (spans 7 pages)
Result from Page Number Function: Page 3, 4, 5, 6, 7, 8, 9
Desired Result: Page 1, 2, 3, 4, 5, 6, 7
Detail Name
Detail Address

Record ID 3 (spans 3 pages)
Result from Page Number Function: Page 10, 11, 12
Desired Result: Page 1, 2, 3
Detail Name
Deatil Address

SOLUTION
Step 1: Group by Record ID

Step 2: Set Group Header to "repeat GH on each new page" (Access the option by right clicking on the group and select "Change Group".)

Step 3: Create two equations.
1. Equation 1 should be place in GH header and should be suppressed.

2. Equation 2 should be place in the Page Header. It will also work in the Group Header.

Here's the code:

Equation 1
Shared NumberVar factorPageCount;
If InRepeatedGroupHeader
then
factorPageCount:=factorPageCount
Else
factorPageCount:= PageNumber - 1

Equation 2
Shared NumberVar RecPageCount;
If InRepeatedGroupHeader
then
RecPageCount:= PageNumber - {@PageFactor}
Else
RecPageCount:= 1
 
Can you tell me where you got this? It doesn't sound like me at all and doesn't make sense to me, at least not without reading it's context. For instance, the formulas refer to shared variables which are only for use with subreports.

Are you simply trying to resetting the page number for each group?
What happens if you put the regular page number in the page header and check "reset Page Number AFter" for the Group Footer? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
The unique page numbering formula is under the FAQ's section of the Crystl Decisions: Crystal Reports - Formulas forum. You can find it there.

We can't use the Reset Page Number After in the group footer section. I'll try to explain why (I apologize if this it too wordy):

The report we have written is a quote. This quote can be faxed. Our Report Header contains a Fax Cover Page. This Fax cover page contains the Total number of pages (including cover page). We are using the TotalPageCount special field to display this number. If there is more than one quote to be faxed, we need to reset the page number at the beginning of each quote, but still count the total number of pages for each quote and include the cover page in that count.

If we use the Reset Page Number After, the TotalPageCount prints the total number of pages for the first quote, not all quotes in the fax.

The unique page numbering formulas seem to work, except in my original issue stated above.

Can you offer any more suggestions? Thank you.
 
OK, that FAQ was written by someone else, who got some of the ideas from me. I think your problem is different.

Is every quote exactly 3 pages? If so, you could get the total page count by simply doing a distinct count of quotes, multiplying by 3 and adding one for the cover.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Unfortunately No. Each quote's number of pages can vary. That's the problem. The quote I was referring to was just an example so I could explain the problem.

If Crystal's special field 'TotalPageCount' truly counted all pages this problem would be solved.

If you have any further suggestions, I would greatly appreciate it. If you need more information I would be more than happy to supply the information. I'm just running out of ideas to get this to work.

Another note: The Cover Page prints as the first page, and only once for each set of quotes that will be faxed. So, we need the total pages at the beginning of the report.

Thank you.
 
I had a similar problem with "Term & Conditions" of a Purchase Order report the total pages was ok just the pagenumber was missing because no header was printed.

I split to a new page after the PO footer was complete and printed the Terms and conditions page next but because I did it in a footer the page number didn't follow me...

My solution was to "fake" a page number.

Since this was going to be the last page of a PO...I just inserted a formula in the approproate spot on the footer

"Page " + totext(PageNumber) + 1,0) + " of " + Totext(TotalPageCount)

worked for me

Jim
 
Ngolem's post opens another door.

If you make your cover page the last page of the report, things get simpler. You could then do a running total count using an invisible running total in the page header. When you print it the reports, take the last page and put it on top.
There are other techniques, but they would get beyond the level of effort I can devote to TT posts. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
We don't print hard copies of our faxes. We use Crystal to compile, and our fax software sends it off. We could try to redesign the report to put the cover page in the report footer. However, I still believe there is a defect with the Crystal Reports.

I'll just have to keep trying for a workaround. Thanks for all your input anyway.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top