I have a view with a gmap showing locations within a city, where the cities are taxonomy terms. When I use taxonomy term as the argument the map shows all locations for cities - no term added to the url (example: ../content/map), and only the locations for a city when one city name is added in the url (example: ../content/map/manchester). I am finding it hard to work out how to get the view to show the results for multiple taxonomy terms (../content/map/manchester/liverpool) which would show the results of the two cities.

Apologies if this is a basic question, but is it possible to get the procedure as to how multiple taxonomy term names can be used as arguments? Searching the threads has lead to confusion. I have tried using term id as the argument and then tried php code I found in the threads to convert the term name to term id. Nothing I tired has worked so perhaps its another problem, but without knowing the proper procedure its difficult to work out where I am going wrong. Thanks

Comments

Anonymous’s picture

I'm looking for the exact same thing. I am comparing software functionality nodes using views+tables output. I need to have an argument that does "/title1/title2/title3" and then shows those three titles in a listing/table.

But the arguments MySQL query always uses AND operator, like WHERE title=title1 "AND" title=title2. Which is useless - shouldn't it be "OR" by default?

Anonymous’s picture

In the code of views_handler_arguments, I read this:
checkbox: "Allow multiple arguments to work together."

That sounds like what I need. But where to find this in the UI...?

figover’s picture

Follow these steps

1)
Try Views Or Module
http://drupal.org/project/views_or

2)
View Or module is working very fine for views filters not for views arguments

Create view through php code and change filter value at run time. Then filter will work like arguments.

tjb74’s picture

The Or module is an interesting option, but the post was to ask how to pass term names as opposed to id numbers to the view. Most of the uses I have at the moment, the arguments will be passed from Viewfield where the editors can add comma separated keywords for the view to display (the keywords in the above case correspond to taxonomy term names). In my case the operation is an AND, but I am unable to pass the names as arguments. There is no way the editors will be able to work out the Term Id numbers so I imagine the view has to convert the term name into a term id? I am missing how to do that. Thanks

merlinofchaos’s picture

Status: Active » Fixed

Did you pick a random version number? 2.0 rc5? WTF.

In the argument, under validation, select the taxonomy term validation and choose the validation options that will accept term names and tranform them into term IDs.

tjb74’s picture

Version: 6.x-2.0-rc5 » 6.x-2.6

Sorry about version number, no idea why it went to that - will take more care in future. Thanks for the explanation, which is something I had tried and have tried and tried again. And still not getting the results. The view return only the results for the first term in the argument.
My set up is: Argument: Taxonomy: Term ID. Action to take if argument is not present: Display all values. Validator: taxonomy term. Vocabularies: relevant checked. Argument type: Termname/synonym coverted to Term ID. Allow multiple terms per argument: checked. In the Live preview I separate the taxonomy terms (city names) with /. I am needing and testing this with Gmap views.

Query

SELECT node.nid AS nid,
node_revisions.title AS node_revisions_title,
node_revisions.nid AS node_revisions_nid,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_summary.field_summary_value AS node_data_field_summary_field_summary_value,
node_data_field_summary.field_summary_format AS node_data_field_summary_field_summary_format,
location.longitude AS location_longitude,
location.latitude AS location_latitude,
location.latitude AS gmap_lat,
location.longitude AS gmap_lon,
node.type AS gmap_node_type
FROM node node
INNER JOIN term_node term_node_value_0 ON node.vid = term_node_value_0.vid AND term_node_value_0.tid = 133
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
LEFT JOIN content_field_summary node_data_field_summary ON node.vid = node_data_field_summary.vid
LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid
LEFT JOIN location location ON location_instance.lid = location.lid
WHERE (node.type in ('accomm_list')) AND (term_node_value_0.tid = 133)

tjb74’s picture

Status: Fixed » Active

With argument as Node ID and basic validation with Allow multiple terms per argument checked, I can use multiple arguments using the term ID numbers and not putting a forward slash to separate the numbers (3 4 5 and not 3/4/5) unlike the Live Preview arguments box says to do: "Separate arguments with a / as though they were a URL path." However, when I change the settings for validator to be Term, with Argument type: Termname/synonym converted to Term ID, no query is run when I separate the arguments like cityx cityy with no slash. The only time a query is run is when there is a forward slash but takes first term only. I have now tried this on several different Drupal installs.

konrad1811’s picture

I've got the same!
Need to sent argument by term, but there are several arguments (tags from a node) of the same type, so when I send argument %term it just pass the first one.
An wildcards wokrs here in panels?

konrad1811’s picture

I've found we don't have to sent argument when using context... However context seems not to pass all terms hidden in an argument (dictionary tags)

esmerel’s picture

Status: Active » Closed (fixed)

This issue is a year old, it's likely either resolved or no longer relevant.

mdotcomegypt’s picture

Status: Closed (fixed) » Active

sending arguments like arg1/arg2 uses AND

How to send the argument to use OR not AND ??

khalor’s picture

After prowling the issues queue it looks like your only options are to either upgrade to Views 3.x or use Views Or

Which begs the question, what does the "Allow multiple arguments to work together" checkbox actually do in Views 2.x ?

iamjon’s picture

Status: Active » Closed (duplicate)

When using mulitple arguments you need to seperate them with either pluses '+' or commas ','

Please take a look at http://drupal.org/node/720422

Marking this as closed please feel free to reopen.

iamjon’s picture

Possibly relevant as well. http://drupal.org/node/1057746