Collector for ArcGIS

Require the information you need from the field

Getting the best, most complete information from your mobile workforce is important to the decisions that are made downstream within your organization.  When collecting new features, or performing inspections, require that essential information be populated before a new feature or inspection can be added. This post covers how you can enforce these key attributes are collected using non-nullable fields and feature templates.

Within the geodatabase information model, you can define a field as non-nullable and a value must be supplied for that attribute before it can be submitted.  This can be defined when adding fields, or when updating an existing field if the feature layer is empty.

Non-nullable fields in ArcGIS Pro

In Collector, this behavior works as expected when updating an existing feature or tabular record. While fields marked as non-nullable are empty, the feature can’t be updated.

Required Fields in Collector

Collecting new features, however is another matter. In Collector, the new feature can be submitted before the mobile worker has provided a meaningful value for the required field. To understand how to fix this, first let’s understand why it happens.

When you set up your feature layer, you create feature templates for the kinds of features in the layer. These templates define attribute values that characterize that kind of feature. You don’t need to specify values for all attributes, but just the ones key to the particular template. The values you provide in the feature template are the defaults for those fields when you create that type of feature.

When the feature layer is published to ArcGIS Online (or ArcGIS Enterprise) the feature template is updated to include default values for all non-nullable attributes. For the non-nullable attributes that have no default, publishing sets as default based on the default of their type (0 for numeric fields, “ “ for string fields).

Unfortunately, these “default” values included in the feature template satisfy the non-nullable requirement. When the mobile worker selects a template that includes one in Collector, the default value is put in place, and the mobile worker  isn’t prompted to enter a value.  Mobile workers don’t have to enter information for these fields to complete their collection or inspection.  Not quite what we’re after.

Fortunately, there are a couple of ways to address this and get your mobile workers to collect the necessary information.

Publishing new feature layers using ArcGIS Pro

The easiest way to get the desired result is to share your feature layer from ArcGIS Pro 2.1 or later.  This avoids the initial issue: null values are maintained in your feature templates during publishing, and default values aren’t brought in where you haven’t included them.

Since the required field isn’t populated when an feature is created, Collector requires the mobile worker to enter a value when capturing new features.

Updating existing hosted feature layers in ArcGIS Online

But what if you’ve already published feature layers, for example, from ArcMap? To get the desired behavior on these required fields, we need to update the feature layer’s templates using our script to remove these “placeholder” values.

To update your existing feature layers, download the Geoprocessing toolbox and associated Python script from our GitHub repository.  You can use the Geoprocessing tool in ArcGIS Pro, or run the script independently using the ArcGIS API for Python.

Required fields using Geoprocessin

The script takes a few parameters, and you’ll need to be the owner of the feature layer or an organization administrator.

Looking at the script code reveals that the feature layer is updating each of the feature templates and removing the default values inserted into the feature templates during publishing. This change is limited to non-nullable fields where the field value matches the respective placeholder value for text or numeric fields. Fields that have an associated coded value domain are excluded.

What about feature layers published to ArcGIS Enterprise?

For hosted feature layers on ArcGIS Enterprise, the same script applies.  Running the script will update the feature templates for hosted feature layers and replace the default values.

For feature services running on ArcGIS Server as part of ArcGIS Enterprise, you’ll once again want to utilize our script in our GitHub repository to achieve this. However, because the underlying feature service capabilities differ slightly, you won’t be able to update the service directly. You’ll need to reference your feature service as an item in your organization.

Note: To take advantage of the required fields on feature services running on ArcGIS Enterprise you’ll need to be running ArcGIS 10.5.1 or later.

Wrapping up

After running the script on your feature layer, any new features created will require your mobile worker to enter information for these fields.

This results in improved efficiency for the mobile worker when performing data collection, and minimizing return trips to add any important details they have missed.

While this gets you closer, what if you don’t have non-nullable fields? How can you make those fields required? Well, you’ll need to hold out a bit longer as we’ll be adding support to configure this behavior without using non-nullable fields. Stay tuned for updates later this year.

About the author

Doug is the Product Owner for Collector for ArcGIS. He works to extend the reach of GIS to include the mobile workforce to help organizations make quicker, more informed decisions.


Next Article

Navigation Redesign

Read this article