Forum Discussion

BIQ's avatar
BIQ
Cloud Apps
01-12-2023
Solved

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

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

  • 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

     

1 Reply

Replies have been turned off for this discussion
  • harikm007's avatar
    harikm007
    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