Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Searching a Text Field for a Value Post Reply Post New Topic
Author Message
motoxracer400f
Newbie
Newbie
Avatar

Joined: 11 Sep 2007
Location: United States
Online Status: Offline
Posts: 27
Quote motoxracer400f Replybullet Topic: Searching a Text Field for a Value
     Posted: 06 Mar 2008 at 6:49am
Hi again, I have a question regarding a formula that just doesn't want to work for me and you guys always find a solution to my problem!
 
I have a Text/Memo field called {RFQ.note_text}.  I want to be able to search the field in each record for the word "FOLLOWUPS" and if that record does NOT contain that string anywhere in it, I want to suppress the current record.  I am also suppressing duplicate "Quote Numbers" with the same code.
 
This is the formula I tried and it only suppresses the duplicate RFQ (Quote Numbers) and a few of the "FOLLOWUPS" fields, but most are still visible even though they don't contain "FOLLOWUPS".  I placed this code in the Details - Suppress box.  What am I doing wrong??  THX!!!
 
if previous ({RFQ.RFQ}) = {RFQ.RFQ} then true
else if Instr(1, {RFQ.Note_Text}, "FOLLOWUPS:", 1) = 0 then true
else false


Edited by motoxracer400f - 10 Mar 2008 at 7:46am
IP IP Logged
motoxracer400f
Newbie
Newbie
Avatar

Joined: 11 Sep 2007
Location: United States
Online Status: Offline
Posts: 27
Quote motoxracer400f Replybullet Posted: 10 Mar 2008 at 7:48am
Is there maybe some sort of search command that I need to use?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Mar 2008 at 3:59pm

Try this:

{RFQ.RFQ} = previous({RFQ.RFQ}) or isNull({RFQ.Note_Text}) or (Instr({RFQ.Note_Text}, "FOLLOWUPS") = 0)

If the Note_Text field is never empty, you can take out the isNull piece.  If it can be empty, you need it because a blank string and a null value are not the same thing.
 
Note that I took out the whole "If" statement.  Each of the pieces of this statement (and of your if statement!) already evaluate to True or False, you don't need the "if".
 
-Dell
IP IP Logged
motoxracer400f
Newbie
Newbie
Avatar

Joined: 11 Sep 2007
Location: United States
Online Status: Offline
Posts: 27
Quote motoxracer400f Replybullet Posted: 11 Mar 2008 at 6:14am
Smile Thank you, that works perfectly!!!!
 
One other minor thing that I noticed is that on the first record, it is still visible.  Is there a reason for this?
IP IP Logged
bucky7199
Newbie
Newbie
Avatar

Joined: 17 Feb 2008
Location: United States
Online Status: Offline
Posts: 30
Quote bucky7199 Replybullet Posted: 11 Mar 2008 at 7:15am
Dell, can I ask you for your programming expertise on my crosstab questions? They are under my user id bucky7199. Right now I can't get anyone to respond to me.
 
Thanks.
Dan S.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 11 Mar 2008 at 8:12am
Dan,
 
Unfortunately I haven't worked with crosstab reports except in a Crystal class that I took about 10 years ago, so I'm afraid that I'm not going to be much help.
 
Sorry!
 
-Dell
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 11 Mar 2008 at 8:15am

motoxracer,

Sorry 'bout that, it has to do with the order of things in the statement and the fact that there is no previous record.  Try this:

isNull({RFQ.Note_Text}) or (Instr({RFQ.Note_Text}, "FOLLOWUPS") = 0) or {RFQ.RFQ} = previous({RFQ.RFQ})

-Dell
IP IP Logged
bucky7199
Newbie
Newbie
Avatar

Joined: 17 Feb 2008
Location: United States
Online Status: Offline
Posts: 30
Quote bucky7199 Replybullet Posted: 11 Mar 2008 at 9:52am
Ok, no problem.
Dan S.
IP IP Logged
motoxracer400f
Newbie
Newbie
Avatar

Joined: 11 Sep 2007
Location: United States
Online Status: Offline
Posts: 27
Quote motoxracer400f Replybullet Posted: 11 Mar 2008 at 9:58am

Work's excellent!!!!!  Thanks again for being such a big help!!!

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