Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Help regarding the filter in Crystal Post Reply Post New Topic
Author Message
VB001
Newbie
Newbie


Joined: 07 Feb 2010
Location: United States
Online Status: Offline
Posts: 6
Quote VB001 Replybullet Topic: Help regarding the filter in Crystal
     Posted: 16 Feb 2010 at 2:26pm
Hello Guys,

I have a question here regarding the filter available in Crystal. I was wondering if there is a way of achieving something similar to "LIKE" used in SQL?

I have a long string which consists of non-alphanumeric characters and numeric characters. Something like this: ####$$$%4789%%%#$#$#

What I need to do is achieve a filter equivalent to:

"where string is Like/containing 4789:

Basically, look for certain numeric characters in a long string something like mentioned above. Please let me know if there is way to achieve the aforementioned.

Any help is highly appreciated.

Thanks,
Vaibhav
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 16 Feb 2010 at 2:42pm
There is the 'is like' filter.  I am not sure how it will handle the special characters.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Feb 2010 at 5:45pm
you can also use the instring option
instr(field,'4789')>0
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 22 Feb 2010 at 7:58am
Could you not so something like this:
Goto to select expert.
Choose the filed and the like comparison.
In the blank box put in *4789*
IP IP Logged
Jyri
Newbie
Newbie


Joined: 19 Aug 2009
Location: Finland
Online Status: Offline
Posts: 13
Quote Jyri Replybullet Posted: 24 Feb 2010 at 11:49pm
Hello,
 
I saw this message while searching through answers to my problem.
 
I have a customer field, and I want to check within that string a particular word 'grönmark'.
 
We have different customer names for the same customer for example :
 
Oy Grönmark Ab
Oy Brynolf Grönmark Ab
 
So when ever this string includes a word Grönmark I want to print just Grönmark.
 
I tried like this : if instr({fr.ftgnamn},'grönmark')>0 then 'Grönmark'
 
this is not working for some reason. Crystal doesn't give any errors, but it doesn't return any values even though there are lots of those customers on my report.
 
If someone could see where I'm going wrong.
 
Thank you,
Jyri
 
Edit : Got dammit that function was case sensitive. problem solved by :
if instr({fr.ftgnamn},'Grönmark')>0 then 'Grönmark'


Edited by Jyri - 24 Feb 2010 at 11:53pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Feb 2010 at 7:08am

lol...I rather enjoyed your Edit comment and am glad you found an answer.

As you found the instr() is by default case-sensitive.
If your data set has both Upper and lower case rows you can change it to case-insensitive by adding an additional condition in it:
if instr({fr.ftgnamn},'grönmark',1)>0 then 'Grönmark'
 
FYI- The LIKE function would also work and is not case-sensitive by default...
if {fr.ftgnamn} LIKE '*grönmark*' then 'Grönmark'
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