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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting True/False

Status
Not open for further replies.

Rob2k2

Technical User
Oct 14, 2002
36
GB
I have a field PPP, which is either true or false but what I want to do is count the number of Trues and divide them by the total number of entries. Is there an easy way to do this?
 
In the section containing {PPP};

WhilePrintingRecords;
NumberVar TrueCount;

If {PPP} = 'True'
Then TrueCount := TrueCount + 1
Else TrueCount;

At the end of your report;

WhilePrintingRecords;
NumberVar TrueCount;

Count({PPP}) / TrueCount

Naith
 
Thanks a lot, this works well however is it possible to do it per group as opposed to a total number for all the data?
 
In your Group Header;

WhilePrintingRecords;
NumberVar TrueCount := 0;

In your Group Footer;

WhilePrintingRecords;
NumberVar TrueCount;

Count({PPP},{GroupField}) / TrueCount

Naith
 
How do you insert formulas into the group header?
 
I'm not sure I understand what you mean. Click and hold on your field and drag it into the Group Header section.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top