How to display only taxonothe terms with nodes associated to in Views 2

drupaldrupal-viewsviews

I've created a view with a set filters exposed (to show filtering options in the page). And one of those filters is a select field with all the taxonomy terms of a vocabulary.

That's ok, it's showing now. But I want to only show the taxonomy terms that have at least one node associated to it. To avoid empty results if selects an empty term.

Anyone knows how to do that?

Thanks.

Best Answer

Solution in views 3 (which may work in views 2)

Set a relationship for the view to join the terms to the nodes (in views 3 this is 'Taxonomy term: Content with term')

Then in the options tick 'Require this relationship' (this excludes terms without any nodes)

This may produce duplicates, in views 3 you open up Query settings, and tick Distinct (this will omit duplicates)

Related Topic