How to get unique name of filtered members in WPF OLAP Client?
You can get the filtered members’ unique name in the column or the row of WPF OLAP Client. In the following code example, is illustrated how to get the unique name of filtered members from the column axis.
C#
public MainWindow() { try { InitializeComponent(); this.olapClient1.OlapDataManager = new Syncfusion.Olap.Manager.OlapDataManager("Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;"); this.olapClient1.OlapDataManager.SetCurrentReport(SampleReport()); this.olapClient1.OlapDataManager.BeforeMdxQueryExecute += new Syncfusion.Olap.Manager.QueryExecuteEventHandler(OlapDataManager_BeforeMdxQueryExecute); } catch (Exception ex) { MessageBox.Show(ex.Message, "Data will not be loaded properly"); } } void OlapDataManager_BeforeMdxQueryExecute(object sender, Syncfusion.Olap.Manager.QueryExecutingEventArgs e) { List<string> memberCollection = new List<string>(); Items categoricalItems = this.olapClient1.OlapDataManager.CurrentReport.CategoricalElements; foreach(Item categoricalItem in categoricalItems) { if (categoricalItem.ElementValue is DimensionElement && categoricalItem.ExcludedElementValue != null) { //Filtered Members MemberElementCollection memElements = (categoricalItem.ExcludedElementValue as DimensionElement).Hierarchy.LevelElements[0].MemberElements; foreach (MemberElement member in memElements) memberCollection.Add(member.UniqueName); } } }
VB
Public Sub New() Try InitializeComponent() Me.olapClient1.OlapDataManager = New Syncfusion.Olap.Manager.OlapDataManager("Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;") Me.olapClient1.OlapDataManager.SetCurrentReport(SampleReport()) AddHandler olapClient1.OlapDataManager.BeforeMdxQueryExecute, AddressOf OlapDataManager_BeforeMdxQueryExecute Catch ex As Exception MessageBox.Show(ex.Message, "Data will not be loaded properly") End Try End Sub Private Sub OlapDataManager_BeforeMdxQueryExecute(ByVal sender As Object, ByVal e As Syncfusion.Olap.Manager.QueryExecutingEventArgs) Dim memberCollection As New List(Of String)() Dim categoricalItems As Items = Me.olapClient1.OlapDataManager.CurrentReport.CategoricalElements For Each categoricalItem As Item In categoricalItems If TypeOf categoricalItem.ElementValue Is DimensionElement AndAlso categoricalItem.ExcludedElementValue IsNot Nothing Then 'Filtered Members Dim memElements As MemberElementCollection = (TryCast(categoricalItem.ExcludedElementValue,DimensionElement)).Hierarchy.LevelElements(0).MemberElements For Each member As MemberElement In memElements memberCollection.Add(member.UniqueName) Next member End If Next categoricalItem End Sub
Conclusion
I hope you enjoyed learning about how to get unique name of filtered members in WPF OlapClient.
You can refer to our WPF OlapClient Control featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!