Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crieria Question Post Reply Post New Topic
Author Message
amcb10
Newbie
Newbie


Joined: 10 Jul 2008
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote amcb10 Replybullet Topic: Crieria Question
    Posted: 24 Sep 2008 at 5:47am
Is it possible to only display records that contain certain words?

EG: Sales order number can say either, P12202, P12202 Xmas or P12202 Christmas.

Is there any way to filter these out, sort of if it contains a word. I have seen startswith but not contains.

Thanks
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Sep 2008 at 10:30am
Crystal uses the Mid() function to test if something is contained within another string.
 
I have all the Crystal Reports functions documented with sample code in my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
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
amcb10
Newbie
Newbie


Joined: 10 Jul 2008
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote amcb10 Replybullet Posted: 25 Sep 2008 at 1:56am
Hello and thanks for the reply. However I did actually come here to try and get some help, not have to go buy a book or subscribe to an ebook.

Thanks
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 25 Sep 2008 at 7:12am
I'm not sure how you would do it with the MID function but try the InStr function.  In Crystal, go to HELP and search for InStr.  That page describes the parameters.  You will see:
 
  • InStr (str1, str2)
  • InStr (start, str1, str2)
  • InStr (str1, str2, compare)
  • InStr (start, str1, str2, compare)
Arguments
  • start is the character in str1 where the search is to begin. This is a 1 based index. (This argument is optional.)
  • str1 is the text string to be searched.
  • str2 is the text string being sought within str1.
  • compare is an optional number value indicating which type of string comparison should be used. 0 indicates case-sensitive comparison, and 1 indicates case-insensitive comparison. If this argument is not used, a case-sensitive comparison is performed.

Hope this helps.

 
 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.