How to check the presence of measure in column and row axis ?
You can check the presence of measure, in row or column axis by using OlapClient_Loaded, as illustrated in the following code example.
C#
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.olapClient.Loaded += olapClient_Loaded;
}
void olapClient_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
bool isMeasureInColumn;
bool isMeasureInRow;
if (this.olapClient != null && this.olapClient.OlapDataManager != null)
{
foreach (Item _item in this.olapClient.AxisElementBuilderColumn.ReportItems.List)
{
if (_item.ElementValue is MeasureElements)
isMeasureInColumn = true;
}
foreach (Item _item in this.olapClient.AxisElementBuilderRow.ReportItems.List)
{
if (_item.ElementValue is MeasureElements)
isMeasureInRow = true;
}
}
}
}
VB
Partial Public Class MainPage Inherits UserControl Private dataProvider As IOlapDataProvider Public OlapDataManager As Object Public Sub New() InitializeComponent() AddHandler Me.olapClient.Loaded, AddressOf olapClient_Loaded End Sub Private Sub olapClient_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Dim isMeasureInColumn As Boolean Dim isMesaureInRow As Boolean If Me.olapClient IsNot Nothing AndAlso Me.olapClient.OlapDataManager IsNot Nothing Then For Each _item As Item In Me.olapClient.AxisElementBuilderColumn.ReportItems.List If TypeOf _item.ElementValue Is MeasureElements Then isMeasureInColumn = true End If Next For Each _item As Item In Me.olapClient.AxisElementBuilderRow.ReportItems.List If TypeOf _item.ElementValue Is MeasureElements Then isMeasureInRow = true End If Next End If End Sub End Class