cancel
Showing results for 
Search instead for 
Did you mean: 

Case Statement at Widget Editor Level

gwolfe
10 - ETL
10 - ETL

Hi,

 

I am trying to create a new dimension base off of a case statement in the widget editor, but I can't get it to work (unless it's based on a value).  For example, this first snippit (this is what I need) won't work . The second will. I don't want to add this to the cube I am using as this is a one off use case. Thanks in advance

gwolfe_0-1654791729748.png

gwolfe_1-1654791940004.png

 

 

2 REPLIES 2

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @gwolfe ,

If you need to replace 'Utah' with 'Current State', add the field 'State' as a Row and use script to replace it:

Pivot2 : https://community.sisense.com/t5/build-analytics/pivot2-replace-a-value-in-a-specific-value-in-anoth...

Pivot 1: https://community.sisense.com/t5/knowledge/replace-values-with-text-pivot-table-widget/ta-p/886

-Hari

gwolfe
10 - ETL
10 - ETL

@harikm007 Thanks for the help. These scripts appear to just change the name, but doesn't allow for grouping by "like" names. (Let me know if I am doing something wrong). In the example below, I would like all "Others" to be grouped into 1 row. 

gwolfe_0-1654796440785.png

 

widget.transformPivot(
    {
        type: ['member']
    },
    function setCellBackground(metadata, cell) {
        
		columnIndex = 0
		
		if(metadata.colIndex == columnIndex)
		{
			cell.style = cell.style || {};
		
			if(cell.content != 'UT')
				cell.content = 'Other'
				
		}

    }
);