MLF

Script Adding Numbers to End of Domains?

Discussion created by MLF on Feb 27, 2012
Latest reply on Feb 27, 2012 by MLF
Hello again!  Until I find a way to return a list of subtype field's domains, I have used this workaround:

1) Import feature class into a fresh file geodatabase
2) Set the default subtype field to "Interstate"
3) Run the script to return the field domains with an "Interstate" subtype
4) Set the default subtype field to "State Route"
5) Run the script to return the field domains with an "Interstate" subtype
repeat, repeat...

Oddly, the output includes the addition of an underscore and a number after some, but not all of the results (see attached).  What could be causing this?

Thank you!

Here's the script:

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

Attachments

Outcomes