This project is read-only.

Hierarchy - SLAM Extension

Problem: you have data in a list that you want to associate in some sort of hierarchical fashion. For example, you have list of shapes. At the root of this list you have an Object. Underneath Object you want to have Polygon. Underneath you want triangle and rectangle. By default, there's no great way to store this info in SharePoint. One approach is to create a lookup to the list itself and use this to store parentage. But then if you look at Triangle and want to know what its parents are, you'd have to iterate through each each parent. What if you want to determine what items are at the same level as triangle? You'd be totally out of luck.

In order to solve this problem in an elegant fashion, we have built an extension to SLAM that uses the nested set hierarchy model. Nested set lets us do some pretty cool things, such as create dead simple queries to determine parentage, maintain a tree in which not only vertical order but also horizontal order matters and move things around in our tree without fearing that we accidentally turn our tree into a circle. A useful source with more information about the nested set hierarchy model in general is here.

Now, when we have hierarchy hooked up to a list, creating a new item looks something like this -

Notice with this interface we can select a parent item for this item then we can select a "horizontal position". In a nested set hierarchy order matters so with the horizontal position we are choosing where under this parent the item will live. The item either can go in place (to the left) of an item in the list or at the end of the list of children (last).

And our list view looks like this -

This view is ordering by "Left" values, so as positions are chosen the order is represented accurately in this view.

We built SLAM to be a platform for others to develop on. In addition to being a pretty great tool, our hierarchy plug-in is an example of the sort of extensions possible within SLAM. We'll be posting details on "how we did it" in the near future. But in the meantime, here's how to install it:

Hierarchy Install Guide

  • Install SLAM as normal if you haven't already done so (see the illustrated guide for details on this step)
  • Download the hierarchy setup from the releases tab
  • Run the hierarchy setup just like you did for SLAM
  • Activate the SLAM Hierarchy feature (in your site collection feature list)
  • If you want a new list to be hierarchical, go to Site Actions, Create, and use Hierarchical List under “Custom Lists”
  • Add the TypeProfiles configuration to slam.config anywhere beneath the opening <configuration> tag (example code below)
    <add Name="HierarchicalList" AssemblyQualifiedTypeName=
            AWS.SLAM.Hierarchy, Version=, Culture=neutral, PublicKeyToken=896136499185ddc1" />
    <add Name="HierarchicalContent" AssemblyQualifiedTypeName=
            AWS.SLAM.Hierarchy, Version=, Culture=neutral, PublicKeyToken=896136499185ddc1" />
  • Add the List configuration to slam.config (example code below)
<List Name="Tags" TypeProfile="HierarchicalList" ActivationOrder="5">
          <Field Name="Title" SqlType="varchar(255)" SPType="Text" Required="true"></Field>
  • Ensure that your configuration is valid by performing a config validation in the SLAM Control panel
  • Re-activate SLAM - at this point you should be done for new lists
  • For existing lists, add SLAM Hierarchy Position Field (CFT) to a List.
  • Add TypeProfiles to slam.config and add TypeProfile attribute to List (see above code snippets for details)
  • Swap default List View web part on AllItems.aspx with the SLAM Hierarchy List View that is available after the feature is activated.

Last edited Mar 17, 2009 at 10:25 PM by AWSystems, version 13


No comments yet.