1

Sorry to be yet another question about entry reference relationships in views, but I can't find the answer in pre-existing questions.

Given:

  • the content type "page" has an entity reference field "artref" that references multiple nodes of the content type "article"

  • the content type "article" has a boolean field "fishy"

How do I create a view that shows all pages which reference at least one article where fishy is checked.

I understand that here are 4 relevant settings:

  • the basic entity bundle (pages or articles) selected for the view

  • the relationship type ("content referenced from" or "content using")

  • "require this relationship" setting

  • Aggregation, especially if "distinct" is a possibility

All advice much appreciated

1

I figured it out. Configure in this sequence:

  • Show: "content" of type "page"
  • Relationships: "Content referenced from art_ref"
  • Use Aggregation: Yes
  • Add filter criteria: fishy, Aggregation: "group results together", relationship: "art_ref:content", operator: "is equal to" "1"
0
  1. Create new content type,for example, "Article_1",having "fishy" field of boolean type.

  2. Create new content type "Page_1",having entity reference field "artref" to "Article_1" content type. Values - unlimited.

  3. Create new View with filter criteria Content:Type="Page_1".

  4. In view "advanced" section add Relationship:"Content entity referenced(not referencing) from field_artref". "Require this relationship" you may live unchecked.

  5. Add new filter criteria is based on "fishy" field = "Yes", for example.("Yes" is "On value" and "No" is a "Off value" for boolean "fishy" field).

  6. Set relationship for this filter criteria to "Content entity referenced from field_artref".

  7. In "advanced" section open "Query settings:settings" and set to checked "Distinct" checkbox.

  • Doesn't work for me, on simplytest.me with D8.0.1. Distinct fails to remove the duplicates (repeated page listings in the view results for pages that reference more than one fishy article). – Jonathan Dec 6 '15 at 11:28
  • Yes, I've just checked up. Distinct really doesn't work. (I meant D7 in my previous answer). Well,just turn on aggregation in advanced section. And then click aggregation link near FIshy filter criteria and choose somethin like "count distinct" from drop down box. – jvb Dec 6 '15 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.