Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Conditional Summation Post Reply Post New Topic
Author Message
mcelwainj
Newbie
Newbie
Avatar

Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 21
Quote mcelwainj Replybullet Topic: Conditional Summation
    Posted: 01 Nov 2010 at 5:52am
Hello everyone,
 
 
I am trying to sum a field in a report when the field is a certain value (in this case, "F") however, no matter how I tweak the formula or try to rewrite it - i always get a returned value of 0.00. How can I count a field when the field is a certain value - nothing seems to be working.
 
 
Thanks!
 
-Jeremy
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 01 Nov 2010 at 7:22am
in detail section:
 
shared numbervar iCount;
if {table.field} = "F" then
  iCount := iCount + 1;
""//  if you want to hide the output.
 
in group footer section:
shared numbervar iCount;
 
probably want a reset:
in group header section:
shared numbervar iCount := 0;
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Nov 2010 at 7:23am
 a few ways
convert the value to 0 or 1 then sum that
if field="F" then 1 else 0
Used variable formula to count based on an if then statement
or
use a running total
name=F_Count
field to summarize=F field
type=Count
evaluate=use a formula
table.F-Field='F'
reset=never (for a grand total)
Place in report footer
 
IP IP Logged
mcelwainj
Newbie
Newbie
Avatar

Joined: 18 Oct 2010
Location: United States
Online Status: Offline
Posts: 21
Quote mcelwainj Replybullet Posted: 01 Nov 2010 at 7:24am
Thanks to both of you, will be checking them out shortly. Don't know why I was struggling with this...thanks agaiN!
-Jeremy
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.016 seconds.