Arcade Symbology Expression for a Join Feature Not Working? Why?

594
8
06-15-2021 09:25 AM
Labels (1)
KellyArmstrong
Occasional Contributor II

I have a feature class that I joined with a table in Portal, by clicking on Analysis>>Summarize Data>>Join Features.  This is a one to many join.

When I try to write my symbology Arcade expression, it will not find a feature that has both values (there are features/parcels that have both values after the join).  Any ideas?

 

if( $feature["media_type"] == 'Curb Tie' && $feature["media_type"] == 'Building Inspector Curb Tie') {
return "Curb Tie"

}

Tags (1)
0 Kudos
8 Replies
DavidPike
MVP Frequent Contributor

Would you be able to share your data/attribute table so we have a better idea of the join structure?

0 Kudos
KellyArmstrong
Occasional Contributor II

Sure, I have attached it.

0 Kudos
DavidPike
MVP Frequent Contributor

OK, the expression is done on a per row basis, so would never evaluate as True for an AND expression of equality for different attribute values.

Why not an OR expression or is there more to this?

if( $feature["media_type"] == 'Curb Tie' || $feature["media_type"] == 'Building Inspector Curb Tie' ) {
  return "Curb Tie"
}
0 Kudos
KellyArmstrong
Occasional Contributor II

Thanks David.  I do need to evaluate by geometry or by the relfeatureglobalid field, which features have both 'Curb Tie' and 'Building Inspector Curb Tie'.

0 Kudos
DavidPike
MVP Frequent Contributor

I would recommend by evaluating by the original GUID or ObjectID field as it will be less computationally expensive than a geometry operation. I'll leave this for someone else as I'm not to sure how best to go about this, but it seems like a nightmare.  Guessing you don't have desktop to do a one-to-one join and join attributes instead?

0 Kudos
SarahAmbrose
Esri Contributor

 

Hi @KellyArmstrong ,

The Join Expression should be a condition that evaluates to true or false (you don't need to return anything). If the condition is met, the features will be joined, if it's not, they won't be joined. Currently your expression is trying to return a result, which isn't the intended use. From the doc here:


Expressions are used in the Join Features tool to specify join conditions.

In some cases, you may want to specify a condition to select features that should be included in the join. 

....

A join condition must always result in true or false. Expression examples are included in the sections below.

You will also need to specify $target + $join instead of $feature - to specify which datasets + field you are using. So something like: ($target['media_type'] == 'Curb Tie') && ($join['media_type'] == 'Building Inspector Curb Tie')


But it seems like just applying a filter on your input layer will meet your needs and is simpler, since it sounds like you only want to join features with specific values.  You can do this by clicking the "filter" button under the layer in your map, filtering for features where media_type = Curb Tie on one layer, and the other layer has curb type Building Inspector Curb Tie. 

SarahAmbrose_0-1623791528431.png

 

 

Please let me know if you have any follow up questions,

Sarah Ambrose
Product Engineer, GeoAnalytics

0 Kudos
KellyArmstrong
Occasional Contributor II

Sarah,

I guess I am confused.  I already have the feature class and table joined - one to many.

I am just trying to symbolize features that have both "Curb Tie" and "Building Inspector Curb Tie" with the same globalid...

0 Kudos
SarahAmbrose
Esri Contributor

Oh sorry - I thought you were trying to use the join expression in the Join Features tool. Don't pay attention to my answer, it was about using the join expression parameter in the GeoAnalytics tool join features. I didn't realize you were trying to do symbology on a layer :) 

0 Kudos