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

Wildcards, Parameters and ALL 3

Status
Not open for further replies.

MRWARNER

Technical User
Nov 6, 2003
20
US
Here is my code for Parameters that will allow a one or all type search with the (one) being a wildcard search.

Code:
('*'+{?Name}+'*' LIKE {@Name} OR {?Name} = "ALL") AND
('*'+{?Insureds}+'*' LIKE {@ssn} OR {?Insureds} = "ALL")

I am using Crystal Reports 9 - When I use this with the WildCard "*" surrounding the parameter I get no results. If I remove the "*" and enter exact match to field data or ALL I do get results.When I enter "*" in the Param Dialog box I get no results.

This suggestion for coding came from the Crystal Decisions Forum site. I also based the coding on TekTips thread 149-813765 which was very helpful.

Am I doing something wrong?

Maybe there is another way?
 
Try:

({@Name} like '*'+{?Name}+'*' OR
{?Name} = "ALL") AND
({@ssn} like '*'+{?Insureds}+'*' OR
{?Insureds} = "ALL")

This should work as long as the parameters are set up for single values.

-LB
 
Perfect - This works great, and yes these are single values

Thanks a bunch

I am curious though, why would it behave differently when all that was done was to flip flop field name and parameter?


 
The wildcards only cound on the right hand side of a like.. the left hand side is literal.

Lisa
 
I didnt know that - OOh thank you so much. This may resolve some other issues I was having.

Very Good!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top