Changing symbol color via arcade expression

1907
6
01-06-2020 11:12 AM
DillonKubiatowicz
New Contributor II

I have a map with different road work types such as 'Surface Repairs', 'Signs', etc and when these are open job orders I am trying to turn their symbols on the collector map to green. When they are completed tasks I want it to turn to a red symbol indicating the job is complete. I am having troubles coming up with a valid expression.  Any and all help is appreciated. 

0 Kudos
6 Replies
MarkBockenhauer
Esri Regular Contributor

Dillon,

 

This thread, you may find of interest  Dynamic symbology based on days passed 

also Xander Bakker  has a few blog articles about Arcade, that are a great way to get started.

 

Mark

XanderBakker
Esri Esteemed Contributor

Hi Dillon Kubiatowicz ,

There are a couple of things you have to keep in mind.

The expression can be simple, but depends on your data schema. I assume that you have a status field which will indicate if a job is open or closed. You will need to distinguish between open and closed jobs and you could do something like this (using "RoadWorkType" as the attribute that contains the road work type and "JobStatus" as the field that contains the status of the job being open or closed):

$feature.RoadWorkType + " (" + $feature.JobStatus + ")"

This will allow you to distinguish between the different open and closed road work types.

If not all combinations are present, you will have a challenge to define the symbology. Either hack the web map json using AGOL assistant and add the missing symbology (not recommended) or add some dummy points for all missing cases, define the symbology and delete the dummy features after saving the symbology for all combinations.

What I do wonder if there is support for Arcade based symbology in Collector. What OS are you using on your mobile devices?

0 Kudos
DillonKubiatowicz
New Contributor II

Xander Bakker‌ 

Thank you for your response.  I am continuing trying to compose an expression but I am currently trying it a different way.  I have created a new field in the attribute table that includes what the work type is and what is the current status.  The field populated correctly and worked, but if I change the job status from 'Open' to 'Finished' for example the new field I created doesn't correct itself. Any way to make it a "live" field and change itself if I change the job status? Thank you. 

Dillon

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Dillon Kubiatowicz ,

To have this data update live, would requiere an Arcade expression. However, this may limit the usability of the virtual field (symbology en Collector). Attribute rules would be an alternative, but this will requiere an enterprise geodatabase (ArcGIS Enterprise). Using a scheduled task could work (available in ArcGIS Pro 2.5 to be released this month) to update the feature is a possibility, but this is not real time and requieres connectivity and refreshed of the field crew. You could add the layer twice of use a hosted feature layer view and only enable editing on one of them and let the field worker change the status which would change the color from green to red and use that a background behind the symbol of the type of road work. But none of these options are optimal. 

0 Kudos
DillonKubiatowicz
New Contributor II

Xander Bakker‌ 

Thank you for the input. What might my arcade expression look like? I cant figure out which "helper" to use. Thanks

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Dillon Kubiatowicz ,

The Arcade expression could be as simple as the one I posted earlier. However, I don't think using an arcade expression and basing your feature template on that "virtual field" is going to work (in Collector or the web map).

Maybe a solution combining Workforce and Collector would be better. Workforce would be used to show the open and closed work orders (and the list of assignments). Collector would show the work order type. This also allows for the configuration of a dashboard to monitor progress of the field crews. 

0 Kudos