Contingent values, sometimes referred to as contingent attribute values, are a data design feature that allows you to make values in one field dependent on values in another field. Attribute domains allow you to restrict the valid entries in a field to a set list or range of values. Contingent values extend 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.
Caution:
Creating contingent values on a table or feature class makes it incompatible with ArcMap and releases prior to ArcGIS Pro 2.3 and ArcGIS Enterprise 10.7.x. See Client and geodatabase compatibility for more information on functionality available when using mixed client and geodatabase releases.
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 can 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 can be LX, EX-L, Sport, and Touring.
For the trim level you choose, there can 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 can result in a Honda > Pilot > EX-L > White, or it can 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 StructureJunction feature class within 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 can be as follows:
Field | Contingent values | Contingent values | Contingent values |
---|---|---|---|
Class | 1 | 2 | 3 |
Material | Fiberglass | Wood | Steel |
Height | 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, you must create the contingencies between the domain values.
To create contingent values on a table or feature class, you must 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.
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.
- With a layer or table selected in the Contents pane, click the Contingent Values button on the Data ribbon of either the Feature Layer or Standalone Table contextual tabs. The view switches to the Contingent Values view.
- 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.
Note:
If it is the first time you have opened the 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 provides the standard clipboard options for Paste, Copy, Cut, and Delete.
- Design provides buttons to open the other data design views, including the following:
- Fields
- Subtypes
- Domains
- Attribute Rules
- Field Groups provides a button to open the Field Groups dialog box.
- Contingent Values provides buttons to create and manage contingent values, including the following:
- New—Adds a row to create contingent values on the fields from an active field group in the view.
- Import—Imports field groups and contingent values from a comma-separated values (.csv) file.
- Export—Exports field groups and contingent values to a comma-separated values (.csv) file.
- Retire Value—Provides the ability to set 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—Displays or hides the Value ID in the data grid.
- Toggle Code/Description—Switches whether a field value in the data grid shows the domains code or its description.
- Save—Saves all changes made in the Contingent Values view. Changes 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.
- Specify whether the field group is restrictive by choosing an option for the Restrictive check box.
- Left checked, this creates a restrictive field group, and values entered on a field in the field group are restricted to those specified as contingent values. Field groups are restrictive by default to allow control of the editing experience when using contingent values.
- To disable the restrictive setting, uncheck the Restrictive check box. With this unchecked, the field group created is not restrictive, which allows values to be committed to a field group even if they are not specified as contingent values.
- Click OK to create the field group.
Tip:
You can use the following shortcut keys on your keyboard to explore the Fields Group dialog box:- Ctrl+N—Create a field group.
- Alt+G—Place the pointer in the Field group data grid at the top of the dialog box.
- Alt+A—Place the pointer in the Add Fields drop-down menu.
- Alt+F—Place 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 looks as follows:
Once you have contingent values prepared on your data, the restrictions you've created are 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.
Export and import contingent values
Exporting and importing can be useful for sharing the contingent values and field groups for any given table or feature class, creating a backup, or when making updates to a production database without locking it extensively for schema editing.
You can use the Export tool found on the Contingent Values ribbon or the Export Contingent Values geoprocessing tool to export field groups and contingent values to comma-separated values (.csv) files. You can then open the .csv files in an editing app, such as Excel, to review or make changes.
Similarly, you can use the Import tool found on the Contingent Values ribbon or the Import Contingent Values geoprocessing tool to import field groups and contingent values from comma-separated values (.csv) files. This gives you the option to override or merge any changes with the existing contingent values in a chosen table or feature class. Once imported, you can review any changes in the Contingent Values view and save when you are finished making updates.
The export and import processes work with two .csv files, one for field groups that contains information on the fields that participate, and another for contingent values that details various metadata including the type, value, and description of the values defined. You can use the Toggle Value IDs and Toggle Code/Description buttons on the Contingent Values ribbon to display the Value ID and domain codes for your contingent values. These tools can assist with field mapping when working with the exported files. For more details about the formatting of these files, reference Export Contingent Values.