cancel
Showing results for 
Search instead for 
Did you mean: 

+ sign for values in Blox

rahuldhomane
9 - Travel Pro
9 - Travel Pro

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
12 - Data Integration
12 - Data Integration

@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
12 - Data Integration
12 - Data Integration

@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
9 - Travel Pro
9 - Travel Pro

Thank you so much @harikm007 !! It worked 😊