[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2559
  • Last Modified:

How to display the total number of groups in Crystal Reports 10?

I have a report that collects data from a main table and several other tables with which the main table has a one-to-many relationship.  This results in several rows in the result set for each record I wish to display in my Crystal Report.  I use a group to consolidate the records into a single printed record.

Because this is a lengthy report, my client wants a "Record X of Y" counter at the bottom of the page.  The built in special field gives me just that -- the individual record count; however, I need to display Group X of Y.  Each record could span multiple pages, so Page X of Y won't do it for me, either.  I found the Group Number field (gives me X), but how can I calculate the total number of groups in the report (thus giving me Y)?  

Thanks!
0
lilfos
Asked:
lilfos
  • 3
  • 2
1 Solution
 
crgary_txCommented:
did you try 'groupnumber' function?
0
 
lilfosAuthor Commented:
Thanks for the quick reply.  I did, but it only got me half way there.  My report currently says:

Record {Group Number} of ????.

How do I calculate ???? ?
0
 
mlmccCommented:
Try this idea.  Use a formula like

DistinctCount({GroupField})

mlmcc
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
mlmccCommented:
Do you want record number or group number?

There are special fields for record number and record count

mlmcc
0
 
lilfosAuthor Commented:
I want the group count, but the client doesn't care what's going on behind the scenes.  To them, the group count is called the record count.

DistinctCount returns the same thing as Group Number.  It increments with every group.  I want to display the total number of groups from the very beginning.

Does anyone know how to display the total number of groups in a report before the report finishes displaying all the groups?
0
 
lilfosAuthor Commented:
mlmcc,

I just got what you meant about DistinctCount.  I was only thinking of it as a Running Total or Summary function, but it's available in the Formula Field editor, too.  When I use it there, it gives me the total distinct count of the field I'm grouping by, which effectively counts the number of groups.

Thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now