Select to view content in your preferred language

Symbolizing Unique values with wildcards

1807
18
Jump to solution
03-27-2023 11:47 AM
BrianBulla
Regular Contributor II

So I need to symbolize based on two attributes:  the INSP_STATUS and the Subtype.  If there is no INSP_STATUS (ie. = null), than each subtype will have a different symbol.

But....if there is an INSP_STATUS (ie. a few different options), than regardless of the Subtype, they can all be the same symbol.  This is what I have so far....a symbol for each subtype:

BrianBulla_1-1679942740899.png

 

When I try to add a custom value with some conditional statement for the "YES" INSP_STATUS to cover all of the sybytpes, I just get an error:

BrianBulla_0-1679942694097.png

Does anyone know how to accomplish this??  Or do I just need to make a symbol for every possible combination of INSP_STATUS and Subtype??

 

0 Kudos
18 Replies
BrianBulla
Regular Contributor II

Here is the final product.  It's working nicely!

BrianBulla_0-1680009432786.png

// for features without INSP_STATUS, return the subtype
if(IsEmpty($feature.INSP_STATUS)) {
    var subtypes = ["MaintenanceHole", "InspectionMH", "BackFlow", "DiversionMH", "FlapGateMH"]
    var i = $feature.SubtypeCD - 1
    return subtypes[i]
}

// for features with INSP_STATUS = YES
if ($feature.INSP_STATUS == "YES")
{
    return "YES"
};

// for features with INSP_STATUS = WR LOW
if ($feature.INSP_STATUS == "LOW")
{
    return "LOW"
};

// for features with INSP_STATUS = WR HIGH
if ($feature.INSP_STATUS == "HIGH")
{
    return "HIGH"
};

// for features with INSP_STATUS = CR
if ($feature.INSP_STATUS == "CR")
{
    return "CR"
};

 

0 Kudos
BrianBulla
Regular Contributor II

Hi @JohannesLindner .  Sorry to bug you yet again, but after setting up this Arcade powered symbology and publishing this feature class as a hosted feature layer in our Enterprise ArcGIS Online account, a lot of the symbols are not actually showing.  The ones with an INSP_STATUS do show up, but the ones with no INSP_STATUS are just not visible.  They are there, as evidenced by the labelling, but you just can't see them.

Does ArcGIS Online/Portal not support Arcade expressions??  Even using the web layer directly in ArcGIS Pro, I see the same results.

BrianBulla_1-1680024443661.png

 

 

0 Kudos
SLouq
by MVP Regular Contributor
MVP Regular Contributor

Click Edit Layer Style and their should be a botton to toggle on off for Show features out of range or no values. Set it to on. 

You may have to experiment with different styles before you see that option

0 Kudos
BrianBulla
Regular Contributor II

That doesn't seem to be an option for me.  Maybe because I'm using an Arcade expression for the symbology?  And the features are there.  You can see the labelling.  They just aren't being symbolized.

0 Kudos
SLouq
by MVP Regular Contributor
MVP Regular Contributor

The one I did I used the Counts and Amounts (color) style but I had created a style in ArcGIS Pro and then uploaded it to ArcGIS Online. Took a little experimenting and a few curse words but I figured it out. 

0 Kudos
JohannesLindner
MVP Frequent Contributor

Hmmm... No idea why the symbology wouldn't translate to AGOL correctly. Try to change it in the MapViewer (just copy your expression) that worked for me.

JohannesLindner_0-1680028420017.png

JohannesLindner_1-1680028461572.png

 


Have a great day!
Johannes
0 Kudos
BrianBulla
Regular Contributor II

Hi @JohannesLindner .  So I think I see why my symbology in AGOL isn't working, but I can't really explain why.  So, it looks like when I share my data as a weblayer out of ArcGIS Pro, the INSP_STATUS field on the data is getting upated.  I do have Attribute Rules on the related table that has the inspections information.  Do you think for some reason that is getting triggered when I share the data?  Otherwise, I don't understand how that INSP_STATUS field is getting populated.

In my Attribute Rule, I have it set to update the INSP_STATUS in the parent records field whenever a new inspection record is created/updated.  For some reason, I am seeing all records in the published hosted feature layer with that attribute populated.

Here is ArcGIS Pro:

BrianBulla_0-1680198344083.png

 

And then the same feature in AGOL:

BrianBulla_1-1680198524754.png

 

 

0 Kudos
BrianBulla
Regular Contributor II

Ha ha!!  Ok @JohannesLindner I finally got it working.  Apparantly when you set a DEFAULT value on a field when you share that to AGOL, it automatically populates all the <Null> values with that default value....at least that seems to be what is happening....so NOT the Attribute rules.

Anyways, all is good now and the Arcade symbology is working ok.

0 Kudos
JohannesLindner
MVP Frequent Contributor

Apparantly when you set a DEFAULT value on a field when you share that to AGOL, it automatically populates all the <Null> values with that default value

Huh, good to know.

Glad you got it working, please mark the correct answer so this question is shown as solved.


Have a great day!
Johannes
0 Kudos