Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Count based on String Occurrence Post Reply Post New Topic
Author Message
sandy
Groupie
Groupie


Joined: 10 Jan 2007
Location: United States
Online Status: Offline
Posts: 45
Quote sandy Replybullet Topic: Count based on String Occurrence
    Posted: 26 Nov 2007 at 9:26am

I want to be able to count the number of records that returned False.  On the report I created a formula called Success Flag to place '*******' on that line to help the users identify those that failed.  Formula is as follows:

if {Tracking.Success}= FALSE then '*******' else ' '

 

Success is the  database field name and it returns either True or False.

 

I saw on the on-line help the following formula which I tried to use to count the number of occurrences of the string ******* but was not successful in getting it to work if indeed it would do what I am looking for it to do.

(Set[,EXCLUDEEMPTY|INCLUDEEMPTY])   

Also I tried to simply create a formula as follows but could not get that to work either.  Not sure what exactly am I doing wrong.  Thanks in advance

 

 Global NumberVar NumStrings;
if {
Tracking.Success
= "*******" Then
    NumStrings := NumStrings + 1;

IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 26 Nov 2007 at 10:40am
Here is a basic overview of doing conditional running totals using variables.


IP IP Logged
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Posted: 26 Nov 2007 at 11:09am
Hi sandy,
 
In addition to Lugh's response, I'd like to add that your last formula example had a problem in that it is comparing a binary database field with a string value.  The correct formula(s) might be;
 
Global NumberVar NumStrings;
if {Tracking.Success = False then
NumStrings := NumStrings + 1;
 
or
 
Global NumberVar NumStrings;
if @Success Strings = "*******"  then
NumStrings := NumStrings + 1;
 
Either way, Lugh's example is really the way to do it.
 
regards,
-jrw
IP IP Logged
sandy
Groupie
Groupie


Joined: 10 Jan 2007
Location: United States
Online Status: Offline
Posts: 45
Quote sandy Replybullet Posted: 26 Nov 2007 at 12:04pm
The field success is bit
so the following formula works only if I set it = True but to count the records that are False it will not work.
Global NumberVar NumStrings;
if {Tracking.Success} = True then
NumStrings := NumStrings + 1;
 
Any more suggestions??  Thanks, Sand
IP IP Logged
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Posted: 26 Nov 2007 at 1:28pm
Hi Sand,
 
The following question is based on the fact that you said that you can't get any counts for "False" records, not upon whether or not you were able to use Lugh's reply.  If I'm off track, tell me and I'll try again.
 
Is it possible that the values for {Tracking.Success} are not True or False, but are True and Null.  Is the field initialized with the creation of each new record, or is it left Null?
 
Regards,
-jrw
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.035 seconds.