The Relationships feature is very useful for adding an inner join to the underlying query of a view. But what I also need is a way to select all items that are NOT part of the relationship.

For example, using the Relations module, if I want all photo nodes that belong to a certain user and have a relation to the user's album node, I would set:

  • Contextual Filter: Author's uid
  • Relationships: Node's nid

Works great.

BUT, if I want to see all the photos that haven't yet been linked to the user's photo album, I need a negative Relationship, like so.

  • Contextual Filter: Author's uid
  • Relationships: Node's nid [NOT]

Or maybe there's another way to do this?

Comments

dawehner’s picture

Oh i see you want something like JOIN foo ON foo.uid != bar.uid
Interesting, but i think it would be quite hard to provide a generic/all-time-working solution.

dawehner’s picture

Just a slightly related issue: #1043260: Reverse relationship

tomogden’s picture

Referring to the issue above, it looks like what we want might be implemented by implementing the Views hook in within the Relation module. It's mentioned with regard to the Reference module here:

http://drupal.org/node/1188500#comment-4602988

tomogden’s picture

Status: Active » Closed (duplicate)

Relation module now appears to allow reverse relationships. See #1410124: Reverse doesn't work.

giorgio79’s picture

Status: Closed (duplicate) » Active

I would like to see sg native in Views, not in Relation :)

dawehner’s picture

Status: Active » Fixed

It's really not possible to implement that in a really generic way, though for such relationships it's possible,
as you have more context.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Mołot’s picture

Issue summary: View changes
Status: Closed (fixed) » Closed (won't fix)

Changing close type - if it's impossible, then it's not fixed.