Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grand Totals (Not Working...)

Status
Not open for further replies.

MikeCopeland

Programmer
May 21, 2007
91
US
Using CR XI...
In a report I'm developing I need to count the # of Male clients and the # of Female clients - for grouping _and_ a grand total at the end of the report. I had to do the following for both "M" & "F" gender codes:
// @numMales - returns 1 for "M"; 0 otherwise
WhileReadingRecords;
if({Clients.Sex} = "M") then 1
else 0
...and a similar formula for Females ("F"). I then do a Running Total Sum on @numMales & @numFemales, resetting on my Group field. This works fine.
Then I tried to set up a Running Total Sum with the same 2 formulas, but Resetting Never. These values don't (quite) work: they're a little too large - nothing obvious, just not quite right. What might I be doing wrong here? TIA
 
You probably have some people who are appearing in multiple groups and your running totals are not distinguishing that. In the first case--at the group level--you could just be right clicking on your formulas and inserting a sum (not count) on each. At the report level, you could use two running totals that do a distinctcount of the clientID, evaluate using formula:

{Clients.Sex} = "M"

Reset never.

-LB
 
Why are you using a Running Total? Can't you just do a Sum and put it in the Report Footer? Also, is it possible that records don't have Clients.Sex populated? Possibly Null? or Something other than M or F? (I could easily point out some other options - but I won't go there[wink]). One way to check on nulls is to add in the Select Expert :not isnull (Clients.Sex) -and see if the record count goes down.

DataDog [pc2]
If God wanted us to count in Hexadecimal, then why did he only give us A fingers?
 
What about a crosstab? Automatic totalling, found under 'Insert'

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top