cancel
Showing results for 
Search instead for 
Did you mean: 
Community_Admin
Community Team Member
Community Team Member

Introduction

The following enables to change the value in pivot tables to specific strings, while allowing the use of conditional coloring as normal.

Step 1 - Add The Following Script To Your Pivot's Edit Script

widget.on('ready', function(){
$('td[class*=p-value] div').map(function(i, cell) { 
switch (cell.innerHTML ) {
case "10": cell.innerHTML='BAD';
break;
case "20": cell.innerHTML='OK';
break;
case "30": cell.innerHTML='MEH';
break;
default: cell.innerHTML='GOOD';
}
}) 
})

Step 2 - Modify the values in the script according to your need

You can change the 'case' values to match the original values and the "cell.innerHTML" values to the strings you wish to present.

Note: The value after default will determine what will happen with all values not matching the cases above. If you wish to leave the original values in this case simply enter "cell.innerHTML" instead of "GOOD".

Example:

After script:

Community_Admin_0-1634651775311.png

You can also achieve similar results with the following script:

fidx is the value you wish to change (starts at 1).

widget.on('ready', () => {
$('td.p-value[val="10"][fidx="1"]').text("BAD")
$('td.p-value[val="20"][fidx="1"]').text("OK")
$('td.p-value[val="30"][fidx="1"]').text("MEH")
$('td.p-value[fidx=1] div').filter(function() {return parseFloat($(this).text().replace("$","").replace(",","")) > 30;}).text("GOOD")
})
Version history
Last update:
‎10-19-2021 06:57 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request