Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: String Formula Problem Post Reply Post New Topic
Author Message
tonnette
Newbie
Newbie


Joined: 27 Oct 2009
Location: United States
Online Status: Offline
Posts: 3
Quote tonnette Replybullet Topic: String Formula Problem
     Posted: 27 Oct 2009 at 12:33pm
I am trying to write a formula in Crystal 10 that returns a text string when the text string includes the characters 'est' or 'estate' in the field. Any suggestions?
 
I used the formula:
"est" in {customer.formatname} or
"estate" in {customer.formatname}
 
Problem with that is that it is returning fields that may have Westbrook or Estrada. How do you get it to disregard anything other that Est or Estate?


Edited by tonnette - 27 Oct 2009 at 1:43pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Oct 2009 at 2:47pm
so you just want to check for "est" or "estate"? Then change "in" to "="

IF {customer.formatname}="est" or {customer.formatname}="estate" THEN
     {customer.formatname};



Edited by BrianBischof - 27 Oct 2009 at 2:48pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
tonnette
Newbie
Newbie


Joined: 27 Oct 2009
Location: United States
Online Status: Offline
Posts: 3
Quote tonnette Replybullet Posted: 27 Oct 2009 at 2:59pm
But I want it to include Madison Estate or Perkins Est. I just don't want to include names that have "est" in them. Is there a way to do that? If I put that it equals that, won't it exclude those that I listed?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Oct 2009 at 11:58pm
What about putting a space before and after "est" and that way you know it is a whole word and not part of another word. I would try this:

InStr({customer.formatname}, " est ") > 0 OR
InStr({customer.formatname}, " est.") > 0 OR
InStr({customer.formatname}, " estate ") > 0

You might have to add more conditions based upon the exact text in your database.


Edited by BrianBischof - 27 Oct 2009 at 11:59pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
tonnette
Newbie
Newbie


Joined: 27 Oct 2009
Location: United States
Online Status: Offline
Posts: 3
Quote tonnette Replybullet Posted: 28 Oct 2009 at 6:40am
Getting closer. Thanks. Is there a way to tack on a space at the end of a field. Apparently, it is dropping off the spaces at the end. If I could tack just one space back on at the end, then I would be able to get all the records that I am looking for. :) I appreciate all your help with this.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 28 Oct 2009 at 10:32am
Glad that you're almost there! Try this instead:

InStr({customer.formatname}+" ", " est ") > 0 OR
InStr({customer.formatname}, " est.") > 0 OR
InStr({customer.formatname}+" ", " estate ") > 0
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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