Arcade Symbology Issue

03-29-2019 06:23 AM
New Contributor


I'm having an issue using an Arcade expression to symbolize my data in an AGOL Web Map.  My data consists of a bunch of points which have a date field that shows the last time the point was visited.  I'm trying to write an Arcade expression to extract the year out of the date field for symbolization.  The expression I'm using seems to work as intended when tested but all of the points show up the same color on the map.  

This is an example of an entry in the date field: 5/30/2017, 8:00 PM

Here is my Arcade Expression:

Here is my symbology menu showing that there is a count for each year category.  Like I mentioned above, all the points show up the same color in the web map, the red "To Be Inventoried." 

I also want to note that I am using a Filter on the data to exclude points that are no longer visited.  I'm not an expert on Arcade expressions so if there's a better way I could be achieving my goal, I'm open to suggestions.     

Tags (1)
0 Kudos
3 Replies
Esri Esteemed Contributor

Your script could be shortend, like this (if I understand it correctly):

var invYear = Year($feature.INV_DT);
if (invYear >= 2017) {
    return Text(invYear, "0000");
} else {
    return "To Be Inventoried";

However, this does not explain that you only see "To Be Inventoried" as result. The result of the expression with the counts for each year indicates that the expression is applied correctly and you have points in each class. Some things to validate:

  • What does your filter look like?
  • Your date field is really a date?
  • You are zoomed to an area where you should have other results than only "To Be Inventoried"?
New Contributor

I republished my data this morning and now my original expression wasn't generating counts like it originally did.  I checked the data type for my date field and its a string data type.  Pretty sure it is a date field in the source data but I'll have to check on that later. Used some of your expression and got it all working, thanks for the tips!

This is the final working expression:

New Contributor III

It could also be the case that some of your points are being hidden. Based on the symbology, all of the red (To Be Inventoried) points appear on top as they are at the top of the symbology list. If these cover all of the points from 2019/2018/2017 then the other points will be hidden. Dragging the 'To Be Inventoried' points to the bottom of the symbology may reveal all, or at least others...

0 Kudos