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

Error in String Function

Status
Not open for further replies.

jzalma

MIS
Jan 7, 2016
1
US
I have a set of data that I am attempting to count the number of times a string appears. My data set includes both "Deferred Dismissal" and "Dismissal"

I need to find a way to count the number of times Dismissal appears and the number of times that Deferred Dismissal appears (they are not the same)

I first attempted

if instr ({'Administrative_Action_Report_'.Sanctions: Sanction},"Dismissal")>0 then 1

but that returned values for both Dismissal and Deferred Dismissal

I then attempted

if instr ({'Administrative_Action_Report_'.Sanctions: Sanction},"Dismissal")>0 and
not ({'Administrative_Action_Report_'.Sanctions: Sanction} in ["Deferred"]) then 1

however this did not change the output.

Any suggestions would be greatly appreciated.
 
Are there other options for this field? Do any of the other options begin with "Deferred"?
 
How about just trying this:

Code:
if instr ({'Administrative_Action_Report_'.Sanctions: Sanction},"Dismissal")>0 and
   instr ({'Administrative_Action_Report_'.Sanctions: Sanction},"Deferred")=0 then 1 else 0

~Brian
 
two formulas

Code:
if instr ({'Administrative_Action_Report_'.Sanctions: Sanction},"Dismissal")>0 
and len(trim({'Administrative_Action_Report_'.Sanctions: Sanction})) = 8
then 1

Code:
if instr ({'Administrative_Action_Report_'.Sanctions: Sanction},"Dismissal")>0 
and len(trim({'Administrative_Action_Report_'.Sanctions: Sanction})) > 8
then 1
Sum each of them at the desired group level or report footer
_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection


_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
You got to look for Deferred Dismissal BEFORE you look for Dismissal!

Could you post several full text values that are typical of what you are searching?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Try

@findstring
[tt]if "Deferred Dismissal" in {'Administrative_Action_Report_'.Sanctions: Sanction} then
1
else if "Dismissal" in {'Administrative_Action_Report_'.Sanctions: Sanction} then
2
else
0
[/tt]

Then you need to write formulas to count 1's to get the count of Deferral Dismissal and 2's to get the count of Dismissal.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top