Import Contingent Values (Data Management)

Summary

Imports multiple contingent values and field groups from a comma-separated values file (.csv) to a dataset.

Usage

  • This tool will import contingent values and field groups into a dataset with the option to replace values or combine new values with existing values.

  • The schema of the target table must match the values that will be imported. If fields or values specified in the .csv file do not exist in the target dataset, the field group or contingent values will not be imported.

  • If the target table is stored in an enterprise geodatabase, this tool must be run as the data owner.

  • This tool can be used in conjunction with the Export Contingent Values tool.

  • Once a field group is added to a dataset, the dataset version is set to ArcGIS Pro 2.3. This means that the dataset can no longer be used in ArcMap.

  • The field groups .csv file includes the NAME, IS_RESTRICTIVE, and FIELD columns. The FIELD column name will be incremented as needed to include all fields in the field group, for example, FIELD1, FIELD2, FIELD3, and so on.

    Field groups .csv columns

    ColumnDescriptionExample

    NAME

    The field group name

    AnimalCategories

    IS_RESTRICTIVE

    Specifies whether the field group is restrictive

    TRUE

    FIELD1

    The name of the field

    category

  • The contingent values .csv file includes the following columns: CAV_ID, IS_RETIRED, FIELD_GROUP, SUBTYPE, SUBTYPE_NAME, CV_TYPE, CV_VALUE, and DESCRIPTION.

    There will be as many CV_TYPE, CV_VALUE, and DESCRIPTION columns as needed to match the structure of the contingent value definition. These column names will be incremented as needed (for example, CV_TYPE1, CV_VALUE1, DESCRIPTION1, CV_TYPE2, CV_VALUE2, DESCRIPTION2, and so on) and will correspond to the order of the fields in the field groups .csv file. For example, CV_TYPE1, CV_VALUE1, and DESCRIPTION1 in the contingent values .csv file correspond with FIELD1 in the field groups .csv file.

    Contingent values .csv columns

    ColumnDescriptionExample

    CAV_ID

    The ID of the contingent value.

    1

    IS_RETIRED

    A Boolean value defining whether the contingent value is retired.

    False

    FIELD_GROUP

    The name of the field group to which the contingent value corresponds.

    AnimalCategories

    SUBTYPE

    If the dataset has a subtype and the subtype is used in the contingent value definition, this is the subtype code to which the rule is applied.

    2

    SUBTYPE_NAME

    If the dataset has a subtype and the subtype is used in the contingent value definition, this is the text description of the subtype code.

    Cold blooded

    CV_TYPE1

    The type of contingent value. The type value is stored as an integer as follows:

    • 1—Any
    • 2—Null
    • 3—Coded Value
    • 4—Range

    3

    CV_VALUE1

    The specific field value. If the type is any or null, the value in the .csv file is empty.

    1

    DESCRIPTION1

    If the contingent value type is a coded value, this is the text description of the coded value.

    Fish

Parameters

LabelExplanationData Type
Target Table

The input geodatabase table or feature class to which the field groups and contingent values will be imported.

Table View
Field Groups Input File (.csv)

A .csv file with specific column names that contains information about the field groups.

File
Contingent Values Input File (.csv)

A .csv file with specific column names that contains information about the contingent values.

File
Replace existing contingent values
(Optional)

Specifies whether existing values will be replaced or merged when imported.

  • Checked—Existing values for the target table will be replaced with the values in the input .csv files.
  • Unchecked—Existing values will be merged with the values in the input .csv files. Any duplicates will be excluded. This is the default.

Boolean

Derived Output

LabelExplanationData Type
Updated Table

The updated target table with the imported field groups and contingent values.

Table View; Raster Layer; Mosaic Layer

arcpy.management.ImportContingentValues(target_table, field_group_file, contingent_value_file, {import_type})
NameExplanationData Type
target_table

The input geodatabase table or feature class to which the field groups and contingent values will be imported.

Table View
field_group_file

A .csv file with specific column names that contains information about the field groups.

File
contingent_value_file

A .csv file with specific column names that contains information about the contingent values.

File
import_type
(Optional)

Specifies whether existing values will be replaced or merged when imported.

  • REPLACEExisting values for the target table will be replaced with the values in the input .csv files.
  • UNIONExisting values will be merged with the values in the input .csv files. Any duplicates will be excluded. This is the default.
Boolean

Derived Output

NameExplanationData Type
updated_table

The updated target table with the imported field groups and contingent values.

Table View; Raster Layer; Mosaic Layer

Code sample

ImportContingentValues example (Python window)

Import field groups and contingent values in the GasPipes dataset and replace existing values.

import arcpy
arcpy.management.ImportContingentValues("C:\\MyProject\\myConn.sde\\pro.USER1.Animals",
                                        "C:\\MyProject\\MyFieldGroups.csv",
                                        "C:\\MyProject\\MyContingentValues.csv",
                                        "REPLACE")

Environments

Related topics