Articles in this section
Category / Section

How to get the default hierarchy name of a dimension from the Cube?

1 min read

You can find the default hierarchy name of a dimension from the Cube through the following code example.


public MainWindow()
                this.olapGrid1.OlapDataManager = new       
                Initial Catalog=Adventure Works DW 2008 SE;");
                this.olapGrid1.Loaded += olapGrid1_Loaded;
void olapGrid1_Loaded(object sender, System.Windows.RoutedEventArgs e)
        string defaultHierarchyName = "";
        var Dimensions=this.olapGrid1.OlapDataManager.CurrentCubeSchema.Dimensions;
            for (int i = 0; i < Dimensions.Count; i++)
                // Enter the valid hierarchy name that you want to check.
                if (Dimensions[i].Name == "Customer” )
                    defaultHierarchyName = Dimensions[i].DefaultHierarchyName;


Public Sub New()
                Me.olapGrid1.OlapDataManager = New Syncfusion.Olap.Manager.OlapDataManager("Data Source=; Initial Catalog=Adventure Works DW 2008 SE;")                                                Me.olapGrid1.OlapDataManager.SetCurrentReport(SampleReport())
                AddHandler Me.olapGrid1.Loaded, AddressOf olapGrid1_Loaded
End Sub
Private Sub olapGrid1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
         Dim defaultHierarchyName As String = ""
         Dim Dimensions =      Me.olapGrid1.OlapDataManager.CurrentCubeSchema.Dimensions
                For i As Integer = 0 To Dimensions.Count – 1
                  'Enter valid hierarchy name which you want to check.
                      If Dimensions(i).Name = "Customer" Then                                                                                         defaultHierarchyName = Dimensions(i).DefaultHierarchyName
                      Exit For
                   End If
         Next i
End Sub


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