Further to my earlier question,I'm trying to develop a script that eventually should contain three parameters, feature layer, domain field and a new text field. How can i write a loop that will update domain descriptions to a new text field ? I understand i need to use arcpy.da.ListDomains but i have some trouble writing the update loop.Thanks
ArcGIS Desktop – Transfer Domain Descriptions from Coded Values to String Text in a New Field
arcgis-desktoparcpydomains
Best Answer
You could go two ways.
1) You could use Table To Domain (Data Management) GP tool after you have found out the domain name to export the domain values and descriptions into a geodatabase table and then run Join on the feature class and table and then calculate the field. To find out the domain name for a field in a feature class you need the code:
After that you can supply all the input parameters for the GP tool (you'll need to add a description field to the feature class first though). Refer to the Help page for details.
2) You could go with pure arcpy and Python. You basically has to obtain the domain object first with the arcpy.da.ListDomains first, and then refer to the description values in the returned dictionary.
Please extend the code to include the input parameters for feature class, obtaining the geodatabase it is stored in and the input field which has an assigned domain.