cancel
Showing results for 
Search instead for 
Did you mean: 

Add row numbers to pivot rows

irismaessen
11 - Data Pipeline
11 - Data Pipeline

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 the sorting of the pivot is changed. (So the first row of page 1 always has row number 1)

I need both the sorting functionality of a Pivot widget, and to be able to drill/jump using JTD, so I don't think BloX is suitable for this.

Is there any way to achieve this? 

1 ACCEPTED SOLUTION

Helena_qbeeq
9 - Travel Pro
9 - Travel Pro

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:

Helena_qbeeq_0-1686320349734.png

Please let me know if this works for you : )

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

View solution in original post

5 REPLIES 5

Helena_qbeeq
9 - Travel Pro
9 - Travel Pro

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:

Helena_qbeeq_0-1686320349734.png

Please let me know if this works for you : )

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

That works like a charm! Thank you!

 

Iris

I get this. I was hoping to get a row number for every single row if that makes sense.

Hi @SirFabTheGreat ,

The provided script will only work if you ensure that that first column is "unique".

If you could concatenate the candidate_id and the branch for example, and add that column as the first column, it would then be overwritten with the row number.

Please let me know if this works for you : )

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

 

 Thank you very much.