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
Are you publishing to ArcGIS Online or Enterprise?
I am publishing this to AGO.
"Currently, attribute rules are not supported in hosted feature layers in ArcGIS Online."
https://community.esri.com/t5/attribute-rules-documents/attribute-rule-faq/ta-p/910439#toc-hId-42373...
I think they are supported or there is something else that is happening in the background that is occurring. I have a hosted feature service, and the service is currently working where the attribute value changes according to the rule that I set up.