Hi there,
so we want to remove a subtype from a field and create a new field with a domain that has the same values we use in the subtyped field. I used the remove subtype geoprocessing tool,it seemed to worked fine. I create a new field and calculated the values from the old subtyped field over, all is well. I am trying to delete the old field now and am unable to do it. Does anybody know how to do it, if even possible? Thanks for any advice!
Solved! Go to Solution.
Is there also a way to do the "Clear all subtypes" action with arcpy?
I used arcpy.management.RemoveSubtype to remove all subtypes, but then the field is still showing with an asterix and bold. Only when I go to Subtypes > Create/Manage > "select Clear all subtype...", the subtypes are really gone and the field is showing as other fields.
It seems strange that this can't be achieved by removing all subtypes using arcpy.management.RemoveSubtype.
did you find a solution ?
I am also trying to remove a field with arcpy after removing all the subtypes but still get this error :
ERROR 002557: Cannot delete field assetgroup
[EDIT] I found the solution :
arcpy.management.SetSubtypeField(
in_table=my_table,
field=None,
clear_value="CLEAR_SUBTYPE_FIELD"
)
Yes, that was the solution! I found this in my Git-repository:
subtype_code = "'1: Dijk';'2: Dam';'3: Duin';'4: Kunstwerk';'5: Bijzondere waterkerende constructie';'6: Hoge grond'"
arcpy.management.RemoveSubtype(in_table, subtype_code)
print('RemoveSubtype:', arcpy.GetMessages())
arcpy.management.SetSubtypeField(in_table,'','CLEAR_SUBTYPE_FIELD')
print('SetSubtypeField:', arcpy.GetMessages())
Will be a sad day when good old ArcCatalog goes away.....