1

I'm trying to write a new domain and values in our ArcSDE database but I receive the following error:

Runtime error Traceback (most recent call last): File "", line 34, in File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 1317, in AddCodedValueToDomain raise e ExecuteError: ERROR 000800: The value is not a member of Gas Service Diameter Plastic PVC | Rectifier Manufacturer | Work Order Status | GasASTMF2897CSteelPipeType | Pipe Diameter Plastic PVC | Leak Survey Frequency..

Line 34) arcpy.AddCodedValueToDomain_management(gdb, domName, code, domDict[code])

Notes: The domain name is successfully created in the enterprise geodatabase but the coded values return an error.

Current ArcSDE Enterprise Geodatabase Version: 10.3.1.

Code:

#Import system modules import arcpy arcpy.env.workspace = "C:/Users/jnmiller/AppData/Roaming/ESRI/Desktop10.3/ArcCatalog" # Set local parameters domName = "test123" gdb = "GIS.sde" # Process: Create the coded value domain arcpy.CreateDomain_management(gdb, domName, "Description", "TEXT", "CODED") # List of domain values in load order domainList = ["1"] # Store all the domain values in a dictionary with the domain code as the "key" and the # domain description as the "value" (domDict[code]) domDict = {"1":"test 1"} # Process: Add valid material types to the domain # use a for loop to cycle through all the domain codes in the dictionary for code in domainList: arcpy.AddCodedValueToDomain_management(gdb, domName, code, domDict[code]) print "Finished!" 
4
  • Instead of using domainList can't you just loop through the domDict instead: for code in domDict: Commented Sep 26, 2017 at 16:28
  • @Dowlers I just tried what you suggested but it's still giving me the following error with arcpy.AddCodedValueToDomain_management(gdb, domName, code, domDict[code]) Runtime error Traceback (most recent call last): File "<string>", line 29, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 1317, in AddCodedValueToDomain raise e ExecuteError: ERROR 000800: The value is not a member of Gas Service Diameter Plastic PVC | Rectifier Manufacturer Commented Sep 26, 2017 at 16:40
  • Where is it finding the existing values Gas Service Diameter Plastic PVC | Rectifier Manufacturer...etc? Might the domain already exist? Can you domName to something new? Commented Sep 26, 2017 at 16:52
  • Also if the domain already exists I think only the owner can change it. Commented Sep 26, 2017 at 16:53

1 Answer 1

1

At first glance your python code has bad syntax. The for iteration should be indented like this:

for code in domainList: arcpy.AddCodedValueToDomain_management(gdb, domName, code, domDict[code]) 

Another error looks to be that you are calling a dictionary key which does not exist. domDict[code] will return nothing since the value "1" is not in your domainList.

1
  • I edited my code above with the correct syntax. The error is still valid while trying to add coded values. Commented Sep 26, 2017 at 13:36

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.