How to enter a Like parameter

How do I set up a parameter so that users can enter query like %abc% or ABC%
Gordon
Gordon HughesDirectorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vastoCommented:
set your record selection formula to
<field> like '%' + {?Parameter} + '%'

you may try also to replace % with *
<field> like '*' + {?Parameter} + '*'
0
mlmccCommented:
Create a string parameter

You can use the parameter in 2 ways to do the like
1.  Have the user add the wildcard before/after the text they enter
{YourStringField} LIKE {?StringParameter} 

Open in new window


2.  Add the wildcard in the select expert
{YourStringField} LIKE "*" & {?StringParameter} & "*"

Open in new window


mlmcc
0
Gordon HughesDirectorAuthor Commented:
Ok, just to complicate I would like the user to have the option of selection ALL or enter a string with the wildcard

So I have created a parameter called  Task Selection and have added values ALL and Enter Part Number with Wildcard %

Now normally I would create a formula the says, Called maybe @Task
If {tasknum] is 'ALL' then 1 else 0

And then in the selection would add @task and say is equal to 1.00

So how and where do I put the {TASK.TASKNUM} LIKE {?Task Selection}  value

Sorry to act thick
Gordon
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

mlmccCommented:
Try it this way

{?Task Selection} = 'ALL' OR {TASK.TASKNUM} LIKE {?Task Selection}

mlmcc
0
Gordon HughesDirectorAuthor Commented:
Hi mimcc

Ok have created the formula
@SelectTask
{?Task Selection} = 'ALL' OR {TASK.TASKNUM} LIKE {?Task Selection}

How do I add this to the selection
Gordon
0
mlmccCommented:
Just use that as the selection.

I assume you have other selection criteria?
If so add it as

Existing Selection Criteria
AND
(
{?Task Selection} = 'ALL' OR {TASK.TASKNUM} LIKE {?Task Selection}
)

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gordon HughesDirectorAuthor Commented:
Hi mimcc
Ok I added the statement to the selection formula
It works if I select ALl but does not work if I use the wildcard, if I add the full task number it works
Have included the report

Gordon
0
Gordon HughesDirectorAuthor Commented:
Sorry
Forgot to upload
Gordon
Task-Contents-V1.rpt
0
Gordon HughesDirectorAuthor Commented:
Hi mimcc

I think it works if I use * and not %

Gordon
0
mlmccCommented:
Crystal uses the * as the wildcard and will change it to the database wildcard character when it passes the SQL to the database.

mlmcc
0
Gordon HughesDirectorAuthor Commented:
Excellent as usual
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.