Happy New Year !

Well folks, I am ready throw in the towel and the year barely began. );

(1) Given three hierarchical node types, "one", "two" and "three" - where each one is pointing back to its parent via node reference ...

(2) How do I display title 1, title 2, title 3 - respectively, from each level ...

(3) That is, I would like to select all nodes of type "one", then drill down to all nodes of type "two" (where type "two" is pointing back to type "one") then drill down to type "three" (where type "three" is pointing back to type "one") ...

(4) The end result would be 3 columns of titles from each of the 3 different node types.

I have googled, I have read and I have watched several screencams.

In most of the examples, child records are not pointing back to their parents but rather the parent nodes have multiple valued references to their children. While there are such use cases, the real world mostly revolves around hierarchical structures such as companies, divisions and departments that require bottom up referencing.

Lots of the tutorials are constructed with a single value being passed in as an argument for node "one" and a filter for node type "two" and it seems some black magic makes a correct join. Others use attachments to generate snippets of sub info. However, I am unable to find a simple 3 table join with columns of output from all 3 tables.

(*) My personal impression is that the Views module is way too sophisticated not to be able to handle my relatively simple case.

Please help.

Comments

merlinofchaos’s picture

Priority: Critical » Normal
Status: Active » Fixed

First, please don't mark support requests critical.

It seems odd that all the examples have parent pointing to child; the situation you describe is the one that I consider the most common.

The answer is to go to the Relationships section and add two relationships, each for your node references. You'll find them under the 'Content' group. When adding the second relationship, select it to use the first relationship so that they chain. That will get you "base" node being the lowest level child, the first relationship is that node's parent, and the second relationship is the grandparent.

Then, add the Node: title field 3 times. Set 1 to use no relationship, 1 to use the first relationship, and 1 to use the second. Preview your view. That should get you the basis for what you want. Add sorts, filters and other fields to taste.

Status: Fixed » Closed (fixed)

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

apaderno’s picture

Title: Multiple Node Relationships ? » Multiple Node Relationships?
mallezie’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Closed (fixed) » Active

Sorry to reopen, but i'm having a follow-up support request, so thought it would be good te reopen this isuue instead of creating a new one.

I follow the above answer, but that returns 3 different fields.

Child 1
Child 2
Child 3
            Parent 1
            Parent 2
                           Grandparent 1

Is there an option to return those as 1 field, so you could aggregate on them to calculate sum of those fields. (Say you want to knwo nr of persons in a hierarchy. You have persons in the child department, but some persons only attached to a parent directory, and you want to calculate total number of persons. ).

IN SQL you would do something like:
Select Title from table where (id = value) or (parentid = value) or (grandparentid = value)
which would return everything in one table.

Child 1
Child 2
Child 3
Parent 1
Parent 2
Grandparent 1
pagach’s picture

Have you found the solution? To return everything in one table?
I'm facing the same problem...

pagach’s picture

i ended up using attachemnts. several displays for every relationship and attach them to main display.
maybe this solutions helps someone, it caused me quite a few problems...

MustangGB’s picture

Status: Active » Closed (outdated)