Link to home
Start Free TrialLog in
Avatar of janmarini
janmarini

asked on

How to show record count in report header?


I need to show the total number of records on the report header.  I tried

WhilePrintingRecords;
NumberVar RunningCount;
NumberCount

but it always returns 1.

How do I do this?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of frodoman
frodoman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you need instructions:

Click on a field in the detail section to select it.

Click Insert -> Grand Total.

Default in dropdown will be "SUM" - change this by selecting "COUNT"

The count field will be placed in the RF by default but you can drag & drop it on the RH.
Avatar of _TAD_
_TAD_



The best solution (in my opinion) is provided above by frodoman.


However, there are some instances when you want to put conditions on your count, but you don't necessarily want group by that condition.

The way around this is to create three formulas

formula1  init_count:  // gets placed on the level you want to reset your count to 0
WhilePrintingRecords;
Shared NumberVar count := 0;
count;

formula2 inc_count: // gets placed usually in the details section, but not always
WhilePrintingRecords;
Shared NumberVar count;
If (<condition>) then
     count := count + 1
else
     count;

count;


formula3 disp_count: // place wherever you want to see the final value
WhilePrintingRecords;
Shared NumberVar count;
count;

Avatar of janmarini

ASKER

ummm... Kind of new here and I am not sure how to split points.  Both of your answers are great, and helped me out a lot.  I wasn't able to move the Grand Total Field - but after I placed and suppressed the GT, I was able to reference it in a formula that I placed in the Report Header, and that worked perfectly.  And I appreciate the added info from Tad, will be usefull in the future - I'm sure.  LOL - been working with Crystal forever, and there is always so much to learn!  Since I don't have a lot of experience with this forum, please help me figure out how I can divvy up the points appropriately.

Thank you!



Give Frodoman the points.



I didn't submit a comment for points... it was more of an FYI (just in case).

Frodoman provided the answer to the question you asked.  I believe awarding him full points would be the most fair route to go.
Thank you!