ArcGIS Online - Web map symbol categories using Arcade expression problem

359
1
05-26-2020 06:31 AM
MaximeDemers
Occasional Contributor III

I have a problem using an Arcade expression to create categories in order to style the features symbols in a web map on ArcGIS Online

I want to style a feature symbol if a field value is greater than of 0. If the field value is 0, I want to use another field values as categories.

I am using this Arcade expression:

function get_symbol_cat() {
 if ($feature.matelas_quantite > 0) {
   return "matelas"
 } else {
   return Text($feature.collectefaite)
 }
}
get_symbol_cat()‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

However, when I go to the symbol styling menu, there is only the category "matelas" and "other" available. The categories of $feature.collectefaite are not available.

This is really weird, because if I slightly modify the Arcade expression using greather than 1 instead of 0. It's working.

function get_symbol_cat() {
 if ($feature.matelas_quantite > 1) {
   return "matelas"
 } else {
   return Text($feature.collectefaite)
 }
}
get_symbol_cat()

Any idea what could be wrong?

Thank you

P.S.: There is 385 features in the layer, 135 where $feature.matelas_quantite is greater than 0 and 250 where $feature.matelas_quantite is equal to 0.

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Maxime Demers ,

Let's exclude something first. Your field "matelas_quantite" is numerical, right? Can you also try to change $feature.matelas_quantite to $feature["matelas_quantite"]? There can be some issues when a field contains an underscore in the name. 

What would work best for me if I had access to the data to detect where things might be going wrong. Is it possible to share the web map and data with me using my AGOL account "xbakker.spx"?

0 Kudos