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

selecting on a parameter (Like) 1

Status
Not open for further replies.

BlurredVision

Technical User
Aug 6, 2001
326
GB
I have the following select statment, which fails if the user doesn't enter more then one value for the parameter. Does anyone know of a cleaner way of doing this?

Using BOXI against sql


if {?Location}[1] <> "" and
{Name} like '*'&{?Location}[1]&'*' then true else
if {?Location}[2] <> "" and
{Name} like '*'&{?Location}[2]&'*' then true else
false

Many thanks
 
You could use:

(
(
ubound({?Location}) >= 1 and
{Name} like "*"& {?Location}[1]& "*"
) or
(
ubound({?Location}) >= 2 and
{Name} like "*"& {?Location}[2]& "*"
) or
(
ubound({?Location}) >= 3 and
{Name} like "*"& {?Location}[3]& "*"
) //etc.
)

-LB
 
Duh.. always forget about ubound..

That did it.. many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top