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
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
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%')
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%')
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 :(
So the problem is not solved :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Workaround
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 =)