Question

So I haven't yet been able to find a solution to this without using a preprocess function to check for duplicates or just using the 'tagadelic' module.. it'd be nice to get some closure.

How do I configure a (block) view to only display a list of terms for a vocab, each term displayed once (maybe followed by a number indicating how many times it's used) - even though the term may be used by multiple nodes? 'Distinct' doesn't do the job.. Fields 'Taxonomy:All terms' and 'Taxonomy: Term' both yield similar duplicate item when the term is reused by another node.

It's a fairly basic request, I'm sure I'm missing something but can't find a solid answer for dealing with it in views

Was it helpful?

Solution

I think you're using a Node view instead of a Term (Taxonomy) view. So you're pulling in nodes and getting the tags associated with them. Since multiple nodes can have multiple tags, you're getting duplicates. I think the "Distinct" doesn't work because it's checking the Nodes to make sure they're distinct, not each field you add to the view.

So instead, try creating a view and choosing the Term type, instead of Node. I put together a very simple view without even using Distinct and I have no duplicated values, even though each term is definitely used on more than one node.

I don't know how you would do the count next to each term using Views, but I know the Advanced Taxonomy Blocks module does this.

OTHER TIPS

Using aggregation is the answer!

Enable 'Use Aggregation' (hidden under the 'Other' section of 'Advanced'), then you can set fields to 'Group results together' and only one distinct term will display. Make sure you have removed all sorting criteria, as they cause conflicts. You can also use aggregation to display the number of results, by adding a duplicate field and setting the aggregation type to 'Count'.

Here's a good screencast about the whole process.

Are you creating a Term view, a Node view or something else? I was able to create a Term view which by default simply lists all terms (terms listed only once). You could then filter by vocab, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top