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!

Wildcards 4

Status
Not open for further replies.

bddsolid

Programmer
Jul 20, 2004
19
BE
Hi,

I tried to use wildcards in the parameter field window, but I get a wrong result... I used the * wildcard.
Is it possible to use wildcards in the parameter field window? If possible, which?

Thx!
 
Which version of Crystal?

I've never tried using wildcard parameters. If there is no direct way, you could get the same effect by adding the parameter to a wildcard value in a Formula Field

Madawc Williams (East Anglia)
 
Make sure the Record selection formula is set up to use wildcarsd i.e.

{Table.Field} like {?MyParam}

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
Wildcards will work, but your selection formula must be setup to use the like statement (as Gary states). * for multiple characters, ? for a single character i.e. to return all values where the third character is a 'S' with any characters after that;

{Table.Field} like "??S*"

Peter Shirley
 
Hi Gary and Peter

I didn't use the like-operator in the Record selection formula but the =-operator.
{Item.ITM_CODE}={?artCodeSelection}
The ITM_CODE is a string.
It seems to be not necessary to use the like-operator.
What do you think?

Thx for your useful help!
 
If you do not use the Like, then the only records with the * will be returned... probably nothing.

The only problem with the Like is, it will query the db when it doesn't really need to when the wildcard * is used.
i.e. the sql send to the db will be something like
... and {Item.ITM_CODE} Like '*' and ...
This is not really need if the db isn't large.

You can do this for a more optimized solution
(if {?artCodeSelection} = '*' then true
else
{Item.ITM_CODE}={?artCodeSelection}
)

The sql Generated when a * is used will be
... and true and ...
The sql Generated when a * is Not used will be
... and {Item.ITM_CODE} Like '*' and ...

Generally I normally use Like because its easy, but on the really slow reports, then I will optimize the code.

Fred

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top