ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / ContingentCodedValue Class
Members Example

In This Topic
    ContingentCodedValue Class
    In This Topic
    Represents a coded domain value specified in a Contingency.
    Syntax
    Public NotInheritable Class ContingentCodedValue 
       Inherits ContingentValue
    public sealed class ContingentCodedValue : ContingentValue 
    Example
    Explore contingent attribute values
    {
      // Must be called within QueuedTask.Run
      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;
              }
            }
          }
        }
      }
    }
    Get possible contingent values
    {
      // Must be called within QueuedTask.Run
      void GetPossibleContingentValues(FeatureClass parcels, string zoningFieldName = "Zone")
      {
        using (RowBuffer rowBuffer = parcels.CreateRowBuffer())
        {
          IReadOnlyDictionary<FieldGroup, IReadOnlyList<ContingentValue>> possibleZonings = parcels.GetContingentValues(rowBuffer, zoningFieldName);
          IEnumerable<FieldGroup> possibleFieldGroups = possibleZonings.Keys;
    
          foreach (FieldGroup possibleFieldGroup in possibleFieldGroups)
          {
            IReadOnlyList<ContingentValue> possibleZoningValues = possibleZonings[possibleFieldGroup];
            foreach (ContingentValue possibleZoningValue in possibleZoningValues)
            {
              switch (possibleZoningValue)
              {
                case ContingentCodedValue codedValue:
                  string codedValueDomainName = codedValue.Name;
                  object codedValueDomainValue = codedValue.CodedValue;
                  break;
                case ContingentRangeValue rangeValue:
                  object rangeDomainMaxValue = rangeValue.Max;
                  object rangeDomainMinValue = rangeValue.Min;
                  break;
                case ContingentAnyValue contingentAnyValue:
                  // Any value type
                  break;
                case ContingentNullValue contingentNullValue:
                  // Null value
                  break;
              }
            }
          }
        }
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.ContingentValue
          ArcGIS.Core.Data.ContingentCodedValue

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.4 or higher.
    See Also