How to get the filtered members unique name in column and row of OLAP Client in ASP.NET Web Forms?
You can get the filtered members unique name in column and row of OLAP Client using the following code example.
C#
void OlapClient1_PreRender(object sender, EventArgs e) { if (this.OlapClient1.AxisElementBuilderColumn.Controls.Count > 0 && this.OlapClient1.AxisElementBuilderColumn.Controls[0].Controls.Count > 0 && this.OlapClient1.AxisElementBuilderColumn.Controls[0].Controls[0] is Label) { for (var i = 0; i < this.OlapClient1.AxisElementBuilderColumn.Controls.Count; i++) { if (OlapClient1.AxisElementBuilderColumn.Controls[i] is SplitButton) { if (((Label)OlapClient1.AxisElementBuilderColumn.Controls[i].Controls[0]).Text == "Date") { //// Gives you the nodes that are checked in the MemberEditor window string filteredNodes = GettingCheckedNode(this.OlapClient1.OlapDataManager.CurrentReport.CategoricalElements); } } } } } private string GettingCheckedNode(Items items) { string checkedNodeName = string.Empty; string excludedElements = string.Empty; if (items[1].ExcludedElementValue != null) { for (var i = 0; i < (items[1].ExcludedElementValue as DimensionElement).Hierarchy.LevelElements.Count; i++) { foreach (MemberElement memberElement in (items[1].ExcludedElementValue as DimensionElement).Hierarchy.LevelElements[i].MemberElements) { excludedElements += "#" + memberElement.Name; } } } foreach (Syncfusion.Olap.Data.Dimension dimension in this.OlapClient1.OlapDataManager.CurrentCubeSchema.Dimensions) { if (dimension.Caption == "Date") { foreach (Syncfusion.Olap.Data.Hierarchy hierarchy in dimension.Hierarchies) { if (hierarchy.Caption == "Date.Fiscal") { foreach (Syncfusion.Olap.Data.Level level in hierarchy.Levels) { //// Processing the Members at different levels if ((items[1].ExcludedElementValue != null) && (items[1].ExcludedElementValue as DimensionElement).Hierarchy.LevelElements.Count > 0) { foreach (LevelElement item in (items[1].ExcludedElementValue as DimensionElement).Hierarchy.LevelElements) { if (level.Caption == item.Name) { foreach (Syncfusion.Olap.Data.Member member in level.Members) { if (excludedElements.Length != 0) { string[] ab = null; ab = excludedElements.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); foreach (string name in ab) { if (!(name == member.Caption)) checkedNodeName += "#" + member.Caption; } } } } } } } } } } } if (checkedNodeName.Length != 0) return checkedNodeName; return null; }
VB
Private Sub OlapClient1_PreRender(ByVal sender As Object, ByVal e As EventArgs) If Me.OlapClient1.AxisElementBuilderColumn.Controls.Count > 0 AndAlso Me.OlapClient1.AxisElementBuilderColumn.Controls(0).Controls.Count > 0 AndAlso TypeOf Me.OlapClient1.AxisElementBuilderColumn.Controls(0).Controls(0) Is Label Then For i = 0 To Me.OlapClient1.AxisElementBuilderColumn.Controls.Count - 1 If TypeOf OlapClient1.AxisElementBuilderColumn.Controls(i) Is SplitButton Then If (CType(OlapClient1.AxisElementBuilderColumn.Controls(i).Controls(0), Label)).Text = "Date" Then 'Gives you the nodes that are checked in the MemberEditor window Dim filteredNodes As String = GettingCheckedNode(Me.OlapClient1.OlapDataManager.CurrentReport.CategoricalElements) End If End If Next i End If End Sub Private Function GettingCheckedNode(ByVal items As Items) As String Dim checkedNodeName As String = String.Empty Dim excludedElements As String = String.Empty If items(1).ExcludedElementValue IsNot Nothing Then For i = 0 To (TryCast(items(1).ExcludedElementValue, DimensionElement)).Hierarchy.LevelElements.Count - 1 For Each memberElement As MemberElement In (TryCast(items(1).ExcludedElementValue, DimensionElement)).Hierarchy.LevelElements(i).MemberElements excludedElements &= "#" & memberElement.Name Next memberElement Next i End If For Each dimension As Syncfusion.Olap.Data.Dimension In Me.OlapClient1.OlapDataManager.CurrentCubeSchema.Dimensions If dimension.Caption = "Date" Then For Each hierarchy As Syncfusion.Olap.Data.Hierarchy In dimension.Hierarchies If hierarchy.Caption = "Date.Fiscal" Then For Each level As Syncfusion.Olap.Data.Level In hierarchy.Levels 'Processing the Members at different levels If (items(1).ExcludedElementValue IsNot Nothing) AndAlso (TryCast(items(1).ExcludedElementValue, DimensionElement)).Hierarchy.LevelElements.Count > 0 Then For Each item As LevelElement In (TryCast(items(1).ExcludedElementValue, DimensionElement)).Hierarchy.LevelElements If level.Caption = item.Name Then For Each member As Syncfusion.Olap.Data.Member In level.Members If excludedElements.Length <> 0 Then Dim ab() As String = Nothing ab = excludedElements.Split(New Char() { "#"c }, StringSplitOptions.RemoveEmptyEntries) For Each name As String In ab If Not(name = member.Caption) Then checkedNodeName &= "#" & member.Caption End If Next name End If Next member End If Next item End If Next level End If Next hierarchy End If Next dimension If checkedNodeName.Length <> 0 Then Return checkedNodeName End If Return Nothing End Function
Note:
A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.
The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.
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!