Hi,
I created and attribute rule where the duration field auto-populates with the following values. It runs perfectly fine locally in ArcGIS Pro, but when I publish the hosted layer with this rule it doesn't seem to work. I would greatly appreciate if any could either help or explain the reasoning for this not working.
var From = Date($feature.OutageStart)
var To = Date($feature.OutageEnd)
var EndTime = Text(To, 'h:mm A')
var LenOfTime_Days = DateDiff(To, From, 'days')
var days = Round(LenOfTime_Days)
var LenOfTime_Hours = DateDiff(To, From, 'hours')
var LenOfTime_Minutes = 60 - Minute(To)
var duration = 'Approximately ' + days + ' day(s) from 9:00 AM - 4:00 PM ending at ' + EndTime + ' on the last day.'
if (LenOfTime_Days >= 1){
return duration
}
else if(LenOfTime_Days < 1 && LenOfTime_Hours != 0 && LenOfTime_Minutes == 60){
duration = LenOfTime_Hours + ' hour(s)'
}
else if(LenOfTime_Days < 1 && LenOfTime_Hours == 0 && LenOfTime_Minutes != 60){
duration = LenOfTime_Minutes + ' minutes'
}
else if(LenOfTime_Days < 1 && LenOfTime_Hours != 0 && LenOfTime_Minutes != 60){
duration = LenOfTime_Hours + ' hour and ' + LenOfTime_Minutes + ' minutes'
}
return duration
- Hosted Feature Service in Web Map
- ArcGIS Pro