Articles in this section
Category / Section

How to check the presence of measure in column and row axis ?

2 mins read

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

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