For a view I am building i have two node types node A and node B.
Node B contains a entity_reference to one or more of node A.

When selecting all nodes from type node A I want to exclude the ones that are already referenced by any node B.

To accomplish this I added a relation "Entities referencing content through field_name" and made sure the required checkbox is unchecked.

I expected this to list all nodes A so I could add a filter on the now related node B where the field was empty.
Unfortunately the relation automatically only allows the nodes A which actually have a relation to a node B despite my checkbox for required being unckecked.

The query that was generated does change from a left join to an inner join when checking or unchecking the required field but it does not seem to give the result as expected.

Any ideas on how I might be able to exclude nodes that are already referenced?

Comments

dawehner’s picture

Project: Views (for Drupal 7) » Entity reference
Version: 7.x-3.3 » 7.x-1.x-dev
Component: Views Data » Code

This seems to be somehow a question for the entity reference module.

Anonymous’s picture

Ah, sorry about that. Hopefully someone there can point me in the right direction.

sylvaticus’s picture

Same problem here.
In my case I have users (A) that reference nodes (B) trough an Entity field.
Just to add some insight when I browse the user view with the relation "B referenced by A" as admin I can correctly get all users, even those that do not have any B referenced, but when I browse as a normal user only A users with a B referenced get selected... even if I am user XX and user XX doesn't have any B, it doesn't get selected.