Wednesday, September 19, 2007

Using KPI-lists with advanced filtering

Hi!

A customer of mine wanted a KPI list with values originating from a SharePoint list which already exists. The customer already have a KPI list with a few dozens of indicators which were quite easy to make. However, this new KPI list was to be using a more advanced filter for the SharePoint list.

The underlying list have several column where one of these columns contains persons. The indicators in the KPI list are to be made for list items where person column only has values and then grouped together with another column. The main problem here is to make the view where only the desirable list items is shown. When trying to make the indicators from the list one will discover that there is no way of getting only the list items where the person column contains some value. Hence a try in SharePoint Designer was made. Here the new view of the list could be extracted, but only after the listview web part had been converted into a Data List Web Part and the KPI list indicators didn't seem to like that since I didn't get it to work.

The solution was to make a small console app that changes the view of interest by modifying the Query property of the SPView object with a caml query like this one:

<Where><IsNotNull><FieldRef Name='Column_Name' /></IsNotNull></Where>

After updating the view and going back to the browser, the view have changed and only displaying the list items where the column, in the example above named Column_Name, have values.

There are many other syntaxes that can be used with caml queries and Patrick Tisseghem has made a very useful application called CamlBuilder.

Hope this help someone.

//Sebastian

Posted by Zeb at 21:33:40 | Permanent Link | Comments (1) |