INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Formula Help

How to generate unique page numbering in a report by MsPepperMintUSA
Posted: 19 Jul 01

------------------------------------------------------
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






  

Back to Business Objects: Crystal Reports 1 Formulas FAQ Index
Back to Business Objects: Crystal Reports 1 Formulas Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close