Closed (fixed)
Project:
Relation
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 May 2011 at 16:48 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
chx commentedWell, it would be possible to create an integration which allows to retrieve C and D in separate rows -- in one row, that might be very very tricky due to SQL mandating a fixed number of columns.
Comment #2
jdelaune commentedYeah separate rows is fine. I know how to do this in SQL but I'm not sure how one would go about it within Views or if support is even there for it. You would do a JOIN to find the endpoint of A (B) and then do a subselect to get any B endpoints to find C and D.
Comment #3
Seraphin42 commentedAnd is it possible to add in views a relationship like this : i'm the node 1 and i want to find each content related to me (1) ?
Actually, with the relationship, I get all contents related to my content type.
I don"t know if i'm clear, and maybe I need to learn a little bit more how views and drupal works .. but I've a very newbie point of view.
Comment #4
naught101 commentedI'm having difficulty figuring out how views even could be used in a meaningful way with relation. I mean, what if your relations are relating nodes to users or something? How will the view display the data? Would you use a node view, or a user view? I could really use a detailed use-case, if anyone can think of one (using A and B without defining some example entity types is just confusing to me).
Seraphin, you may be running in to #1147976: Relationships always required in views
Oh, and subscribe +1
Comment #5
dpiIt seems the views integration shows all predicates that are related. Instead of limiting to the predicate selected in views relationship. Unsure if this is because of #1147976: Relationships always required in views.
Comment #6
ofridagan commentedsubscribing
I'm actually wondering if there is any integration for views in relation...
Comment #7
Daniel _Bun commentedYES
subscribing
I'm actually wondering if there is any integration for views in relation...
..
Comment #8
alanom commentedI believe you can do jdelaune's original request this in Views and Relation as they stand. Please correct me if I've misunderstood anything, this seems to work for me in basic testing.
Use case: a family tree. Granny Greta [nid:1] is parent to Mama Mary [nid:2] and Papa Peter [nid:3]. Mama Mary is parent to Lil Lucy [nid:4], Papa Peter is parent to Small Simon [nid:5] and Tiny Timothy [nid:6].
We're putting a Views block called 'Grandchildren' onto Granny Greta's page /node/1
So, views takes nid 1. In the contextual filter, for each node that has a Parent relationship to nid 1 (nids 2 and 3), it runs through the fields. Since these are also set to use the relationship, it shows each child of nid 2, then each child of nid 3. End result:
Grandchildren:
**************
Lil Lucy
Small Simon
Tiny Timothy
This seems to work for me but I only did very basic testing. Note that this can show duplicate fields if you've got a relationship structure where it's possible for x ->- y and y ->- x or x ->- a ->- y and also x ->- b ->- y. If you wanted great grandchildren or beyond... then my head starts to hurt, maybe you could do it with a bunch of nested attachment views?
Comment #9
chx commentedBy now, the only reason this didnt work was the artificial step of not adding views relationships from nonbinary relation types. The attached dump lists four siblings for me.
Comment #10
chx commentedComment #11
pkcho commentedThanks for fleshing this out a bit.
I was encountering duplicate results in blocks probably due to what you explained x > y and y < x, but I wasn't sure how to filter the view to allow for only unique instances.
Anyone have a clue?
Thank you,
Joe
Comment #12
chx commentedThere's a distinct in views...
Comment #13
alanom commented...in Views UI 'distinct' is a checkbox hidden under 'Query settings', it gives a similar effect to the old D6 module 'Views Exclude Previous'. (took me a while to find it after upgrading)
Comment #14
pkcho commentedthank you! that helped.