Link to home
Start Free TrialLog in
Avatar of simonwidjaja
simonwidjaja

asked on

Howto: LIKE statement in views arguments?

Hi.
When using arguments in views of drupal I can implement some kind of filters.
E.g.: Get only nodes with specific title.
The generated SQL query uses a "=" (equal) operator. So the user has to enter the exact title he is looking for. I want to change the "=" to the LIKE-operator. But I have no clue how to do so.
Any ideas?

Thanks in advance.
Simon
Avatar of ConUladh
ConUladh
Flag of Ireland image

LIKE '%Operator%' instead of = Operator

The '%' stands for any number of characters, 0+
You can have the % at the start, at the end, both or not at all (which would make it the same as =)
Sorry this might be clearer:

LIKE '%text%' instead of = 'text'

The '%' stands for any number of characters, zero or more
You can have the % at the start, at the end, both or not at all (which would make it the same as =)

You might want to take into account case sensitivity as well by using UPPER() or LOWER() on both sides of the operator.

e.g. UPPER('%text%')
Avatar of simonwidjaja
simonwidjaja

ASKER

I know the SQL-Syntax for the LIKE-operator. My problem is the interface to setup the view. Or to be more specific the arguments of the view. There is no option to change the "=" to LIKE.

So the problem is not solved :(
ASKER CERTIFIED SOLUTION
Avatar of Thomas4019
Thomas4019
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Workaround