CreateContingentValueAttributeRules

Title  Contingent Values to Attribute Rules

Description

Create a series of attribute rules from the Contingent Values.

Usage

          
The target table must have field groups and contingent values set up.
Restrictive field groups generate Constraint and Non-Restrictive field groups generate Validation Attribute Rules.

License

Standard

Syntax

CreateContingentValueAttributeRules (input_table, ar_type, attribute_rules_file)

Parameter Explanation Data Type
input_table Dialog Reference

The table with field groups.

DETable
ar_type Dialog Reference

Defines the attribute rule type:

  • Defined by Field Group - The type of the field group defines the rule type.
  • Validation - All rules will be defined as Validation rules.
  • Constraint - All rules will be defined as Constraint rules.

GPString
attribute_rules_file Dialog Reference

The output .csv file containing attribute rules.

DEFile

Code Samples

CreateContingentValueAttributeRules example 1 (Python window)

Creates validation attribute rules for the contingent values in the StructureJunction class.

import arcpy

arcpy.udms.CreateContingentValueAttributeRules("StructureJunction", "VALIDATION", "D:/data/StructureJunction.csv")

CreateContingentValueAttributeRules example 2 (stand-alone script)

Creates CSV files for all tables in the workspace that have field groups.

import os

import arcpy

workspace = "D:/data/network.gdb"
ar_type = "FIELDGROUP"


def walk(gdb):
    for child in arcpy.Describe(gdb).children:
        yield child
        yield from getattr(child, "children", [])


for item in walk(workspace):
    if not getattr(item, "fieldGroups", []):
        continue  # No field groups on this table.

    print(item.name)
    arcpy.udms.CreateContingentValueAttributeRules(
        input_table=item.catalogPath,
        ar_type=ar_type,
        attribute_rules_file=os.path.join(os.path.dirname(workspace), f"{item.name}.csv"),
    )