Forum Discussion

irismaessen's avatar
irismaessen
Data Pipeline
06-02-2023
Solved

Add row numbers to pivot rows

We have on a dashboard a pivot with a single row grouping value but many rows and many columns.  For the readability of the pivot, I'd like to provide my user with row numbers that don't move when th...
  • Helena_qbeeq's avatar
    06-09-2023

    Hi irismaessen 

    I think you can achieve your end result with the following workaround.

    First, duplicate the first row dimension, and rename it to Row for example.

    Then, add the following script to your widget.

    It will then overwrite the cell values with their row number.

    widget.transformPivot({
       type: ['member']
    }, handler);
    
    function handler(metadata, cell) {
    	
    	if (metadata.type=='member'&&metadata.index == 0&& metadata.rowIndex >0) { //only changes for first column, value rows.
         cell.content = metadata.rowIndex; 
    	 
        }
    }

    Here is an example of the end result:

    Please let me know if this works for you : )

    Always here to help,
    Helena from QBeeQ
    [email protected]
    QBeeQ - Gold Implementation and Development Partner