Hi,
I created a content type with cck with a field for ZIP code, eg. 96052. Now I try to use "Views Module" to get a list of all entries which are filter with the first number ( in my example "9").
If I use an ordinary argument with the ZIP field, the whole string will be filtered, but I want just the first char (number).
How do I get a SQL query result which looks like field_zip LIKE '9%'.
I played with "Argument Code" and add an % to the argument, but this is not working.
Can someone give me a hint how to work with prefixes or suffixes within arguments?
In the Views argument configuration, I have two fields: Wildcard and Wildcard Sub. Is this the right way to solve my problem? (I didn't found much documentation about it)
Ciao...
Comments
BUMP What the hell does wildcard sub mean....
I see no documentation.
I am trying to do the really simple taxonomy argument and tried a whole mess of different things.
I tried
view/taxonomy/$3 (because i want to show posts with tax id 3)
view/taxonomy/TID/3
view/taxonomy/TID/$3
view/tax
and tried each of the above with
wildcard = TID, $, or nothing
and wildcard sub = 3 or nothing.
Can someone point us to some documentation or create some documentation on the spot. ;-)
Thanks in advance.
solution
view/taxonomy/$arg does the trick. Sometimes it's quicker to look at the code than search the documentation.
Not yet clear
Sorry, but this is not yet clear to me.
What do I need to put in "wildcard" and what in "wildcard sub"?
Could you please provide an example?
OK I get it
The wildcard and wildcard sub is only really used if you specify a certain term you will use in the first argument that will trigger a title for the second argument...sort of. You will only rarely use it. Look at the documentation (been updated) for arguments in views module.
If you specify: mypageview/$arg
Then you select OID or term ID or whatever, enter a title in the title field for that argument when want the page to show up, in my case I wrote %1. This means that whatever is passed into $arg will also get passed to the title.
Okay. The trick is (I feel silly for not knowing this before) to finish the view, then type in
www...com/?q=mypageview/71
if you want to specify your OID or term id of 71. Voila.
Check in the handbook
There is the article Views Arguments in the handbook, which gives a fair description of views. It'd be better with some examples though.
I think there is no way to
I think there is no way to do 'LIKE' statments in views.
Is it true???
also looking for a way to do LIKE 'a%' in views
i have a view where i can pass it the argument and it will find what i want, If i pass it 'apple' views finds 'apple'
but is there a way to pass it 'a' and have it return 'apple' and all others that start with an 'a'?
The sql that is generated is reading AND (node_data_field........ = 'a' but i need it to read AND (node_data_field........ LIKE 'a%'
Views Wildcard Argument to get All Nodes starting with numbers
Is there a way for views to do a query like:
$query = "SELECT * FROM nodes WHERE title LIKE '0%' OR title LIKE '1%' OR title LIKE '2%' OR title LIKE '3%' OR title LIKE '4%' OR title LIKE '5%' OR title LIKE '6%' OR title LIKE '7%' OR title LIKE '8%' OR title LIKE '9%'";
I want to be able to get all the nodes with a title that starts with a number . This is how I did it on my previous site without the use of drupal. But now I want to convert the site to drupal to have more functionality.
My test drupal site can be found here http://demo.goldlilys-media.com/past_manga/visible.php . As you can see only one section of the site is almost done. I just need to be able to create a view page that displays and filters all nodes using arguments instead of creating a filter one by one.
Please help!! Thanks in advance.
Visit Goldlilys Media
Hi mr3dblond, I am looking
Hi mr3dblond,
I am looking for the same thing. If I can't find something soon I am most likely going to just grab the SQL from the view and wrap it in my own module. I'd rather not but want to get this done.
It seems like this would make sense to add to the argument options. Make it a check box... 'Use LIKE'.
Any thoughts?
Nick
This may help:
This may help:
http://drupal.org/node/409808
It looks like you can use this views_views_pre_execute hook to modify the query before execution of the view.
Trying this now.
Nick