Search code examples
nestedhierarchytransformationkentico

How could I write this Kentico Hierarchical Transformation?


I have a page in Kentico 8.2 that should display a list of committees from an organization. The fields for each committee are "CommitteeName", "CommitteeOverview", and "CommitteeChairs"; however, I would also like to list minutes from organizational meetings that are specific to each committee. For example, some meetings might have both generic meeting minutes and meeting minutes specific to a committee. I imagine that I would store all meeting minutes within a generic "Meeting" page type which represents meetings in general. How could I write a transformation or a series of transformations to create the following output:

  • CommitteeName
    • CommitteeChairs
    • CommitteeOverview
    • [CommitteeName]Minutes from [MeetingName]
      • There are multiple meetings for which committee minutes might be stored.
      • Not all meetings will have committee minutes

etc.

Example of current "Page Type" hierarchy:

  • Committee
    • CommitteeName
    • CommitteeOverview
    • CommitteeChairs
  • Meeting
    • MeetingName
    • MeetingDate
    • MeetingAgenda
    • MeetingMinutes
    • [CommitteeName]Minutes
      • (there are multiple committees for which minutes might be stored at each meeting)

Also, which web part would be best for what I am trying to accomplish?


Solution

  • If the structure of the tree is such that the minutes documents are direct children of the committee documents that they relate to I would use the "universal viewer" web part. I'd then set the Path property to the parent document containing all the committees (e.g. /committees/%). Then I would set up an hierarchical transformation with two item transformations one for each page type with the appropriate markup per your requirements. On the item transformation for the committee page type, you will insert the sublevel placeholder where you want the meetings to be listed (<cms:SubLevelPlaceHolder runat="server" ID="plcSub" /> for ASCX style or {^SubLevelPlaceHolder^} for Text style transformations) per the documentation.

    If the structure of the tree is not as straightforward you may need to write a custom query to get the data you need. If that is the case you will need to write the query such that it creates a union of the fields you plan to output in the transformation. It will also need to include a column for the item ID, parent ID (null for the committees, the ID of the committee for the minutes), and level (0 for the committees, 1 for the minutes).