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!

Using parameters in 'IS LIKE' selections

Status
Not open for further replies.
Apr 11, 2008
68
GB
I am working on a report where I want to add a parameter that allows the user to select a value from a list.

I then want to use that selected parameter value within the selection formula to compare against values in a field, as an 'IS LIKE' condition.

However, I'm stuck as to whether this is possible or if it is, how to do it.

By way of example:

Parameter: Select the 'bed size' you want to report on:

40 - 4'0"
46 - 4'6"
50 - 5'0"

Selection condition: Take the value selected (i.e. 40) and use to compare against values on an 'IS LIKE' basis:

Camara 40 4 Drawer Divan
Luxury 50 Divan
Divine 46 Mattress

This should then only retunr matching records.

Does anyone have any experience of using parameters like this?

I am using CR2008.

Thanks
 
Create a formula field with something like
Code:
@your.param IN {your.field)
Display @FindLike next to the data, to check that it returns 'True' or 'False' as expected.
Then put @FindLike in the selection statement, it will exclude those records for which it is not true.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Thanks Madawc

However, maybe I'm missing something.

I've created a formula called 'Size' using the following:

@{?Bed Size} IN {prodmast.pm_description}

But I can't save it.........

Any help greatfully appreciated.

Thanks
 
The solution depends upon whether you are allowing multiple parameter values. If you are not, you can use Madawc's approach:

{?bedsize} in {prodmast.pm_description}

Or you could use:

{prodmast.pm_description} like "*"+{?bedsize}+"*"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top