Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: "COUNTIF"? Count instances of a value on a report? Post Reply Post New Topic
Author Message
Jon K
Newbie
Newbie
Avatar

Joined: 12 Aug 2009
Location: United States
Online Status: Offline
Posts: 8
Quote Jon K Replybullet Topic: "COUNTIF"? Count instances of a value on a report?
    Posted: 12 Aug 2009 at 5:46am
Hello all - nice forum!  Now I can find help with all my Crystal Reports questions.

I have a report that we are setting various fields to "ACT" "OBS" or "UNK" based on an integer in a certain field using a series of if then else formulas.

I have a user that wants to be able to count how many times in a specific query "ACT" shows up and have it placed in the footer.  Basically a sum based on the presence of "ACT".

What is the best way to do this?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 12 Aug 2009 at 6:16am
DBlank will do it differently than me, he tends to make a formula that will return a 1 or 0 and then sum it up, but I would use shared variables.
 
since this sounds like it will only be used once per report, only 2 formulas needed, and one already exists.
 
modify the existing formula that selects the ACT to display with
shared numbervar ACT;
 
for the else section that will display ACT:
else (
 "ACT";
 ACT:=ACT + 1;
)
 
now in the footer all you need a formula to display your variable:
shared numbervar ACT
 
HTH
IP IP Logged
Jon K
Newbie
Newbie
Avatar

Joined: 12 Aug 2009
Location: United States
Online Status: Offline
Posts: 8
Quote Jon K Replybullet Posted: 12 Aug 2009 at 7:43am
Excellent - I think I understand.  I will mention both methods.  I think for this end user it might be easier for him to return 1/0 and sum that, but I like your method better if I had to choose.  I will pass this along!

This looks like a great resource!
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.032 seconds.