cancel
Showing results for 
Search instead for 
Did you mean: 

+ sign for values in Blox

rahuldhomane
10 - ETL
10 - ETL

Hi,

I was looking for a way to add '+' sign to a value whenever the result is positive in Blox. Please let me know if there is a way to add this feature

 

Thanks in Advance!

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

@rahuldhomane ,

Please try this script. Here update the variable panelName with name of panel where you need to apply this feature:

widget.on('processresult', function(se, ev){
	
	panelName = 'Revenue'
	
	panelIndex = ev.rawResult.metadata.findIndex(el=>el.PanelName == panelName)
	
	if(panelIndex >= 0)
	{
		$.each(ev.result, function(index, value){
			if(value[panelIndex].Value > 0)
				value[panelIndex].Text = '+' + value[panelIndex].Text
		})
	}
})

-Hari

View solution in original post

2 REPLIES 2

harikm007
13 - Data Warehouse
13 - Data Warehouse

@rahuldhomane ,

Please try this script. Here update the variable panelName with name of panel where you need to apply this feature:

widget.on('processresult', function(se, ev){
	
	panelName = 'Revenue'
	
	panelIndex = ev.rawResult.metadata.findIndex(el=>el.PanelName == panelName)
	
	if(panelIndex >= 0)
	{
		$.each(ev.result, function(index, value){
			if(value[panelIndex].Value > 0)
				value[panelIndex].Text = '+' + value[panelIndex].Text
		})
	}
})

-Hari

rahuldhomane
10 - ETL
10 - ETL

Thank you so much @harikm007 !! It worked 😊