mdxiccubeiccube-reporting

IcCube - displaying row numbers in icCube Table


In Google Table there is an option to show the row number. But in the other Tables this option is not available unfortunately. We don't use Google Table, since the IcCube Table is just rendering way faster with lots of data.

One workaround we learned about would be to create a calculated measure with a constant value for example : Row as 42 and then setup a custom renderer as following:

function(context) {
    return "<span>"+context.getRowIndex()+"</span>";
}

Unfortunately if the table is exported, the constant value (i.e. 42) is displayed and not the row number.

Is there a useful way to get row numbers in the other tables in icCube?


Solution

  • One possibility is to use a calculated member to get the line numbers (it's not going to work with drilldowns).

    Assuming you've two axis, the query would look like :

    WITH
       FUNCTION _currentTuple(_t) as CASE _t.count
                WHEN 1 THEN _t.hierarchy.currentMember
                WHEN 2 THEN ( _t.Item(0).hierarchy.currentMember,_t.Item(1).hierarchy.currentMember)
                // you get the idea 
                ELSE  Error( "_currentTuple- " + Str(_t.count)  )
               END
       MEMBER [Line Position] as Rank( _currentTuple( Axis(1)(0) )  ,   Axis(1) )
    SELECT
     [Line Position] on 0,
     [Customers].[Geography].[Region].members * [Product].[Product].[Category] on 1
    FROM [Sales]   
    

    Which make us think we should add a function to get the current axis members in an easier way.

    _hope it helps