AnsweredAssumed Answered

Displaying proper symbology with Arcade in ArcPro/AGOL

Question asked by Ipad_1_Avion on Apr 24, 2019
Latest reply on Apr 25, 2019 by Ipad_1_Avion

I'm having issues across platforms using Arcade to break my Valves features into different classes. The following script works perfectly in ArcPro (31,536,000,000 is the rough number of milliseconds in a year, and the code will properly change colors of valves outside of one year of maintenance within a few minutes):


arcade code breaking features up from current to previous dates of operation


That code yields the following result in ArcPro (Note the broken valve is just showing it works in Pro, broken and lost symbology works in AGOL as well, but the data has not been updated to reflect the change in Pro):


Features classified by broken, lost, and dates


The result in an AGOL web app follows; code seems to only segregate elapsed time based on current date, not <null> values. Again, it also works for broken/lost valves. All of the symbology displays in the legend, however.




I've tested the code using Collector and Explorer using both iPad and Android mobile platforms, but I don't get anything other than default value symbol. The web app still displays the same symbology from a mobile platform as it does PC, however, I don't collect points from our web app. We use an Arrow GPS connected to an iPad as our collection platform, and it doesn't make sense to switch apps to update.


Default symbology displayed on Android, though the separate classes still exist in the legend:


Any recommendations or help is appreciated.  I've pasted the code on the bottom for easy manipulation. I'm just getting into code, and don't have the knowledge yet to make a more advanced app that can collect that we can download. Thanks in advance, and I hope this helps you all out there looking for a similar solution to finding a longer time based method for annual maintenance. 


collector arcade arcade expression arcade symbology arcade attribute expressions arcade arcpro agol long time time year annual annualmaintenance


// set parameters for finding broken or lost valves first.

var class

If ($feature.BROKEN == "YES") {
class = "Broken";
} else if ($feature.FOUND == "LOST") {
class = "Lost";
} else {

// this classification sets up different classes based on time of maintenance. Symbology adjustable via regular methods

var startDate = Date($feature.DATE_OPERATION_CURRENT);
var endDate = Date(Today ());
var change = DateDiff(endDate, startDate, 'value');

var result = When (change > 31536000000, "Due", change <= 31536000000, "Current", "Data Not Current")

return result


return class


//I realize I could probably replace "var result" with "class"