Hierarchical transformations find out level

Pantelhs Saoylos asked on November 11, 2019 09:24

Hello i would like to know if it is possible to find out the level the transformation is rendering to apply some logic. My problem is i want to have a different style on the first level and on the second level from rest levels, i am trying to achieve that using header and footer transformations but i can't distinguish the level inside their code, and on that note is it possible to find the number of childs of each level? Thanks in advance for any advice

Recent Answers


Pantelhs Saoylos answered on November 11, 2019 10:32

Found out a work around by creating a different transformation for each level and defining them during the set up on the Edit transformation tab of the Hierarchical transformation. As for the number of childs i calculated them using jquery, not sure if it is the best solution but it gets the work done. If anyone has a suggestion please let me know!

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on November 11, 2019 11:44

I think the solution you've applied to levels is fine.

As for number of childs you could try to use DataItemCount macro (more details here) - it works well within regular listing web part, however I'm not sure it will give you expected result within hierarchical viewer with multiple level, assuming it might return you total number of data records.

2 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 11, 2019 14:42

The level of the transformation being applied is relative to the position the viewer is placed on the template in the content tree. For instance, if your main template has the viewer applied on /faqs the /faqs would be level 0 and /faqs/faq-1 would be level 1. In the node the would be level 1 and level 2 respectively.

For the universal and hierarchical viewer, their levels are always relative to where the template is applied.

0 votesVote for this answer Mark as a Correct answer

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