Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Dimensions & Measures Info on selected cell
posted

Hi,

We are evaluating the Silverlight Pivot table to include data exploration on MSSAS cubes in our application.

One of the requirements of the application is the possibility to navigate through different available elements.

For example, having a cube with aggregate data such as Indicator values, allow the user to navigate into more detailed data, which may be available in another cube (with all the facts that justify the indicator value).

To accomplish this (and presuming that the we store somewhere the necessary metadata for the navigation), we need to know what are the dimensions and measure associated to a specific cell. For now, this could be done in the CellClicked event. The arguments object of this event provides a PivotCell object, and the question is, given this object, how to reach the dimensions and measure associated to it?

Thanks in advance.

Best Regards.

Rui.

  • 7922
    Verified Answer
    posted

     Hi Rui.

    You can find info about measures and dimensions which currently are used for creating data in DataSource of pivot grid.

    pivotGrid.DataSource.Columns is a collection of all Hierarchies that are drop into Columns area.
    pivotGrid.DataSource.Rows is a collection of all Hierarchies that are drop into Rows area.
    pivotGrid.DataSource.Measures is a collection of all measures that are drop into measure area.

     When user click into the cell you should get column and row indexes and then extract the tuples which are used for creating the data in cell.

    Each tuple contains collection of members. So if you have hierarchy in column area like d1,d2,d3,  in tuple’s member collection you will have members like m1, m2, m3 for each hierarchy.

     Below is snippet to clarify the thinks:

     private void pivotGrid_CellClicked(object sender, PivotCellClickedEventArgs e){

        // find cell location
        int columnIndex = pivotGrid.DataColumns.IndexOf(e.Cell.DataColumn);
        int rowIndex = pivotGrid.DataRows.IndexOf(e.Cell.DataRow);

        // extract the tuples
        ITuple columnTuple pivotGrid.DataSource.Result.ColumnAxis.Tuples[columnIndex];

        ITuple rowTuple pivotGrid.DataSource.Result.RowAxis.Tuples[rowIndex];

        // accordance between members and hierarchy
        // columnTuple.Members[i] = pivotGrid.DataSource.Columns[i];
    }

    There is one thing I should mention. When you have more than 1 measure, the pivot grid creates a “measure dimension” in row or column area(depend on user prefer location) which help us to arrange column and row axises correctly. This “measure dimension”  is from Infragistics.Olap.MeasureListViewModel  type. This will help you to determinate which member in tuple’s member collection is a measure.