1

I'm trying to implement a nested structure in such a way as to get a table (within a view?) similar to this:

Parent      Child       Grandchild      Age     Sex
John                                    56      M
            Lisa                        29      F
                        Jim             4       M
                        Louis           6       M
            Mark                        24      M
            Sanda                       21      F
Marcela                                 45      F
            Sam                         21      M
            Andy                        18      M
...

For this I defined the following content types:

Parent:
+Title (name)
+Age
+Sex
+Child [entity reference]

Child:
+Title (name)
+Age
+Sex
+Grandchild [entity reference]

Grandchild:
+Title (name)
+Age
+Sex

The +Age and +Sex attributes are shared between the content types, and the nested structure is implemented with entity reference fields.

I tried using Views, but I couldn't find a way to achieve this.

Any hint would be really appreciated,

Mihai

UPDATED:

With Views I managed to get the following table:

Title       Age     Sex     Children
John        56      M       Lisa, Mark, Sanda
Marcela     45      F       Sam, Andy

which is a basic use of Views...

Actually I cannot manage to relate Grandchild to Parent entity, through Parent > Child > Grandchild structure.

  • Yes, you can achieve that using Relationships in Views – Krishna Mohan Aug 8 '14 at 11:07
0

You should be fine with a content type called person and then have an entity reference field called "children" that points at the content type person.

Then in Views create two relationships using your entity reference field. The second relationship should use the first as relationship setting.

Call the first relationship, child and the second grandchild.

Then output Content Title three times, the second should use the relationship child the second grandchild.

Under row settings set it to group by Content: Title (the first).

Set a filter that the entity reference field can't be empty.

This should list all persons that have children.

  • Good hint to use a single Content Type. Though, I still cannot get the full table, but only the persons that have grandchildren (only the full chain of relations) and the Age and Sex are those of the Parent only, for each record. – Mihai Terente Aug 8 '14 at 13:32
0

Create three content types:

  1. The person
  2. the child
  3. the grandChild

by entity reference module set the appropriate reference from child and grandChild to the person content type. Now create one view from all of the content types and in filter Criteria set the content type for person DO NOT DO THIS WHEN YOU ARE CREATING NEW VIEW IN THIS PICTURE

enter image description here

download and install eva module, create two eva display of the view, one for the parent and one for the child and set the Relationship for each one in each view. in the end you will see that eva display of person is added in its manage display. like the picture

enter image description here

Visit this link , it is a very perfect tutorial of eva module and it solves your problem.

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.