Category / Section
How to expand all the members of a hierarchy in Silverlight OlapClient?
2 mins read
You can expand all the members of a hierarchy by setting the DrillState property of the DimensionElement to ExpandAll as follows.
C#
OlapReport olapReport = new OlapReport(); olapReport.Name = "Sales Report"; olapReport.CurrentCubeName = "Adventure Works"; DimensionElement dimensionElementColumn = new DimensionElement(); //Specifies the name for the dimension element. dimensionElementColumn.Name = "Date"; //Adds level element along with hierarchy element. dimensionElementColumn.AddLevel("Fiscal", "Fiscal Year"); DimensionElement dimensionElementRow = new DimensionElement(); //Specifies tge name for the dimension element. dimensionElementRow.Name = "Customer"; //Adds level element along with the hierarchy element. dimensionElementRow.AddLevel("Customer Geography", "Country"); //Adds the DrillState as ExpandAll to expand all members by default. dimensionElementRow.DrillState = DrillState.ExpandAll; ////Creates measure element. MeasureElements measureElement = new MeasureElements(); measureElement.Elements.Add(new MeasureElement { Name = "Internet Sales Amount" }); ////Adds dimension to the categorical axis. olapReport.CategoricalElements.Add(new Item { ElementValue = dimensionElementColumn }); ////Adds measure to the categorical axis. olapReport.CategoricalElements.Add(new Item { ElementValue = measureElement }); ///Adds dimension element to the series axis. olapReport.SeriesElements.Add(new Item { ElementValue = dimensionElementRow });
VB
Dim olapReport As New OlapReport() olapReport.Name = "Sales Report" olapReport.CurrentCubeName = "Adventure Works" Dim dimensionElementColumn As New DimensionElement() 'Specifies the name for the dimension element. dimensionElementColumn.Name = "Date" 'Adds the level element along with the hierarchy element. dimensionElementColumn.AddLevel("Fiscal", "Fiscal Year") Dim dimensionElementRow As New DimensionElement() 'Specifies the name for the dimension element. dimensionElementRow.Name = "Customer" 'Adds the level element along with the hierarchy element. dimensionElementRow.AddLevel("Customer Geography", "Country") 'Adds the DrillState as ExpandAll to expand all members by default. dimensionElementRow.DrillState = DrillState.ExpandAll 'Creates measure element. Dim measureElement As New MeasureElements() measureElement.Elements.Add(New MeasureElement With {.Name = "Internet Sales Amount"}) 'Addsdimension to the categorical axis. olapReport.CategoricalElements.Add(New Item With {.ElementValue = dimensionElementColumn}) 'Adds measure to the categorical axis. olapReport.CategoricalElements.Add(New Item With {.ElementValue = measureElement}) 'Adds dimension to the series axis. olapReport.SeriesElements.Add(New Item With {.ElementValue = dimensionElementRow})