Count Distinct Field collection items in attached views

05/07/2018


I have a content type with a field collection (unlimited cardinality). In this field collection there is a select list with around 40 values.

In a list (filtered by taxonomy) I show multiple nodes of this type. I want to attach a list of all the used values (in all the nodes in the list) and count them.

Example:
Content Type “Textblock” with fields:

  • Textfield “Text”
  • Taxonomy “Type of Text” (Blog, Book, Mail)
  • Field Collection “Mistakes”

  • In the field collection “Mistakes” I have a list of mistakes (grammar, spelling, facts).

The basic list is generated as a view with the argument of the term id.
On a listing of all nodes with the term “blog” I want to have a list of mistakes:

  • 4 Grammar
  • 3 spelling
  • 22 facts

Each node can have multiple grammar mistakes. (node 1 has two, node 2 has one, node 3 has none, node four has one => 4)

How can i do that?

My way of thinking was:
– Use a views attachment below
– Get the “mistakes” field
– Use aggregation and let views count that

But whatever I tried in views I do not get that to work. I would really appreciate any directions. Thanks in advance.

قالب وردپرس