------------------------------------------------------
Please note: The FAQ was created based on suggestion supplied by:
Ken Hamady
http://www.kenhamady.com/
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
------------------------------------------------------
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.