Forum Discussion

Silutions's avatar
03-31-2022
Solved

Pivot2: Replace a value in a specific value in another column

Have this script to find and replace a specific cell value with another value: function getWidgetDocumentObject(widget) { if (prism.activeWidget == null) return document.querySelector('[widgetid=...
  • harikm007's avatar
    04-01-2022

    Silutions ,

    Below script will replace cell values. Update the variable columnIndex with index of column you need.

     

    widget.transformPivot(
        {
            type: ['member']
        },
        function setCellBackground(metadata, cell) {
            
    		columnIndex = 2
    		
    		if(metadata.colIndex == columnIndex)
    		{
    			cell.style = cell.style || {};
    		
    			if(cell.content == 'Cannon')
    				cell.content = 'Cannon - Updated Text'
    			else if(cell.content == 'Hickman')
    				cell.content = 'Hickman - Updated Text'
    				
    		}
    
        }
    );
    

     

    Note : This script wont replace numbers from Values panel

    -Hari