Articles in this section
Category / Section

How to find the checked state of members in Silverlight OlapClient?

4 mins read

You can find the checked members of a dimension from the underlying MetaTreeNode of MemberEditor window. By iterating child nodes in MetaTreeNodeCollection, you can find the selected/checked state of each member of a dimension.

In the following code example, consider the column axis of AxisElementBuilder as an example. Here the Measures are excluded, as only the selected/checked members from a dimension are retrieved.

On iterating the members besides a dimension, the IsSelected property of the node is checked. If it’s true, the member is selected and added to the collection else not.

C#

public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            ……
            ……
            //Triggering Loaded event of OlapClient
            this.olapClient1.Loaded += olapClient1_Loaded; 
        }
        void olapClient1_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
             List<string> childNodeCollection = new List<string>();
             string metaTreeNodeIsSelected= ""; 
             string childNodeIsSelected = "";
             //In this example, column axis in AxisElementBuilder is processed
             if(this.olapClient1.AxisElementBuilderColumn!=null)
             {
                  //Iterating MetaTreeNode in column axis
                  for(int i=0;i<this.olapClient1.AxisElementBuilderColumn.MetaTreeNodes.Count;i++)
                  {
                       //Condition to omit Measure Nodes 
                       if (this.olapClient1.AxisElementBuilderColumn.MetaTreeNodes[i].NodeType != Syncfusion.OlapSilverlight.Data.MetaTreeNodeType.MeasureGroup)
                       {   
                             //Iterating each members inside dimension
                             for(int j=0;j<this.olapClient1.AxisElementBuilderColumn.MetaTreeNodes[i].ChildNodes.Count;j++)
                             {
                                  //Condition checking the members checked state  
                                  If
(this.olapClient1.AxisElementBuilderColumn.MetaTreeNodes[i].ChildNodes[j].IsSelected == true)
                                  { 
                                      //Retrieving caption of the checked node
                                      childNodeIsSelected =this.olapClient1.AxisElementBuilderColumn.MetaTreeNodes[i].ChildNodes[j].Caption.ToString();
                                       //Adding name of the checked node in a collection
                                       childNodeCollection.Add(childNodeIsSelected);
                                   }
                             }
                       }
                  }      
             }  
        }   
    }

VB

Partial Public Class MainPage
      Inherits UserControl
        Public Sub New()
                    InitializeComponent()
               …….
               …….
               'Triggering Loaded event of OlapClient
                    AddHandler Me.olapClient1.Loaded, AddressOf olapClient1_Loaded
        End Sub
        Private Sub olapClient1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
                     Dim childNodeCollection As New List(Of String)()
                     Dim metaTreeNodeIsSelected As String= ""
                     Dim childNodeIsSelected As String = ""
                'In this example, column axis in AxisElementBuilder is processed.
                      If Me.olapClient1.AxisElementBuilderColumn IsNot Nothing Then
                     'Iterating MetaTreeNode in column axis
                      For i As Integer = 0 To Me.olapClient1.AxisElementBuilderColumn.MetaTreeNodes.Count – 1
                             'Condition to omit Measure Nodes
                                       If       Me.olapClient1.AxisElementBuilderColumn.MetaTreeNodes(i).NodeType <> Syncfusion.OlapSilverlight.Data.MetaTreeNodeType.MeasureGroup Then
                                          metaTreeNodeIsSelected = Me.olapClient1.AxisElementBuilderColumn.MetaTreeNodes(i).IsSelected.ToString()
                                   'Iterating each members inside dimension
                                             For j As Integer = 0 To Me.olapClient1.AxisElementBuilderColumn.MetaTreeNodes(i).ChildNodes.Count - 1
                                                       If Me.olapClient1.AxisElementBuilderColumn.MetaTreeNodes(i).ChildNodes(j).IsSelected = True Then
                                             'Retrieving caption of the checked node
                                                       childNodeIsSelected =Me.olapClient1.AxisElementBuilderColumn.MetaTreeNodes(i).ChildNodes(j).Caption.ToString()
                                             'Adding name of the checked node in a collection
                                                  childNodeCollection.Add(childNodeIsSelected)
                                                       End If
                                                  Next j
                                       End If
                                Next i
                     End If
        End Sub
End Class

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied