Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Don't count null string field Post Reply Post New Topic
Author Message
dibblejon
Newbie
Newbie


Joined: 05 Jan 2011
Location: United Kingdom
Online Status: Offline
Posts: 32
Quote dibblejon Replybullet Topic: Don't count null string field
     Posted: 18 Jan 2011 at 10:34pm
Hi
 
I have a simple formula :
 
if {NumberField} like "??02" then {StringField}
 
I then need to group the {StringField} using a distinct count - problem is that it counts null fields as well.
 
How can I prevent this happening?
 
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jan 2011 at 4:09am
Formulas in Crystal do not allow you to insert NULLs so this type of count always has the flaw of a possible empty string that ends up adding 1 to your distinctcount. You have to use either variable formulas or a Running Total (RT).
I prefer Running Totals. Note that neither work in headers.
The RT version.
Create a new RT
Name=whatever
Field to summarize={StringField}
type = DistinctCount
Evaluate=use a formula...use your criteria here...{NumberField} like "??02"
Reset = Never if you want grand total or on a group if youa re lookikng for a group level total
place on report footer or group footer for totals and on detail section to see incrimental (row) changes.


Edited by DBlank - 20 Jan 2011 at 4:08am
IP IP Logged
dibblejon
Newbie
Newbie


Joined: 05 Jan 2011
Location: United Kingdom
Online Status: Offline
Posts: 32
Quote dibblejon Replybullet Posted: 19 Jan 2011 at 10:07pm
Thank you
 
That's really helped me.
 
Smile
IP IP Logged
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