?
Solved

How to enter a Like parameter

Posted on 2014-08-20
11
Medium Priority
?
182 Views
Last Modified: 2014-08-20
How do I set up a parameter so that users can enter query like %abc% or ABC%
Gordon
0
Comment
Question by:GiaHughes
  • 6
  • 4
11 Comments
 
LVL 18

Assisted Solution

by:vasto
vasto earned 200 total points
ID: 40273482
set your record selection formula to
<field> like '%' + {?Parameter} + '%'

you may try also to replace % with *
<field> like '*' + {?Parameter} + '*'
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 40273580
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
 

Author Comment

by:GiaHughes
ID: 40273834
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
LVL 101

Expert Comment

by:mlmcc
ID: 40274044
Try it this way

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

mlmcc
0
 

Author Comment

by:GiaHughes
ID: 40274080
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
 
LVL 101

Accepted Solution

by:
mlmcc earned 1800 total points
ID: 40274160
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
 

Author Comment

by:GiaHughes
ID: 40274345
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
 

Author Comment

by:GiaHughes
ID: 40274347
Sorry
Forgot to upload
Gordon
Task-Contents-V1.rpt
0
 

Author Comment

by:GiaHughes
ID: 40274356
Hi mimcc

I think it works if I use * and not %

Gordon
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 40274442
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
 

Author Closing Comment

by:GiaHughes
ID: 40274846
Excellent as usual
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question