Custom Arcade symbology and symbol classes without features

1625
11
02-12-2020 01:42 AM
AleydisG__Pere
Occasional Contributor

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?

Custom Arcade Symbol Classes

11 Replies
XanderBakker
Esri Esteemed Contributor

Hi DMS2 ,

Have you tried adding the missing values?

0 Kudos
AleydisG__Pere
Occasional Contributor

Clicked that option and it turned grayed out.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi DMS2 ,

That wasn't supposed to happen. I will try and test something here to see what happens. In the mean time, maybe Kory Kramer‌ may know something....

0 Kudos
DanMakridakis1
New Contributor

Xander, did you ever find a solution for this? I am dealing with the same issue. Trying to create a bunch of custom symbol values for data collection layers that currently have no records that satisfy the custom symbol expressions. As a result I'm getting no symbols and they aren't automatically appearing after records do satisfy the expression.

 

Is there an arcade expression for defining the different symbology values/classes regardless if they return any records? Something that would force them all to show?

LisaMcAleer
New Contributor III

Has anyone figured this out???????  Sharing would be much appreciated!!

0 Kudos
Dwight
by
New Contributor II
For whichever combination of attributes you would potentially want to display add a feature expression in your web map for each value you would want shown just keep adding on to the framework, present and future sample below:


var status = $feature["STATUS"]
var type = $feature["TYPE"]

if ((status == "Value_Status_1") && (type == "Value_Type_1")) {

return "Status 1 - Type 1 Legend Label"
}

if ((status == "Value_Status_2") && (type == "Value_Type_2")) {

return " Status 2 - Type 2 Legend Label "
}

else {

return "Other" }

0 Kudos
LisaMcAleer
New Contributor III

Hey Dwight, Thanks for responding.  This seems to be pretty much what I currently have, I think. In my map, at any rate, it does not list any values that are not currently in the dataset.  I can code for  if (Status=="Dog") { return "WOOF"}, but it won't display the legend item WOOF in my legend list until I actually get a "Dog" feature in my data.  And that's what we are all here looking to do:  Display and symbolize potential features in the legend BEFORE those features actually exist in the data.  I know this could be accomplished with a hosted feature dataset published from Pro, but the particular dataset I'm working with is hosted on our AGOL but the data is actually a live feed from a 3rd party vender application.  Long story short, I cannot establish a domain (add values to a list) for my display field in AGOL, nor can I add items to the legend that aren't currently in the dataset.  I'd like to avoid having to constantly go into AGOL and custom symbolize new data.  I guess I'm actually trying to replicate some type of layer file with arcade so my data would be "pre- custom symbolized," but so far I haven't found a way to make that happen........  I should add that I'm currently working in AGOL Map Classic. Not sure if the new viewer has anything more to offer.

0 Kudos
Dwight
by
New Contributor II

I believe this functionality is only available with the new map viewer.

0 Kudos
LisaMcAleer
New Contributor III

Alrighty, Thanks, Dwight!

0 Kudos