Omicron Llama

Coding all day, every day.

Get All PerformancePoint Filter Value selections in a Site Collection For the Current User

Here’s some code to get all PerformancePoint filter selections for the current user in a web site.

This is a fairly straightforward operation. First you need a collection of strings, each of which is the URL to a PerformancePoint Filter stored in SharePoint. In this code snippet I use SPSiteDataQuery (in the DiscoverFilterUrls() method). You might want to cache this, though in my implementation where I use this code I’m using the singleton pattern to instantiate this class and to store an in-memory copy of this data.

Once you have this collection of URLs, you need to iterate over them and use the PerformancePoint Monitoring API to get the Filter instance defined at that URL, and call the GetFilterDisplayData method. This will return a DataTable of the filter options. Note the useSavedUserSelections parameter, if I set this to true I will get the saved user selections, otherwise this should return all the options available in the filter. You might also want to do this, just modify the code as needed.

In my code I’m looking for the ‘MemberUniqueName’ column, as I’m dealing primarily with MDX Member Selection Filters in PerformancePoint, and these contain this column. You may have to modify the code in your implementation to extract the appropriate column.

I have a utility method in here which I use when generating the Dictionary of filters and their values, called IsFilterEncodedInSet. In my implementation, my web.config has an AppSetting called ‘ChartParametersEncodedAsSet’, which I define a semi-colon separated list of PerformancePoint Filter Names which are passed in as sets. You can find out another way how to do this that’s either more dynamic or more configurable (like storing in a SharePoint list). The only reason I use this method is to find out if I need to wrap the filter options in curly braces (‘{‘ and ‘}’) or not. This is important as MDX member sets are defined like this, and thus makes this utility class more general to allowing either single MDX member options or sets of  MDX members. Note, however, that an MDX set can easily just contain a single member. My requirement needed me to only include the braces for multiple-member sets. If you have no such requirement for this, you can wrap every filter value that is returned in curly braces quite safely, and remove the dependency on the IsFilterEncodedAsSet method, and thus remove the dependency on the web.config AppSetting.

Let me know in the comments if you have more questions about this code snippet or having problems getting it to work.

Have fun!


Leave a Reply

Your email address will not be published. Required fields are marked *