MLF

List Domains by Subtype?

Discussion created by MLF on Feb 27, 2012
Latest reply on Mar 2, 2012 by nmlebel
Hello!  I have a script which combs a geodatabase and returns each feature class and feature dataset which uses a domain, the name of the domain, and to which field the domain is applied.  When it hits a feature dataset with a subtype, it only lists the domains in use by the default subtype value, not the domains associated with the other subtype values.  How can I write a script which will list the domains set for each individual subtype in a feature dataset?  Thank you!

import arcpy
#Set workspace environment to geodatabase
arcpy.env.workspace = r"\\Gissrv1\017gisdatt\017GISDATA\Geodatabases\NDOT_Transportation.gdb"

#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
               
#Get list of feature datasets in geodatabase
FDs = arcpy.ListDatasets("*", "Feature")

#Loop through feature datasets in list
for FD in FDs:

        #List fields in feature dataset
        fields = arcpy.ListFields(FD)

        #Loop through fields
        for field in fields:

            #Check if field has domain
            if field.domain != "":

                #Print feature class, field, domain name
                print FD, ",", field.name, ",", field.domain

Outcomes