Expanding filter members up to a given level depth with XMLA data source

Atanas Dyulgerov / Thursday, July 15, 2010

A common usage scenario for the XamPivotGrid is drilling down in the data. That action normally is done through the UI, but if you want to do it from code and you use XMLA data source things get a bit more complicated.

Normally in a FlatDataSource scenario it would be enough to go through the recursive FlterMembers hierarchy of the IFilterViewModel and set the IsExpanded property of each filter member you want to true. The reason why this is easy is because when you expand a filter member in the FlatData scenario the expansion process is syncronous. That is not the case with XMLA data, where the operations are asynchronous. You can't go through filter members whose parents are not expanded, because they simply do not exist. The solution is to use the ManualResetEvent to wait until the just triggered expansion is complete and the next level of filter members are loaded. However starting the wait on the current thread also halts the expansion of the filter members and the browse would hang.

The correct approach to expand levels when using XMLA data source is to take the expansion logic in a separate thread. That would prevent the manual reset event from halting the expansion process.

The attached sample shows how to expand all added hierarchies to a specific level depth in an XMLA data source scenario.

I hope this has been helpful. Thank you for your time. Should you have any questions please do not hesitate to write a reply or send me an email at adyulgerov@infragistics.com

FilterMemberExpansionXMLA.zip