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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal reports using wild cards

Status
Not open for further replies.

Vmarria

Technical User
May 6, 2002
8
US
I'm using crystal reports 8.0 to create a simple report. I want to search a comments field in the database and return any records that contain that word.
For example in sql it would be:

select *
from profiles
where comments like '%t%'

Can i do the same in crystal reports? where the user inputs the value?
 
Yes, you can do this.

There may be complications if the comments field is over 254 characters though and your CR version is below 9.

Create a parameter:

Insert->Field Object-Right click parameters->New

Create a Value Type String parameter.

Create the record selection criteria:

Report->Edit Selection Formula->Record

{MyTable.Comments} like '*'+{?MyParameter}+'*'

If the comments are over 254 characters, create a SQL Expression something like:

substring({MyTable.Comments},1,254)

And use this SQL Express instead of the field (though it will only search the first 254 characters, use multiple SQL Expressions if you need to search it all).

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top