Equivalent of Hierachical Transformation in aspx templates?

Tom F asked on December 1, 2016 09:32

Hi I've found myself building a hierachical transformation in the platform and referencing it in CMSUniView control.

I was wondering if that was the conventional way of doing this kind of thing in Kentico as nested repeaters for hierachy etc would get a bit ugly doing it in a standard repeater etc.

Thanks, Tom

Correct Answer

Jan Hermann answered on December 1, 2016 13:20

This syntax wasn't completely correct. Please use this one (I can see you have already sent it to support):

{%
    if (Cache(Documents[NodeAliasPath].Parent.ClassName, 5, true, "Parent|" + NodeAliasPath, GetCacheDependency("nodes|<site name>|<page type code name>|all")) == "EnvoyTravelTechnologies.Overview" && Documents.Where("NodeID = " + NodeID).FirstItem.Children.Count > 0)
    {
        DocumentName + "</li>";
    }
    else
    {
      if (Documents.Where("NodeID = " + NodeID).FirstItem.Children.Count > 0)
      {
        "<a class='dropdown-toggle' href='" + Transformation.GetDocumentUrl() + "'>" + DocumentName + "</a>";

      }
      else
      {
        "<a href='" + Transformation.GetDocumentUrl() + "'>" + DocumentName + "</a>";
      }
    }
 %}
1 votesVote for this answer Unmark Correct answer

Recent Answers


Jan Hermann answered on December 1, 2016 10:05

You can assign hierarchical transformation directly to your CMSUniView:

<cms:QueryUniView ID="QUVGetSuitable" runat="server" HierarchicalTransformationName="CMS.MenuItem.HierarchicalTransformation" LoadHierarchicalData="true" />
0 votesVote for this answer Mark as a Correct answer

Tom F answered on December 1, 2016 10:11

Thanks Jan I did just that I was just wondering if that was the "correct" way of going about it?

I was also wondering why the else condition in this xml/text transition portion of the hierarchical transformation was never satisfied?

is else not supported?

{% if(Cache(Documents[NodeAliasPath].Parent.ClassName, 5, true, "Parent|" + NodeAliasPath, GetCacheDependency("nodes|<site name>|<page type code name>|all")) == "EnvoyTravelTechnologies.Overview" && Documents.Where("NodeID = " + NodeID).FirstItem.Children.Count > 0) { DocumentName + "</li>" } else if(Documents.Where("NodeID = " + NodeID).FirstItem.Children.Count > 0) { "<a class=\"dropdown-toggle\" href=\"" + Transformation.GetDocumentUrl() + "\">" + DocumentName + "</a>" } else { "<a href=\"" + Transformation.GetDocumentUrl() + "\">" + DocumentName + "</a>" }

OR would this be better suited to a user control with placeholders and visibility?

0 votesVote for this answer Mark as a Correct answer

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