0

I have a map in ArcGIS Online with a point layer showing lighting assets. These are symbolised based on unique type (post = circle, column = square).

The user will update a separate field to have a unique alphanumeric ID for each Asset.

I would like to use an Arcade expression to change the colour of the points when the field value changes from null to its new ID.

E.g. If the Unique ID is null the point colour is red, if the Unique ID is not null then colour green.

I haven't used the Arcade language before and cannot find guidance online for this particular query.

2
  • possible solution- create two layers in the web map. base map is all red points and the layer on top will show green points if value != null.
    – NULL.Dude
    Commented Jul 26, 2017 at 12:01
  • @Joe - Thank you for the idea. Can you explain further please? I'm not clear on how/where to apply the expression value != null
    – JenB
    Commented Jul 26, 2017 at 14:55

2 Answers 2

2

You can try this http://www.arcgis.com/home/webmap/viewer.html?webmap=93bca1dfa0d14676adbefe160c7a8c3b

//check the id for null values
IF (isEmpty($feature.id)) { 
    //id is null check the type
    When($feature.type == 'Male', "Male with no ID", 
    $feature.type == 'Female', 'Female with no ID', 
    "Other")

} else {
        //id is good check the type
    When($feature.type == 'Male', "Male with ID", 
    $feature.type == 'Female', 'Female with ID', 
    "Other")

}
7
  • this checks if the feature id is null?
    – NULL.Dude
    Commented Jul 26, 2017 at 17:54
  • so isEmpty($feature.fieldname) would check the value of that field for null or empty strings. field.id is just a field in my sample. Commented Jul 26, 2017 at 18:08
  • ok cool and the 2nd string parameter is the label for these features? nice man ARCADE is something i want to start learning
    – NULL.Dude
    Commented Jul 26, 2017 at 18:20
  • 1
    Yup check out GeoNet and the blog sites, geonet.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/… , developers.arcgis.com/arcade Commented Jul 26, 2017 at 19:33
  • @RussRoberts - Legend! I made one mistake - I had to export the shapefile to fgdb as obviously shp's do not allow null values, so when applying the expression it showed everything as having an ID. Thank you for your help.
    – JenB
    Commented Jul 27, 2017 at 8:32
2

I recently had the same issue. I used

IIF(IsEmpty($feature.ID), "NOT FILLED", "FILLED")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.