grjakel

Print subtypes

Discussion created by grjakel on Dec 19, 2013
Latest reply on Dec 20, 2013 by achapkowski-esristaff
I'm trying to use this script to list subtypes in  a database

for stcode, stdict in subtypes.iteritems():
    print('Code: {0}'.format(stcode))
    for stkey in stdict.iterkeys():
        if stkey == 'FieldValues':
            print('Fields:')
            fields = stdict[stkey]
            for field, fieldvals in fields.iteritems():               
                print(' --Field name: {0}'.format(field))
                print(' --Field default value: {0}'.format(fieldvals[0]))
                if not fieldvals[1] is None:
                    print(' --Domain name: {0}'.format(fieldvals[1].name))
        else:                   
            print('{0}: {1}'.format(stkey, stdict[stkey]))

I keep getting the following error

Runtime error
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'subtypes' is not defined

I'm trying to add the path to my dataset into line 1 (in the parenthesis)

for stcode, stdict in subtypes.iteritems():

Any suggestions would be appreciated.

Thanks

Outcomes