This maybe a simple snippet, but I cannot get it to work. I have a small arcade line on my dashboard list to calculate the time that gas was turned off. Simpily subtracts the On time from the Off time.
But, when a service is never turned off, it has nothing in these fields to subtract and results in a 'NaN' I wanted to add an iif statement that takes these NaN's and either leaves them blank and displays nothing or more ideally comes back with 'Zero'
But since it is a NaN result and not something that I can add an If Blank, I am struggling to figure out how this can be done.
Any help would be amazing! Thanks.
Attached: List view from dashboard and the snippet of the arcade
Arcade Text:
var Status = $datapoint.OutageStatus
var Off = $datapoint.DateOff
var On = $datapoint.DateRelightComplete
var DaysOff = DateDiff (On, Off, 'hours')
var HoursOff = Round(DaysOff,1)
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
attributes: {
HoursOff:HoursOff,
}
}
Line item template:
({expression/HoursOff} Hours without Gas)
-APB