I am using symbology classes defined by a custom Arcade expression.
My problem is that if there's no feature that satisfies some of the defined classes those symbols will not show in the Classes tab and therefore I can't format the symbol for future features that will fall in that class.
This is an excerpt of my Arcade expression:
if (Left($feature.KEY, 2) == '01')
{return "Oak";}
else if (Left($feature.KEY, 2) == '02')
{return "Palm tree";}
else if (Left($feature.KEY, 2) == '03')
{return "Cherry tree";}
else if (Left($feature.KEY, 2) == '04' || Left($feature.KEY, 2) == '05')
{return "Pine";}
else if (Left($feature.KEY, 2) == '07')
{return "Ash";}
else if (Left($feature.KEY, 2) == '08' || Left($feature.KEY, 2) == '09')
{return "Beech";}
else if (Left($feature.KEY, 2) == '10')
{return "Cedar";}
Right now we have no catalogued Ash nor Cedar, so there's no feature with KEY values starting with 07 or 10, but we will eventually in the future and need to format a symbol for those symbol classes.
As you see below, those classes do not show in the Classes tab and the 'Add unlisted value' option doesn't list those symbols either.
I thought of adding some dummy features with the missing KEY values to be able to format their symbols but I don't have the privileges to add features to the catalogue feature class, so I don't know if that would work anyway.
Any idea of what to do?
Lisa, the below solution may work for you in AGOL but I haven't tested it there. This however was my approach for when I encountered it in Pro:
It's been a minute since I was working on this same problem, but I believe my only solution was to create dummy records for every custom symbol while setting up the symbology. Each dummy record would be identified using a common value in a particular field. After everything was configured you can then use a definition query on the layer to omit the dummy records based on that common dummy value (or by querying out their object ids). You can later delete the dummy records once a real record satisfices that expression.
--------
Another frustrating issue I constantly run into with the custom symbols expression, is that they always reset any time I altered the symbol expression. I would spend all this time creating the custom expressions for them, then creating custom symbols for each category only for it all to disappear the second I altered anything in the expression.
This was particularly annoying for a project where I had a different layer for all operators, each with the same custom symbol expression and symbols that would require updating. To prevent the need to redo the symbols for every layer when I wanted to change something, I created a python script which would regenerate the individual operator layers based on a template layer. The script would take the template and update the definition query and layer name based on a list of operator names. I would then only need to update a single template layer each time a change was needed. To keep this properly linked to my webmaps, the script would also assign a service layer ID to each layer.
Thanks for your input, Dan. I think your suggestions would work if I were publishing my data from Pro into AGOL. But my data is actually a feed coming from a third party vendor that's published on our AGOL, so I can't publish or republish it. Data values will also come and go routinely, so a value that's there today may be gone tomorrow. I've been told that the new viewer may have more functionality, so I have to check that out. I will post anything I learn. Again, thanks for playing ; )