Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: char in a String Post Reply Post New Topic
Author Message
Tupacmoche
Groupie
Groupie
Avatar

Joined: 04 Apr 2007
Online Status: Offline
Posts: 52
Quote Tupacmoche Replybullet Topic: char in a String
     Posted: 27 Feb 2008 at 9:30am

I have a vendor name field that has several space characters between the first and second name of the vendor. If a user tries to search for vendors with more than one space delimiter they don't get a match. For example ABC Company is not the same as ABC   Company. The first example has one space between the two names the second has three spaces between the two names. I need an expression that can return any vendor that has spaces greater than one. Something like this:

          CountOfSpaces(MyField > 1, True, False)
Rob
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 27 Feb 2008 at 2:21pm
Hi,
 
Use the following formula
 
formula1
 
StringVar LSt:= replace({Myfield}," ","*");
StringVar RSt:= "";
Local NumberVar i;
 
For i := 1 to length(Lst) Do
If LSt in "*" then
Rst:= Rst + Lst;
//Returns the new string
Rst;
 
this will return the number of * 
 
formula2
then use another formula to find the len of  formula1
 
then in record selection formula check for the len of formula2 greater than 1
 
 
Cheers
Rahul
 
 
 
 


Edited by rahulwalawalkar - 27 Feb 2008 at 2:24pm
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