Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Partial String Search Post Reply Post New Topic
Author Message
ES22
Newbie
Newbie


Joined: 24 Jan 2007
Online Status: Offline
Posts: 2
Quote ES22 Replybullet Topic: Partial String Search
     Posted: 24 Jan 2007 at 6:30am
I created a parameter in my report where I want the users to enter partial text and get the result. For example, the field is 5 character long. User can enter 2 or 3 character and get the desired result.

This is the data in the field - WWY1D

So user can enter WW, WWY, WWY1, WWY1D and get the matching records. I also want to force the user to enter atleast 2 characters. How can I do this? I am using Crystal 10.

Thanks
-ES
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Jan 2007 at 10:34am
You have to use a record selection formula that uses the Left(data field) function to just get the first few characters of the field and you also have to use the Len(parameter name) function to see how many characters the user entered in the parameter.

This involves a few steps:

1) Create a parameter and set the minimum length to 2 (found at the bottom in the Options section). For this examplanation, I called mine "Name Filter".
2) Create a record selection formula and use the following syntax (substituting your own field names) and I used the Customer Name field as my data field.
//Crystal Syntax
Left ({Customer.Customer Name}, Length({?Name Filter})) = {?Name Filter}


HTH,

Brian B
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
ES22
Newbie
Newbie


Joined: 24 Jan 2007
Online Status: Offline
Posts: 2
Quote ES22 Replybullet Posted: 25 Jan 2007 at 8:27am
Thanks a lot Brain.. that worked like a charm..:-)
IP IP Logged
bandarna
Newbie
Newbie


Joined: 02 Oct 2012
Location: United States
Online Status: Offline
Posts: 10
Quote bandarna Replybullet Posted: 07 Oct 2012 at 9:21am
Hi,
My requirement is same as described in this thread. I ma using XI where can I write this code.
 
can you please explain step by step.
 
 
thanx
New CR Developer
Regards
~NB
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