Skip to main content

Hi,

 

I want to be time efficient when updating a very long domain list in a SDE Geodatebase. I have created the new domain values in an excel document and would like to empty the current domain list and refill it with the values in this document.

The geodatabase of course contains a name for the domain list, a field for the code and for the description. The excel i structured in the same way; a column for the code and a column for the description. Therefore it's essentially a copy/paste job from excel to geodatabase.

 

Can anyone suggest at workflow with translators that can do such a thing?

In the future it would be hugely beneficial for me to have a workflow that would read through the list and only add/write the values from the excel file that are not already in the domain list.

 

Thanks for your time and tips,

Sofia

Hi Sofia,

For the filling the domain, I use a PythonCaller. I got the Python code from this ArcGIS page:

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.AddCodedValueToDomain_management("montgomery.gdb", "material", "1", "PVC")

Emptying the domain can be done by either deleting it or by removing the coded values. The last step would require you to know all the present values. If you delete the domain, you'll also have to recreate it and assign it to the relevant field(s).

Since you manage the domain values in an Excel, I would suggest keeping the status of each coded value as well. This way you'll only have to take action on those values that need to be added, deleted or perhaps changed.

The code for removing coded values can be found here:

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.DeleteCodedValueFromDomain_management("montgomery.gdb", "DistDiam", ["20","24"])


Reply