Skip to main content

Join ArcGIS Workforce assignment types to assignments in ArcGIS Dashboards

In this blog post, we'll guide you through the use of Arcade and data expressions in ArcGIS Dashboards. This technique allows you to join fields seamlessly from the Assignment Types table with the Assignments Feature Layer into an in-memory FeatureSet, offering a clearer insight into the types of assignments that have been successfully completed. 

Warning: This workflow is completed in ArcGIS Online and may or may not be functional in older versions of ArcGIS Enterprise.  

If you've utilized ArcGIS Workforce to oversee task assignments within your organization, you might have observed the automatic generation of a data model each time a new project is created. When configuring Assignment Types, essentially, you're creating a non-spatial table that links to your Assignments feature layer.

This connection is established through the [GlobalID] field (GlobalID data type) in the Assignment Types table and the [Assignment Type] field (GUID data type) in the Assignments feature layer. As an ArcGIS Workforce dispatcher, when you create an assignment, you're essentially linking the [GlobalID] field from the Assignment Types table to the [Assignment Type] field in the Assignments feature layer.

However, when setting up an Operations Dashboard to monitor workforce assignments, accessing descriptive information from the Assignment Types table ([Description] field - Text data type) becomes crucial. This information categorizes the various types of assignments completed.

ArcGIS Workforce data model

To understand how to join information from the Assignment Types table with to the Assignments feature layer, you must first understand the ArcGIS Workforce project schema, comprised of two feature layers, three tables and three coded value domains within a single feature service.

Diagram of the ArcGIS Workforce Schema overview

The Primary Key (PK) – Foreign Key (FK) relationship only transfers over the [GlobalID] field from the Assignment Types table but does not transfer over the [Description] field which contains the textual description of the assignment type generated when the ArcGIS Workforce assignment types are created. In the figure below, we have the attribute table of the Assignments feature layer. Notice the [Assignment Type] field only contains the GlobalID (ex:  8d31babd-52ec-4eb6-afe9-4d1189536e7b) and not the actual assignment type in text format.

Image of the Assignments feature attribute table. Notice the assignment type is only represented as a GUID.

In the Assignment Types table, we see that the [Description] field contains the assignment types generated in the ArcGIS Workforce web application. Each assignment created in the ArcGIS Workforce project receives a unique identifier ([GlobalID] field).

Warning: In the image below, the fields [Categorie], [Intervention], [Cout_unitaire], [Unites] were manually added to the Assignment Types table and are not part of the standard ArcGIS Workforce Schema. These were added to gather information on projected costs for each assignment.

Image of the Assignment table. Notice the assignment type is only represented as a GUID.

Now… the question remains, how do I join the [Description] field from the Assignment Types table to the Assignments feature layer, along with any other fields I would like to include? While you could do this by using a joined Workforce layer in the map viewer analysis tools, this results in a newly generated static feature layer, necessitating either regular manual re-generating of the join layer or scheduling the process with the ArcGIS API for Python.

In the remaining sections of this blog, we will demonstrate how you can do this dynamically without the generation of static intermediate feature layers by using Data Expressions in ArcGIS Dashboards. Data expressions are Arcade expressions written to return a FeatureSet. A FeatureSet represents a dynamic connection to a layer in memory and therefore do not generate additional content in your organization.

Data expressions in ArcGIS Dashboards

To begin creating data expressions, you must add an element to the operations dashboard. When selecting the data source, you can 1) select layers that are already present in a map element, 2) use stand-alone layers or 3) write custom data expressions (see create effective data expressions to learn more).

The three options for selecting data sources in ArcGIS Dashboards is listed above. 

Due to the complexity of the script, I will not be going over its functionality line by line. The script used for this blog content was inspired from this Esri github page “Join attributes from a layer to a table”. A copy of my arcade data expressions can be found here by cloning my operations dashboard into your own ArcGIS Online environment.

Sample of Arcade data expression used to join the fields from the assignment types table to the assignments feature layer.   

Now that I have created my FeatureSet, I can look at the results of my Arcade Expression and see that the assignment type description is present with the GlobalID of the assignment type.

Resulting FeatureSet from dynamically joining the assignment types to the assignment feature layer, along with the other fields of interest.     

Advanced formatting in the List element

After creating the FeatureSet – Notice that the fields with codded domains (ex: [Status]) only transferred over the stored values (ex: 1,2,3,4) and not the display values (Assigned, In Progress, Completed, Declined). However, in the operations dashboard, we will want to see the display label and not the stored value to have the necessary information.  

List of values from the ArcGIS Workforce schema. When creating data expressions only the coded values are transferred over.

One way to do this is by using dictionaries in advanced formatting and substituting the coded values with the display values as shown in the image below. This option also enables end-users to translate the language of their content when using hard-coded data. Basically – whatever value is stored value is returned (ex: 1,2,3), the display value (ex: Assigned, In Progress, Completed) will replace that value in the element itself.

Example of using dictionaries in Advanced formatting to display text fields when working with domains in ArcGIS Workforce.

Conclusion

There you have it – you can now create an operations dashboard to monitor the assignments being completed by your workforce. This can also be used as a great initiation to arcade to better comprehend some of the functionality that can be obtained by generating in-memory data and therefore cut-down on credit consumption by avoiding the creation on intermediate hosted feature layers, while also ensuring dynamic real-time updates in the dashboard.