I have a View that is showing Taxonomy:All Terms in the fields display. I'm then filtering to a specific vocab and also to a specific term id in that vocab. This allows for the above mentioned "all terms" to be displayed per this filter. I only want terms associated with that filtered term to display.

It works but it's giving duplicate terms in my preview and resulting block view, since the terms are repeated on the site obviously from node to node. So the view is returning multiple node results obviously and then it's showing the duped terms in my field display. I've looked at a lot of posts on this issue and nobody has really solved it. I'm just wondering if anyone has suggestions for how to get rid of duplicate terms in a block view from the programmatic level since it doesn't look like Views can do this out of the box.

Any suggestions?




goodsanket’s picture

use distinct field in basic settings. Might help you out.

But I will strongly recommend not to use this, there is always a better way to go about it, rather then using distinct.

ambientdrup’s picture

No, that doesn't work. Already tried using distinct and reducing dupes. Neither works.

So you mention a better way to go about it - any other suggestions regarding this?



goodsanket’s picture

I created a view like this

fields: Node: Title
Filters: Taxonomy: Term (exposed)
Taxonomy: Vocabulary (exposed)
This was giving me duplicates as you said, but if i used distinct, it started showing me results only once. Don't know why it is not working for you.

ambientdrup’s picture

I'm not using Node:Title in the fields. I'm displaying Taxonomy Terms in the fields - I want the user of the site to click on the Term name, not the node title.


ambientdrup’s picture

The other weird thing here is that I expose both of the filters but when I view the block as an anonymous user I can't do anything to it - as far as selecting a different term. I thought that's what the expose did?


tpainton’s picture

Same problem.. This isn't a bug but rather views doing exactly what it's being told to do. Its simply returning nodes that have the same taxonomy term and therefore you're getting duplicate taxonomy terms.

This might help you if you don't have to use a taxonomy field..

Does no good for me because I need to create a link from the term which is custom and I can't do that with a Summarize view, only a field view.. sigh.

If you find a solution that allows you to use a taxonomy field instead of the view summary when argument not specified and it reduces duplicates, you will make my day.

ambientdrup’s picture

Yep, I'm looking for the same thing. I have to use taxonomy field. That's the entire point for our site. Hopefully this will get resolved in Drupal 7/Views 3??


tpainton’s picture

I'm not sure it will suit your needs but I developed a work around that doesn't use extra php. I use a node reference as the link between a node and a taxonomy term then use unique fields to keep the taxonomy terms from forming duplicates.. I then reference the node that holds the taxonomy content field with other nodes.. It's a many to one relationship so it eliminates duplicates.

See this thread. It might help you. I posted my entire epiphany there.

DigitalFrontiersMedia’s picture

I know this is an old thread, but just agreeing with tpainton and documenting in case others may find this useful, but "distinct" can do exactly what it's supposed to do and still give duplicate items given the scenario. If it's a node view, it's showing you distinct nodes (i.e. no duplicated nodes), fields WITHIN the node that have duplicates of those found on other nodes cannot be reconciled with "distinct" in this way. This is basically a misunderstanding of what the function does and how it constructs the SQL.

Web: http://digitalfrontiersmedia.com
Cell: 941.773.2036
Phone: 941.677.DFM1 ( 941.677.3361 )
Skype: DigitalFrontiersMedia
Twitter: DigitalFrontier

michielkenis’s picture

Ok, I get this. But how do I solve this pain in the ass. I really need Drupal just to show 1 result!

kjv1611’s picture

1. Start a new thread/question. This one is over 2 years old. A LOT has changed in 2 years. Do yourself a favor, and start a brand new discussion/thread/forum post.
2. How about telling us:
1. What you're doing
2. What you're expecting from what you're doing
3. What error message(s) you are receiving, if any.
4. What you are getting other than error messages
5. What version of Drupal
6. What web browser
7. Anything else you can think of.

The more detail you give, the more likely it is someone can actually help you. Just saying something is annoying is not going to get a real answer.

Now, My GUESS is that you're saying you have the same or similar issue as the original question - 2 years ago. But your situation could be different. For instance, you may be using Drupal 7 instead of 5 or 6; you surely are using a newer version of Views as well, and so forth.

What taxonomy/tag/term - related modules are you been using? In this case, that'd be very important as well - are you just using core modules, or did you install any others?