Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a contains function in Cry

Status
Not open for further replies.

ronnutter

Technical User
Aug 30, 2001
15
US
Is there a contains function in Crystal. I want to search on a string field that contains a certain phrase.

ex.
record1 - abc glen street, 23456
record2 - xyz glen street, 23457
record3 - glen 12457 st., 23456

i want the search to contain 'glen' so it will pull all three records.

thanks,
 
For your select expert use:
"glen" in {address.field} Mike

 
InStr("string") will return the character number, as an integer of where "string" is first encountered. If it is not encountered it will return a zero.

InStrRev() works much the same way only it starts at the right of the string instead of the left.

Hope this helps. Software Support for Macola, Crystal Reports and Goldmine
 
thanks for the responses:

a KISS approach is to use like in the select expert.

{bill_address.address} like "*glen*" for the above example.

thanks,

 
I've had problems with the like function when the field I was checking had variable length strings. Mike

 
Try them all and see which works best. Usually when a Variable length string is a problem, it means that CR is reading it as a Memo field and can't process it in any formula. If that is the case then none of these approaches will work. See faq149-276. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top