Print Page | Close Window

How do I use a Instr to check for a string value?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13493
Printed Date: 30 Apr 2024 at 12:37am


Topic: How do I use a Instr to check for a string value?
Posted By: Database_Virgin
Subject: How do I use a Instr to check for a string value?
Date Posted: 14 Jun 2011 at 8:13am
I have a field called status. I need to do a compare: if status is 'dead' then formula=false. if status is anything else, formula = true. There is a status value 'dead-spent'. I want the formula to be true when it's dead-spent but the way I have it written, it doesn't read past 'dead'. Does anyone know how i can differentiate the two? Status can have seven different values(active, inactive, etc....)
This is what i have so far & it's not working.
 
if instr({CUST.Status},"Dead",1)>0 then
    formula = false
else
    formula = true
end if
 
-Nancy.



Replies:
Posted By: DBlank
Date Posted: 14 Jun 2011 at 8:27am
just directly compare
 
NOT({CUST.Status}="Dead")


Posted By: Keikoku
Date Posted: 14 Jun 2011 at 9:07am
If both "dead" and "dead-spent" are statuses that should evaluate to True, then you can check for both.


Posted By: Database_Virgin
Date Posted: 15 Jun 2011 at 8:18am
I did a direct compare & it worked like a charm.
Thank You.



Print Page | Close Window