Identify features referenced by domain

Idea created by bpangtay on Jun 23, 2015
    New
    Score40
    • mtorres_training
    • kreuzrsk
    • bpangtay
    • joeb@cwd
    Need to add a tool in ArcToolbox to identify features that use a particular domain.

    This is tool would compliment the existing tools: Delete Domain and Remove Domain From Field since this information is required to use these tools.

    I was provided with a Python script to accomplish this task:

    import arcpy
    import string
    from arcpy import env 
    import os 

    #Set workspace environment to geodatabase
    arcpy.env.workspace = r"Database Connections\Connecting to database.sde"

    #Get list of feature classes in geodatabase
    FCs = arcpy.ListFeatureClasses()


    #Loop through feature classes in list
    for FC in FCs:

            
        #List fields in feature class
        fields = arcpy.ListFields(FC)


        #Loop through fields
        for field in fields: 

            #Check if field has domain
            if field.domain != "":
        
                #Print feature class, field, domain name
                print FC, field.name, field.domain