Okay, I am a newbie, so it could be that this is a very dumb question; I can only say that I have spent considerable and valuable time playing with the problem, searching this site for similar topics, and reading the Views and CCK Docs, which seem to be stuck in 5.x-land; I feel that this must be addressed somewhere but I just can't see it. Also, I am following the instruction about placing this under CCK because, even though I consider it a Views issue, it is dealing exclusively with CCK-made fields. *shrug* I won't be surprised if it gets moved to Views, though. In case it does, I will state for the record that I'm using Views 6.x-2.0-rc3.
I have created a vocabulary called Platform to indicate the compatibility of the content type that field applies to (the content type always has a downloadable file that is attached to that node, which is what the terms are really being applied to). Platform has three terms, "Mac OS", "Windows", and "Both". An uploader chooses one of these terms and only one, on the submission form. Pretty self-explanatory, right?
I want the user to be able to follow a link called "Mac OS" that actually shows all nodes with either the term "Mac OS" or "Both" applied to them. "So, this should be easy," I thought as I set up Views to take two arguments of type Taxonomy: Term. Both have validators set to "Taxonomy term" and argument type "Term name or synonym", and the links that I use to pass in arguments, e.g. "viewname/Mac OS" work fine when I only use one argument. Now, here's the problem: I should be able to use a link such as "viewname/Mac OS/Both" and see both arguments getting used. Now, it seems that using two arguments like that means that the 2nd one is refining the results from the 1st one, and that will always return nothing since no node shares two of the terms from that vocabulary, but I can't get other symbols like "," or "+" to work at all. I thought I could use Both as a synonym for both "Mac OS" and "Windows" and sneak the "Both" results into tables that filtered for either platform name, but it seems that synonyms... don't do anything; at least, not without a 3rd party module to make them work, and I don't know which one to use that's 6.x compatible. Leaving that issue aside, even when I set the validators to the argument type "term ID separated by , or +", and link to the view using "viewname/1,3", the query result tells me that I passed in "Mac OS, Both", which is perfect, but I get no results. And by the way, the comma separator is just passing two values to the first argument, isn't it? That's a bit unclear imho.
So, basically I can't think of any way to include "Both" nodes in searches for the other two platforms that both works internally and is clear for the end-user.
P.S.: Removing "Both" and allowing the uploader to multi-select from just the two terms, "Mac OS" and "Windows" is not a good fix, because I show the view's results in a table that lists all applied terms on each node, and I prefer to keep the term list succinct. It only shows three terms for each node (one that was chosen from each of three vocabularies, one of which is Platform), but this fix would replace one term with two from the same vocabulary, which is a bit confusing, as it would say "Windows, Mac OS, [two other terms that are completely unrelated to platform compatibility]".
P.P.S.: Not that I want to do this, but I am thinking of showing two checkboxes on the submission form instead of a taxonomy menu, with the names "Mac OS" and "Windows", then setting up the view to look at those fields' values instead. But I'd first like to know if my problem has a simpler fix; I would think it must!
Comments
Comment #1
yched commentedReally sorry, but you wrote a novel, I have little time for this.
Can you shorten it up ?
Comment #2
Iritscen commentedYou know what? I really think this is a Views issue; I put it under CCK because CCK-made fields were part of the nodes I was filtering, but I don't think that makes it a CCK issue. I'm not actually filtering by the fields I made with CCK, but rather by content type and taxonomy. So I'm moving it to Views (but I have no idea what Component to put it under). Still, it's true that I may have been too verbose, so here's a synopsis of my novel:
I can't figure out how to use URLs to get Views to show me results from multiple arguments. "viewname/arg1/arg2" only refines results from arg1 using arg2, it's not additive; I want the results of both arg1 and arg2 (which are taxonomy terms in the same vocab). I tried "viewname/arg1+arg2" and "viewname/arg1,arg2" and get no results. Both arguments work fine on their own.
Comment #3
merlinofchaos commentedYou are correct, this is Views and not CCK, and what you're doing is somewhat difficult. It may be that the reality is that since you have such a very small vocabulary that you just want to create two different views (Or one view with two displays), forego the use of arguments entirely, and use a customized filter; i.e, viewname/macos is one page display, and viewname/windows is the other. Both of them have the taxonomy: Term filter, the first with 'macos' and 'both' selected, and the other with 'windows' and 'both' selected.
That said, let's go through the list of things you tried and explain what happened.
1) Using two arguments is always an AND, never an OR. In fact, this is the basis of your problem: Views treats everything as an AND. It has very limited capabilities for OR. It just so happens that taxonomy: Term is one of those capabilities but only if:
2) ...you use the + operator. However, the + operator works *only* with the numeric form, and the validator transform doesn't transform named values to numeric using the + or , operators. Thus, attempting to do viewname/macos+both doesn't actually work. Doing viewname/1+3 (assuming the TID for macos is 1 and the TID for both is 3) should work.
Comment #4
Iritscen commentedThanks for your reply. Your explanation was quite clear, so even though I thought I'd tried using IDs and the + sign, I tried it again. Still no results. I don't know if this helps, but here's the feedback the Live preview section gives me:
(the argument input I provided was "1+3" (no quote marks))
Query
SELECT node.nid AS nid,
node.type AS node_type,
node_data_field_creator.field_creator_value AS node_data_field_creator_field_creator_value,
node_data_field_creator.nid AS node_data_field_creator_nid,
node.title AS node_title,
users.name AS users_name,
users.uid AS users_uid,
node.changed AS node_changed,
node.vid AS node_vid,
node_data_field_creator.field_version_value AS node_data_field_creator_field_version_value,
node_data_field_creator.field_needsglobalization_value AS node_data_field_creator_field_needsglobalization_value
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_node__term_data ON term_node.tid = term_node__term_data.tid
LEFT JOIN content_type_file node_data_field_creator ON node.vid = node_data_field_creator.vid
INNER JOIN users users ON node.uid = users.uid
WHERE (node.type in ('file')) AND (term_node__term_data.name = '1+3')
ORDER BY node_title ASC
Title Mods (filtered by "Mac OS + Both")
Path This display has no path.
As you can see, it translated 1 and 3 into the correct filter names. The title I made is originally "Mods (filtered by "%1")", so everything seems to be proceeding normally.
Perhaps my usage of Views is nonstandard and I should go ahead and use your suggestion as to separate page displays. I'm sure that approach would work and it's not much trouble to implement. I guess I'm still curious about what is going wrong with the above approach, though.
P.S.: Should I have the "Allow multiple arguments to work together" box checked for the argument I set up (Taxonomy: Term)? FYI, I've tried this with the option on and off. And I *do* only need one argument set up, right?
Comment #5
merlinofchaos commentedHm. It's trying to filter by term name:
term_node__term_data.name = '1+3'That means you've go the wrong argument. Be sure the argument is "Taxonomy: Term ID". "Taxonomy: Term" will not support numeric arguments.
The title is probably accidentally right due to the validator. The validator sets the title to save a query since it already had to look up the information, and the argument itself sees that the validator did this and doesn't do its own title checking.
I'm pretty sure that'll fix that part of the issue.
I think you'll end up with more satisfactory results, at least on this one, with the original solution I suggested; just because the URLs will be cleaner.
Comment #6
Iritscen commented*smacks forehead* Thank you, I changed the Argument to Taxonomy: Term ID and it works fine.
I was still using argument Taxonomy: Term as described in my first post, er, novel. I was fooled by the validator's interpretation of the IDs into term names, as you guessed. But I actually considered using argument Taxonomy: Term ID at one point, and decided that since Taxonomy: Term was giving me the option under the Argument type menu of using "Term IDs separated by , or +", it would work that way too.
Not that this excuses my mistake, but may I ask why (a) there's two options for Term ID in the "Argument type" menu when configuring an argument of type Taxonomy: Term (since you said Taxonomy: Term does not take numerical values), and (b) why the menu is called "Argument type"? Isn't that already what you'd call the, well, the type of the actual Argument, e.g. Taxonomy: Term? I feel that maybe there's some semantic confusion here as to what that menu does (maybe only on my part!).
Comment #7
merlinofchaos commentedThat's for the validator, not for the term. That's why it's in the fieldset labelled 'validator options'. The trick here is that yes, you can provide a validator that completely does not match the argument. There is limited interaction between the two, and they don't necessarily KNOW about each other. So yes, you can configure a node: nid argument with a taxonomy: term validator, but it won't work. And it would be a significant amount of work to make the UI smart enough to remove invalid options, especially given the pluggable nature of the system.
I'm not sure what else to call it. When using the taxonomy term validator, it's basically specifying what form the argument will be in, so it can validate it properly. Maybe sub-validator would be a better term, but I doubt it.
Comment #8
Iritscen commentedRe your response to (a): understood (well, not fully, but satisfied with explanation :-) And it's true that since the menu is in the "Validator options" section, it is clearly a separate setting at a lower level than the overall argument type.
Re (b): I haven't seen the options the menu presents with all the different argument types that the user can choose from, so I can't make any knowledgeable suggestions; still, since I criticized something, I should attempt to offer a solution, weak though it may be. Maybe "Validation type", "Validation format", "Argument format" (which is more specific than the overall "type") or "Validate as:"? No need to respond to this, just wanted to throw those ideas out there. Thanks so much for your work on this module!
(Changed title because I was confused at the time I made it, and CCK fields are not involved in this (former) issue of mine.)
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #10
Romejoe commentedI got the same issue here. I have an module that is able to pass arguments (DashMediaPlayer) and like the view to output any node that are tagged with either TermA or TermB (arg1 and arg2).
If I add 2 argument options (do I need or is one enough?) Taxonomy:term it seems the output will only show nodes that have BOTH tags (and) but I need to show all that have either.
How do I set it up?
What I do not understand is the checkbox "Allow multiple arguments to work together". Can this be helpful? Tried around but nothing.
(Now found a solution to do it with TermID but I'd really like to use Terms!)
Comment #11
dawehnerThis is quite an old issue. It doesn't make sense to open an existing one. This is just a support question, so there is no reason to reopen this 2 year old issue. Please open a new one
Comment #12
Romejoe commentedSo we should not discuss about Math issues.... Math is too old to be discussed.... really.... r u kidding me?
Where is the difference? Whats better having one post for each issue or having 200 and not finding anything in all that posts? Maks no sense to me but as you wish....