Category / Section
How to find the default hierarchy of a OlapChart Dimension in Silverlight?
1 min read
You can find the default hierarchy’s unique name present in the dimension by using the following code example.
For illustration, a button is created. On clicking it, the cube schema is processed and gets the default hierarchy’s unique name for the specified dimension.
C#
private void btn_FindDefaultHierarchy_Click(object sender, System.Windows.RoutedEventArgs e) { string defaultHerarchyName = ""; var Dimensions = this.olapClient.OlapDataManager.CurrentCubeSchema.Dimensions; for (int i = 0; i < Dimensions.Count; i++) { if (Dimensions[i].Name == "Enter a valid dimension name") { defaultHerarchyName = Dimensions[i].DefaultHierarchyName; break; } } }
VB
Private Sub btn_FindDefaultHierarchy_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Dim defaultHerarchyName As String = "" Dim Dimensions As var = Me.olapClient.OlapDataManager.CurrentCubeSchema.Dimensions Dim i As Integer For i = 0 To Dimensions.Count - 1 Step i + 1 If Dimensions(i).Name = "Enter a valid dimension name" Then defaultHerarchyName = Dimensions(i).DefaultHierarchyName Exit For End If Next End Sub