ArcGIS Pro

How to import contingent values into a feature class

Importing and exporting contingent values are efficient tools for both sharing contingent values with colleagues or as a template for creating new ones. In this scenario, I will show how to create contingent values from existing data by doing the following:

 

Benefits of using contingent values for data editing

Contingent values are data design features that allow you to set up field dependencies in your data so that your choice for a value in one field restricts the list of valid choices for another field. This results in a decision tree. For this workflow example, I will be using hospitals data. Every time a new hospital feature is created, the data editor will be provided with a sequential set of choices that are filtered by the initial choice that was made.

The editing experience with contingent values
The editing experience with contingent values

I will use the Hospitals feature class attributes to generate the decision tree table. If you already have the decision tree table that stores the attributes you will use as contingent values, you can proceed to the next step of the workflow.

First, I will export the Hospitals feature class as an Excel table using the Table To Excel geoprocessing tool, to allow for better table manipulation.

Export Hospitals feature class as an Excel table
Export Hospitals feature class as an Excel table

I open the table in Excel and perform the following data cleaning operations:

The decision tree table after data cleaning
The decision tree table after data cleaning

Back to ArcGIS Pro, before I import the contingent values, I need to confirm the Hospital feature class meets all the requirements for contingent values.

1. In the Fields view, I confirm that attribute domains have been assigned to the fields of interest. Attribute domains enforce data integrity by limiting allowed values for a field to a list or range of choices. Domains are required to set up contingent values.

Attribute domains applied to the fields of interest
Attribute domains applied to the fields of interest

2. In the Contingent Values view, I create a field group named Medical_Organizational_Structure and add the three fields to it. A field group is a named collection of fields, and it must be created from the fields to which you want to apply contingent values.

Medical_Organizational_Structure field group
Medical_Organizational_Structure field group

Now that I have completed the requirements, I can manually create contingent values one by one in the view or I can use the Import Contingent Values geoprocessing tool.

The Contingent Values view
The Contingent Values view

To save time and because I already created the table with the unique attribute combinations, I will use the Import Contingent Values geoprocessing tool. However, when I click the Import button on the ribbon, on the Import Contingent Values dialog box, I am prompted to add two .csv files. These are the Field Group and Contingent Value files.

The Import Contingent Values tool
The Import Contingent Values tool

Because I don’t know the format of these two tables, I will first use the Export Contingent Values tool. The tool creates two .csv files, one for the field groups and one for the contingent values. I will then use the schema of this table and plug in the values from the decision tree table I created earlier from the Hospitals feature class.

The Export Contingent Values tool
The Export Contingent Values tool

Note: To use the Export Contingent Values tool, you don’t need to have contingent values already created, but at a minimum you will need a field group.

Once the tool successfully creates the files, I will open and review them. I will start with the MedicalFieldGroup_Table.csv file.

The Field Group table
The Field Group table

The MedicalFieldGroup table is already populated. The tool matched the field group details I manually set, part of the requirements, to the Field Group csv table as follows:

 

Moving on to the MedicalCAVs_Table, here I only have the schema table but not the values. This is because I did not manually create contingent values prior to using the Export Contingent Values tool. In this example, I will manually populate the table using the decision tree table created earlier.

The Contingent Values table
The Contingent Values table

Let’s review the columns:

The CAV_ID column
The CAV_ID column
The IS_RETIRED column
The IS_RETIRED column
The FIELD_GROUP column
The FIELD_GROUP column
The SUBTYPE column
The SUBTYPE column

 

The next three columns appended with 1 reflect the first field from the Medical_Organizational_Structure field group. And that is Hospital_Ownership_Category.

In my example, all my contingent values are coded values, so I will add the value 3 to the CV_TYPE1 column.

The CV_TYPE1 column
The CV_TYPE1 column
The CV_VALUE1 column
The CV_VALUE1 column
The DESCRIPTION1 column
The DESCRIPTION1 column

For the remaining fields, I will follow the last three steps as follows:

  1. For the CV_TYPE2, CV_VALUE2, and DESCRIPTION2 columns, I will take the attributes from the Hospital_Ownership_Type field, the second field in the field group and in the decision tree table.
  2. For the CV_TYPE3, CV_VALUE3, and DESCRIPTION3 columns, I will take the attributes from the Hospital_Type field, the third field in the field group and in the decision tree table.

When done, my MedicalCAVs_Table will look like this:

The Contingent Values table
The Contingent Values table

For the last step, now that I have both the field group and the contingent values .csv files correctly populated, I will import them into the Import Contingent Values geoprocessing tool.

The Import Contingent Values geoprocessing tool
The Import Contingent Values geoprocessing tool

Once the tool runs, I can confirm the Contingent Values view has been automatically updated with the imported contingent values. Now the data editors can use the benefits of contingent values during the data editing process.

Contingent values applied to the Hospitals feature class
Contingent values applied to the Hospitals feature class

Error checking

One of the most frequent errors encountered during the import of contingent values is the “Found contingent values error in field group”. It typically occurs when there is a mismatch between the values specified in the attribute domain list and the imported contingent values. In the example below, the last combination of contingent values is flagged as invalid because the value “Voluntary non profit” was spelled without the dash and therefore is not accepted by the attribute domain assigned to the Hospital_Ownership_Category field.

Found contingent values error for field group: Medical_Organizational_Structure
Found contingent values error for field group: Medical_Organizational_Structure

To resolve this error, you need to make sure that all imported contingent values assigned to dependent fields are present in their respective attribute domains. You have two options:

  1. Update the list of domains: Modify the attribute domain lists by adding any missing valid values.
  2. Correct invalid values: In either the Contingent Values view or the ContingentValues.csv file. If you choose to correct the .csv file, you will have to run the Import Contingent Values tool again.

In this example, I will clear the issue by replacing the incorrect value direclty in the Contingent Values view. I select “Voluntary non-profit” from the dropdown list for the Hospital_Ownership_Category field as it is a valid value according to its attribute domain.

Replace value for the Hospital_Ownership_Category field
Replace value for the Hospital_Ownership_Category field

By making the change and selecting the correct value, the combination of values becomes valid. As a result, the error is resolved and I can successfully save the imported contingent values to the Hospitals feature class.

Save contingent values
Save contingent values

In this workflow, I showed how to use the Import Contingent Values and Export Contingent Values tools to quickly generate contingent values from your existing data. To find out more information about contingent values, check out the Assess urban tree health using contingent values tutorial that shows step by step how to apply contingent values from an assessment form to better evaluate tree conditions in the field. If you are interested in improving the overall quality of your data with contingent values and other data design tools such as attribute domains, subtypes, and attribute rules, check out the Data Design in ArcGIS Pro story.

 

Photo by Walls.io on Unsplash

About the author

Product Engineer on the Geodatabase team, passionate about making a difference in people's lives using GIS. Hiker and a true Éclair and Crêpe lover in her free time.

Next Article

Try group filters in ArcGIS Experience Builder

Read this article