Edit FeatureLayer with subtypes

Editor provides full editing support for FeatureLayers with subtypes. This sample provides an example of the Editor behavior when editing a dataset with subtypes. Subtypes are a subset of features in a layer that are used for categorizing data, as the subset of features share the same attributes. Take a look at “Introduction to subtypes" from the ArcGIS Pro documentation to learn more about this database concept. Editing datasets with subtypes requires additional work to maintain data integrity. The purpose of this sample is to highlight the difference in behavior when editing this type of data.

More information on subtypes

Subtypes operate off the same feature dataset or layer. Each subtype’s fields can be configured to share or utilize a unique domain. Additionally, each field can define its own default value per subtype. The image below illustrates the Subtypes view in ArcGIS Pro. This dataset has five subtypes. These are Unknown, Midwest, Northeast, South, and West. Each subtype represents regions in the United States which can then be categorized accordingly. The Division field is shared among all subtypes and has a different domain assigned to it across these subtypes. Whereas, the Unknown subtype does not have a domain set for this field. The REGION_POPULATION field has different default values for each subtype. This shows an example of how a dataset can be categorized to have distinct domains and default values using subtypes. All of this is conveyed in the image below.

subtypes-view

Editing subtypes

Editing data with subtypes differs from editing a dataset without subtypes. This difference in behavior is relevant when editing the subtypeField. Updating the subtypeField attribute value changes the underlying feature's subtype. As a result, the field domains, and potentially the default values displayed in the form for the current subtype, must be updated to align with the definitions of the new subtype. Using the dataset above, consider a scenario where a feature containing a West subtype was updated to South. By making this update, the Division field domain should be updated from the West_Division to the South_Division domain.

The FeatureForm handles this by updating the domains to reflect the domains defined on the updated feature's subtype. The image below illustrates this. On the left is the Division field's domain values for a feature with a West subtype, while on the right is a feature with a South subtype. Both of these features are in the same layer but make use of different domains.

subtype-domains-annotations

To update the subtypeField in the form, the user is prompted to confirm whether they would like to "Use default values" or "Keep current values". As mentioned earlier, subtypes can have their own default values for each field. By selecting the "Use default values" option, the form will apply the field default values defined on the feature's updated subtype. Any previous edits made to those fields will be overwritten. The image below illustrates the process of updating the West subtype to the South. Observe that Division and REGION_POPULATION_2023 field values are overwritten to match the default values of the South subtype. This is indicated in the table above. It is also important to note that only fields with default values set on the updated subtype are overwritten, while all other field values are preserved. The image below shows the preserved value of STATE_NAME after the subtype update.

subtype-use-default-values-annotations

If the "Keep current values" option is selected, all the form's current edits are saved. The image below demonstrates how the REGION_POPULATION_2023 field value persists. However, the Division field value appears to have been updated. This is because the Division field has a domain. The domain will update to match the domain set on the updated subtype. The coded value for the domain remains unchanged at 1. However, it is important to note that the coded value of 1 corresponds to different values for the West_Division domain in the West subtype and the South_Division domain in the South subtype. In the West subtype, the coded value of 1 represents the value Pacific for the West_Division domain. On the other hand, in the South subtype, the coded value of 1 corresponds to the value West South Central for the South_Division domain. This explains why we observe a different value for the Division field despite choosing to preserve all edits.

subtype-keep-current-values-annotations

Conclusion

Subtypes add an extra level of complexity when working with editing workflows. Luckily, the FeatureForm and the Editor provide native support, which eliminates the need to add extra code to account for these workflows. The behavior for editing features with subtypes was modeled after the behavior in ArcGIS Pro. Take a look at "Edit feature attributes" to learn more about how Pro handles subtype editing.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.