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!

Wildcard with Parameter

Status
Not open for further replies.

piovesan

Technical User
Jan 23, 2002
159
CA
Hi all...... I have been reading many many posts on this question, but I still can't get mine to work... it should be simple but I am trying many ways and not getting anywhere. I am using Crystal XI

I created a paramater called {?BuildingName} and I want the user to ENTER text rather than select from a drop down of attributes. But I want the text that is entered to find the Buidling Name from the BL_Name field that is "like" what they enter......... so, my parameter is static, and I enter no values... and I allow multiple values....... then in the select statement, I have tried:
BL_Name like {?BuildingName}
But this only works if the user enters the '*' themselves in the parameter........ I don't want the user to have to enter this....... so I have tried:
BL_Name like "*"+{?BuildingName}+"*"
(which just gives me ALL data)
and I tried:
BL_Name} like "*{?BuildingName}*"
(which gives me no data)
and I have been trying a combination of things like this but nothing seems to work....
Help?
Thanks!
 

The problem is when you allow multiple values in the parameter.

Create a formula called Include:

Code:
whilereadingrecords;
stringvar array v_parameter := {?My Parameter};
booleanvar v_include := false;
numbervar x := 1;

while x <= ubound(v_parameter) and v_include = false

do

(if {BL_Name} like "*" + v_parameter[x] + "*"
then v_include := true;
x := x + 1);

v_include

Then your selection criteria becomes : {@Include} Is True

This forces record selection to be done in the report, which can be inefficient. If that's a problem with your dataset then post back here with specifics and we can try something else.


 
Yeah, I would rather not have the selection done in the report.... isn't there just a wild card "*" that I can put into the selection???
 

This could get a bit nasty - first of all, what is your backend database? And is there any policy in place that disallows the use of dynamic SQL?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top