Contingent values, sometimes referred to as contingent attribute values, are a data design feature that allow you to make values in one field dependent on values in another field. Attribute domains allow you to restrict the valid entries on a field to a set list or range of values. Contingent values extends this model by making your choice for a value on one field further constrain the domain values that can be placed on another field. In this way, contingent values enforce data integrity by applying additional constraints to reduce the number of valid field inputs. This can be useful when modeling real world parts and assets in your GIS, particularly for utility companies. This can also be useful for creating decision trees or survey questions where making a choice will determine the next set of valid choices.
A relatable example for an application of contingent values is buying a vehicle.
The decision tree may look like this: Pick a Car Brand > Car Model > Trim Level > Color
First you choose the car brand, for example, Honda.
Based on that brand, a number of car models are available.
For Honda, these could be Pilot, CRV, Accord, and Civic.
For Toyota, a different list of car models is available.
Then, based on the car model you choose, there are a number of trim levels available.
For a Honda Pilot, these could be LX, EX-L, Sport, and Touring.
For the trim level you choose, there could be a number of colors available, such as Red, Blue, Black, and White.
Each choice in the decision tree presents a list of options contingent on what you've chosen previously. Choosing a different car brand will result in a different set of available car models. The car model you choose dictates what trim levels are available and each trim level may have a different set of color options. Your choices could result in a Honda > Pilot > EX-L > White, or it could be a Toyota > 4Runner > TRD Sport > Inferno, depending on what you choose at each stage.
Contingent values allow you to set up these types of field dependencies in your data in which your choice for a value in one field defines and restricts the list of valid values for another field.
For a real-world GIS example, consider the data model in the utility network asset package. There is a point feature class for structure junctions that has subtypes for assets such as power poles, manholes, platforms, and so on.
For the Pole subtype, domains have already been applied to three of the fields. The domains constrain the values that can be placed on each field to a list of valid values. For example, a pole can be of pole class 1, 2, or 3; a pole's material can be fiberglass, wood, or steel; and a pole's height can be 30 feet, 35 feet, 40 feet, 45 feet, and so on.
To further constrain the valid values for this set of fields, you can use contingent values. For example, using contingent values you can define a class 1 pole as being made only of the material fiberglass and restricted to only 30, 35, 40, or 45 feet in height.
Consider the contingencies that you want between field values on the Pole subtype. For this group of fields (class, material, and height), the set of contingencies could be as follows:
|Field||Contingent values||Contingent values||Contingent values|
30, 35, 40, 45
30, 35, 40, 45
50, 55, 60, 65
After these contingent values are created, if you place a new pole feature or modify an existing one, and designate it a Class 1 power pole, the set of values that you can place on the Material field will be constrained to Fiberglass. Likewise, the valid values for the height of a Class 1 Fiberglass pole are constrained to 30, 35, 40, or 45.
Building contingent values like this in your data allows you to further constrain the valid values for sets of fields and more efficiently manage the validity and integrity of your data.
Prepare data for contingent values
Contingent values are created for groups of fields in a table or feature class. Before creating contingent values, these fields should be set up with appropriate domains containing a list, or range, of valid values.
In the power pole example above, the contingent values are in a group of three fields: Class, Material, and Height. Each field has an appropriate domain assigned. For example, the Material field has a domain for materials of types Fiberglass, Wood, and Steel. Once you've properly set up domain values, assigned the domains to their respective fields, and determined the group of fields to create contingencies on, then you need to create the contingencies between the domain values.
To create contingent values on a table or feature class, you will need to do the following:
- Create domains with a list or range of valid values.
- Assign those domains to the appropriate fields of a feature class or table.
- Open the Contingent Values view on that feature class or table.
- Create a field group containing the fields you want to have contingent values.
- Create contingent values across the fields in that field group.
Creating contingent values on a dataset will make it incompatible with ArcGIS Pro 2.2 and earlier.
Open the Contingent Values view
The Contingent Values view is where you create, delete, and manage contingent values.
You can open the Contingent Values view by doing any of the following:
- Right-click a table or feature class in the Catalog pane, point to Design, and click Contingent Values.
- Right-click a table or feature class in the Contents pane, point to Design, and click Contingent Values.
- In the Fields view, click the Contingent Values button on the Fields ribbon. The view switches to the Contingent Values view.
- In the Subtypes view, click the Contingent Values button on the Subtypes ribbon. The view switches to the Contingent Values view.
If it is the first time opening Contingent Values view on a table or feature class and no contingent values are set, you are prompted to create a field group first.
Contingent Values ribbon
The Contingent Values view has its own ribbon for creating and managing contingent values and buttons for switching to the other data design views.
The Contingent Values ribbon contains the following groups:
- Clipboard—The standard clipboard options for Paste, Copy, Cut, and Delete
- Design—This group has buttons to open the other data design views—Fields, Subtypes, Domains, and Attribute Rules—as well as a button to open the Field Groups dialog box.
- Contingent Values
- New—If there is an active field group in the view, this adds a row to create contingent values on the fields from that field group.
- Retire Value—This flags the highlighted row as a retired contingent value. Retired values are still visible other places in the user interface, such as a fields value in the attribute pane, but they are not selectable.
- Toggle Value IDs—Each row in the view has an internally managed Value ID. Clicking this switches between visible and not visible in the data grid.
- Toggle Code/Description—Clicking this switches whether a field value in the data grid shows the domains code or its description.
- Save—All changes made in the Contingent Values view are kept in memory until you click Save.
Create a field group
Before creating contingent values across the fields of a feature class or table, you must create a field group. A field group is a named collection of fields in a table or feature class. In the power pole example above, there is a field group consisting of pole class, material, and height. Once a field group is created, you can begin assigning contingencies to the field values in that group.
To create a field group, do the following:
- Click the Field Groups button on the Contingent Values ribbon.
The Field Groups dialog box appears.
- In the Name section, click the Click here to add a new field group text.
A new field group called Field_Group is created. You can optionally rename this field group.
- Click the Add Fields drop-down menu.
All of the fields in the table or feature class are listed.
- Select the fields you want to participate in the field group and click the Add button.
- Use the Search text box at the top of the list to find a specific field.
- To add all of the fields to the field group, click Select All, and click Add.
- Click OK to create the field group.
Tip:You can use the following shortcut keys on your keyboard to navigate the Fields Group dialog box:
- Ctrl+N—Creates a new field group
- Alt+G—Places the pointer in the Field group data grid at the top of the dialog box
- Alt+A—Places the pointer in the Add Fields drop-down menu
- Alt+F—Places the pointer in the Fields data grid at the bottom of the dialog box
Create contingent values
Once you have a field group created, you can create contingent values for the participating fields.
If the table or feature class you are working with in the Contingent Values view has multiple field groups associated with it, you can switch between them by clicking the Field Group drop-down menu and selecting another field group.
If the table or feature class you are working with in the Contingent Values view has subtypes, you can switch between them using the Subtypes drop-down menu. This allows you to set up contingent values differently for the fields of each subtype. Make sure that any domains are applied on the fields at the subtype level in Subtypes view before getting started.
- To create contingent values in a field group, click the New button on the ribbon, or click in the empty row where it says Click to add contingent values.
- For each field in the field group, choose a field value from the drop-down menu.
The values <ANY> and <NULL> are also available to add as contingent values in the drop-down menu. <ANY> is always available—even if the field where you're adding a contingent value doesn't have a domain applied—and <NULL> is available when the field allows null values.
- <ANY>—Adding the contingent value <ANY> means that any value placed on the field is considered valid.
- <NULL>—Adding the contingent value <NULL> means that having a null value placed on the field is considered valid.
- Repeat steps 1 and 2 for as many contingencies as you want to create. When you're finished, click Save to save your changes.
For the pole example above, in a field group named Poles Contingency, the set of contingent values would look as follows:
Once you have contingent values prepared on your data, the restrictions you've created will be enforced in the application whenever a value is placed on a field while editing, such as in the Attribute pane or the Attribute Table view.
Learn more about how to edit fields with contingent values.
Retire a contingent value
In some circumstances, you may need to retire a contingent value. When you retire a contingent value, it still appears in the list of valid values for a field in places such as the Attribute pane, but it is unavailable and you can't select it as a field value. For example, your organization is no longer using asbestos as a building material, but there are a number of places where asbestos has been used on current assets. This means that it's still a valid value that may already be placed on the field for building material for some features, but from now on, you won't be using it. To keep it from being used on any more fields, you can retire the value.
To retire a contingent value, select the row you want to retire and click the Retire Value button on the ribbon
If that value becomes valid again, you can unretire the contingent value by selecting the row and clicking the Retire Value button.