ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / TableDefinition Class / GetContingencies Method
Example

In This Topic
    GetContingencies Method
    In This Topic
    Gets a IReadOnlyList of the table's contingencies. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public IReadOnlyList<Contingency> GetContingencies()
    Public Function GetContingencies() As IReadOnlyList(Of Contingency)

    Return Value

    The list of contingencies, Contingency.
    Exceptions
    ExceptionDescription
    A geodatabase-related exception has occurred.
    Example
    Explore cotingent attribute values
    public void ExploreContingentValues(Table table)
    {
        using (TableDefinition tableDefinition = table.GetDefinition())
        {
            IReadOnlyList<Contingency> contingencies = tableDefinition.GetContingencies();
            foreach (Contingency contingency in contingencies)
            {
                // Field group 
                FieldGroup filedGroup = contingency.FieldGroup;
                string fieldGroupName = filedGroup.Name;
                IReadOnlyList<string> fieldInFieldGroup = filedGroup.FieldNames;
                bool isEditRestriction = filedGroup.IsRestrictive;
    
                int contingencyId = contingency.ID;
                Subtype subtype = contingency.Subtype;
                bool isContingencyRetired = contingency.IsRetired;
    
                // Contingent values 
                IReadOnlyDictionary<string, ContingentValue> contingentValuesByFieldName = contingency.GetContingentValues();
                foreach (KeyValuePair<string, ContingentValue> contingentValueKeyValuePair in contingentValuesByFieldName)
                {
                    string attributeFieldName = contingentValueKeyValuePair.Key;
    
                    // Contingent value type associated with the attribute field
                    ContingentValue contingentValue = contingentValueKeyValuePair.Value;
    
                    switch (contingentValue)
                    {
                        case ContingentCodedValue contingentCodedValue:
                            string codedValueDomainName = contingentCodedValue.Name;
                            object codedValueDomainValue = contingentCodedValue.CodedValue;
                            break;
                        case ContingentRangeValue contingentRangeValue:
                            object rangeDomainMaxValue = contingentRangeValue.Max;
                            object rangeDomainMinValue = contingentRangeValue.Min;
                            break;
                        case ContingentAnyValue contingentAnyValue:
                            // Any value type
                            break;
                        case ContingentNullValue contingentNullValue:
                            // Null value
                            break;
                    }
                }
            }
        }
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also