Get Parent Property Value on Hierarchical Viewer

Jump Griarte asked on June 1, 2017 11:10

Hello there,

I am using Hierarchical Viewer to display 2 levels of page types, but I would like to have the Parent page type to display its custom fields under its children:

-- Child1
-- Child2
--> Display Parent1 fields
-- Child3
--> Display Parent2 fields

I have set up the Header, Item and Footer transformations for each level.

In order to display the Parent fields under the children, the transformation should be inside Level 1 Footer or Level 1 Last Item. I could get the custom field values by using: {% Documents[NodeAliasPath].GetValue("FieldName") #%}

I would like to know how do I get the Parent custom field value (Level 0) when the transformation is done on Level 1?

I have already tried: {% Documents[NodeAliasPath].Parent.GetValue("FieldName") #%} but it doesn't work.

Thank you!

Correct Answer

Jan Hermann answered on June 1, 2017 13:13

You were almost there. Since the FieldName is probably a custom field (DocumentName would work though) you need to either specify the class name of your parent or access it directly like this:

{% Documents[Documents[NodeAliasPath].Parent.NodeAliasPath].GetValue("FieldName") |(identity)GlobalAdministrator%}

2 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.