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

Using a paramter and a like statement...

Status
Not open for further replies.

hgraybill

MIS
Mar 30, 2007
32
US
Crystal Reports version 10
Accessing a SQL 2000 database
I have a report with a parameter called {?SMART_CODE} that prompts the user to enter a code. In the field where the code is stored there could be more than one code, for example AA,BB,CC or there could be a single code, AA.

I want the user to be able to enter AA when prompted and have everything with AA be brought up, not just records with only AA entered. I thought I would be able to use a LIKE statement with the parameter, but I wasn't able to figure out how. I'm sure it's something easy and I'm just missing it. Any help is appreciated!
 
From memory this should give you all you want or at least give you a start.{?SMART_CODE} Like["*AA*"]
 
Try this:

{table.code} like "*"+{?smartcode}+"*"

-LB
 
If I put in {table.code} like "*"+{?smartcode}+"*", it give me everything, like the parameter isn't even there.

I haven't tried {?smartcode} IN {table.code}, yet, but I'll let you know if that works.

Thanks,
Heather
 
I was able to make {?smartcode} in {table.code}work for what I wanted to do. Thanks MJRBIM!
 
I'm glad MRJBIM's code worked for you, but my suggestion should also have worked, so I'm wondering how you implemented it, and also what your codes look like and how you are entering the parameter text.

-LB
 
I entered it as a formula under the select expert. I tried a few variations of it, but none worked. It was the only parameter formula, so the code you suggested would be the only code under the parameter formulas. It's a user entered parameter, so when the crystal prompt comes up on the screen, the user enters the smart code, hits add and then ok.

Let me know if you need anymore information.

Heather
 
You can bypass the expert and go to report->selection formula->record and then enter it there--just as shown.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top