ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / Table Class / ValidateContingencies Method
RowBuffer to determine valid and invalid contingencies.
Example

In This Topic
    ValidateContingencies Method
    In This Topic
    Validate contingency constraints to distinguish between valid and invalid contingencies.
    Syntax
    public ContingencyValidationResult ValidateContingencies( 
       RowBuffer rowBuffer
    )
    Public Function ValidateContingencies( _
       ByVal rowBuffer As RowBuffer _
    ) As ContingencyValidationResult

    Parameters

    rowBuffer
    RowBuffer to determine valid and invalid contingencies.

    Return Value

    The contingency validation result, ContingencyValidationResult.
    Exceptions
    ExceptionDescription
    rowBuffer is null.
    A geodatabase-related exception has occurred.
    Example
    Validate contingent attribute values
    public void ValidateContingentValues(FeatureClass parcels, string zoningFieldName = "Zone", string taxCodeFieldName = "TaxCode")
    {
        using (RowBuffer rowBuffer = parcels.CreateRowBuffer())
        {
            // Insert values in a row buffer
            rowBuffer[zoningFieldName] = "Business";
            rowBuffer[taxCodeFieldName] = "TaxB";
    
            // Validate contingency values of the parcels' row 
            ContingencyValidationResult contingencyValidationResult = parcels.ValidateContingencies(rowBuffer);
    
            // Valid contingencies
            IReadOnlyList<Contingency> matchedContingencies = contingencyValidationResult.Matches;
            if (matchedContingencies.Count > 0)
            {
                // Create a row with valid contingency values
                parcels.CreateRow(rowBuffer);
            }
    
            // Invalid contingencies
            IReadOnlyList<ContingencyViolation> violatedContingencies = contingencyValidationResult.Violations;
            foreach (ContingencyViolation contingencyViolation in violatedContingencies)
            {
                ContingencyViolationType violationType = contingencyViolation.Type;
                Contingency violatedContingency = contingencyViolation.Contingency;
            }
        }
    }
    
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also