Select to view content in your preferred language

arcpy on ArcDesktop 10.3 issue with assigning domains to fields

6371
5
01-27-2015 04:47 PM
ChrisMowry
New Contributor II

I have a python script I wrote that reuses domains. I had no issues with 10.2 but just upgraded to 10.3 and now the script throws an error (see below) if I assign the same domain to multiple fields in the same feature class. Any suggestions other than the obvious fix of creating a new domain for each field?

"ExecuteError: ERROR 999999: Error executing function.

Item relationship between the items already exists.

The operation was attempted on an empty geometry.

Failed to execute (AssignDomainToField)."

Thanks,

Chris

0 Kudos
5 Replies
MarianneCaouette1
New Contributor

Sorry, this is not an answer, but a related problem. I can't do a "batch" of the function Assign Domain to Field for all the subtypes of my GDB. Same operation is working in ArcGIS 10.0, but not on the computer we just upgrade to 10,3. I obtain the same Error message. Any idea? Is 10,3 so different that I should update de GDB?

0 Kudos
ChrisMowry
New Contributor II

Hey Francois,

Here is how I got it to work. It seems to throw an error when it assigns the same domain to a different subtype, but does assign the domain to the field. So using the try/except, keeps the script running.

subtypeVal = [1,2,3,4,5]

for value in subtypeVal:

    try:

        arcpy.AssignDomainToField_management(FeatureClass, Field, Domain, value )

    except:

        pass

AlessandroRussodivito
Esri Contributor

I have the same problem on a 10.3.1 environmemt

I found out that your "try ... except" is not a good workaround because a sync-enable feature service published from "that" FeatureClass seems to give a corrupted SQLite goedatabase replica (Invalid XML if you catch the OpenAsync of a SQLite offline gdb via Runtime SDK).

Has anyone found the same connection from this error and the offline SQLite gdb InvalidXML error?

Does anyone knows what "Item relationship between the items already exists" exactly means?

0 Kudos
JulianInskip
Occasional Contributor

I am not sure if this is still valid, but I was having the same issue in 10.4.1. I found that I had to Assign the Domain to the field first, then I was able to add the Domain to the SubTypes (this seems to also go for when you need to delete a domain associated with SubTypes). So in you sample code you would need to add an initial AssignDomainToField just for the field. See second line below:

subtypeVal = [1,2,3,4,5]
arcpy.AssignDomainToField_management(FeatureClass, Field, Domain)
for value in subtypeVal:
    try:
        arcpy.AssignDomainToField_management(FeatureClass, Field, Domain, value )
    except:
        pass‍‍‍‍‍‍‍‍‍‍‍‍‍‍
pamarendra
New Contributor

Hi Chris Mowry,

See the below code & Image For one Feature class & subtypes AssignDomain to Field.

import arcpy
arcpy.AssignDomainToField_management("WS_Fitting","DIAMETER","CD_Diameter",["1: 11 Bend Fitting","2: 22 Bend Fitting"])

Thanks

Santhosh