Section page number on Crystal Reports

Hello,

I am creating a report which includes a summary at the end.  The groups are based on product type.  In the summary I need to show the page number relating to a particular group, i.e


Product Group 1
              Date                      Qty                              Price
               12/12                   1                                   1.00
               13/12                   1                                   1.00
             Total                      2

Product Group 2
              Date                      Qty                              Price
               12/12                   2                                   1.00
               13/12                   2                                   1.00
             Total                     4

Summary Report
                   Group                                    Total                Page Number
               Product Group  1                         2                              1
               Product Group  2                        4                              2

Each group triggers a new page.  

I have produced the summary OK, it's just the page number which is the challenge. Please could anyone suggest an approach.

I am working in VB.

Thanks
LVL 1
Petermcg001Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
mlmccCommented:
How are you producing the summary?

Could a group take more than 1 page?

One way to do  this would be to use formulas with arrays to gather the information for the summary then print the arrays in the report footer.

Basic idea

Create a formula
Name - DeclareVariables
WhilePrintingRecords;
Global StringVar Array GroupList;
Global StringVar Array QtyList;
Global StringVar Array PageList;
Global NumberVar ArraySize;
''

Open in new window


Add a formula to the group header
Name - BuildSummary
WhilePrintingRecords;
Global StringVar Array GroupList;
Global StringVar Array QtyList;
Global StringVar Array PageList;
Global NumberVar ArraySize;

If Not InRepeatedGroupHeader Then
(
    ArraySize := ArraySize + 1;
    ReDim Preserve GroupList[ArraySize];
    GroupList[ArraySize] := {GroupField};
    ReDim Preserve QtyList[ArraySize];
    QtyList[ArraySize] := CStr(Sum(QtyField},{Group}),0};
    ReDim Preserve PageList[ArraySize];
    PageList[ArraySize] := CStr(PageNumber,0);
);
''

Open in new window


In the report footer add 3 formulas to print the arrays

Name - DisplayGroupList

WhilePrintingRecords;
Global StringVar Array GroupList;
Global StringVar Array QtyList;
Global StringVar Array PageList;
Global NumberVar ArraySize;
Join(GroupList,Chr(13))

Open in new window


Name - DisplayPageList

WhilePrintingRecords;
Global StringVar Array GroupList;
Global StringVar Array QtyList;
Global StringVar Array PageList;
Global NumberVar ArraySize;
Join(PageList,Chr(13))

Open in new window


Name - DisplayQtyList

WhilePrintingRecords;
Global StringVar Array GroupList;
Global StringVar Array QtyList;
Global StringVar Array PageList;
Global NumberVar ArraySize;
Join(QtyList,Chr(13))

Open in new window


mlmcc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Petermcg001Author Commented:
Thanks, both answers gave useful insight.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.