#ViewModel.cs
private OlapReport ReportWithMemberProperties()
{
OlapReport olapReport = new OlapReport();
// Specifying the current cube name
olapReport.CurrentCubeName = "Adventure Works";
MeasureElements measureElementColumn = new MeasureElements();
// Specifying the Name for the Measure Element
measureElementColumn.Elements.Add(new MeasureElement { Name = "Sales Amount Quota" });
DimensionElement dimensionElementRow = new DimensionElement();
// Specifying the Dimension Name
dimensionElementRow.Name = "Employee";
// Specifying the Hierarchy and level name for the Dimension Element
dimensionElementRow.AddLevel("Employees", "Employee Level 02");
dimensionElementRow.Hierarchy.LevelElements["Employee Level 02"].IncludeAvailableMembers = true;
// Adding the Member properties to the Dimension Element
dimensionElementRow.MemberProperties.Add(new MemberProperty("Title", "[Employee].[Employees].[Title]"));
dimensionElementRow.MemberProperties.Add(new MemberProperty("Phone", "[Employee].[Employees].[Phone]"));
dimensionElementRow.MemberProperties.Add(new MemberProperty("Email Address", "[Employee].[Employees].[Email Address]"));
// Adding Row Members
olapReport.SeriesElements.Add(dimensionElementRow);
//Adding Column Members
olapReport.CategoricalElements.Add(measureElementColumn);
return olapReport;
}
#MainWindow.xaml.cs
public MainWindow()
{
InitializeComponent();
olapClient1.Loaded += OlapClient1_Loaded;
}
private void OlapClient1_Loaded(object sender, RoutedEventArgs e)
{
olapClient1.OlapGrid.Loaded += OlapGrid_Loaded;
}
private void OlapGrid_Loaded(object sender, RoutedEventArgs e)
{
olapClient1.OlapGrid.Layout = GridLayout.ExcelLikeLayoutWithMemberProperties;
}
|