cancel
Showing results for 
Search instead for 
Did you mean: 

Blox: Replace NaN:NaN:NaN with '-'

BIQ
8 - Cloud Apps
8 - Cloud Apps

I have a blox widget that outputs NaN:NaN:NaN. Can I apply a script to replace this with a hyphen?

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @BIQ ,

Hope this script works for you. Update the variables in the script as commented

 

widget.on('processresult', function(se, ev){
	
	let panelName = 'Region' //update your panel name here
	let textToRepalce = '$10.18M' //update value of text to be replaced
	let replaceWith = '-' //new value/text to be displayed
	
	$.each(ev.result, function(resultIndex, resultValue){
		$.each(resultValue, function(index, value){
			if(value.Panel == panelName && value.Text == textToRepalce){
				value.Text = replaceWith
			}
		})
		
	})

})

-Hari

 

View solution in original post

1 REPLY 1

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @BIQ ,

Hope this script works for you. Update the variables in the script as commented

 

widget.on('processresult', function(se, ev){
	
	let panelName = 'Region' //update your panel name here
	let textToRepalce = '$10.18M' //update value of text to be replaced
	let replaceWith = '-' //new value/text to be displayed
	
	$.each(ev.result, function(resultIndex, resultValue){
		$.each(resultValue, function(index, value){
			if(value.Panel == panelName && value.Text == textToRepalce){
				value.Text = replaceWith
			}
		})
		
	})

})

-Hari