Select to view content in your preferred language

How do I prevent duplicating code value in domain

794
7
05-08-2023 08:57 AM
Labels (1)
PLadd
by
Occasional Contributor III

I use coded domains for all of my streets (900+ records - don't judge me).  When I need to add a new street to the domain table, I want to use the next available number.  I know I can sort by code, scroll down to the end and add one to the last number for my new record.

My question is how do I avoid duplicating a number in the coded value field that is already being used? 

I tested what might happen by adding a new record duplicating and existing coded value.  I was surprised I didn't get a popup warning me I was violating data integrity.  I believe what happens is that the original coded value gets deleted. 

0 Kudos
7 Replies
RhettZufelt
MVP Notable Contributor

How are you trying to 'add' it?  Pro warns me and greys out the save button if I have duplicates. 

RhettZufelt_0-1683563629805.png

 

R_

 

0 Kudos
PLadd
by
Occasional Contributor III

I go to the bottom of the list of domains, add a new record

PLadd_0-1683565646349.png

and click the Save button.  The save takes.

PLadd_1-1683565790424.png

Then when I query the coded value in a feature class and the new domain value shows.

PLadd_2-1683565860280.png

Then I close/open the domain table and "WALLINGFORD LINE" is gone and only "test" remains:

PLadd_3-1683565979697.png

 

 

0 Kudos
RhettZufelt
MVP Notable Contributor

OIC, I learned decades ago to not use numeric Domains for text fields in ESRI (mainly for lookup issues across software/platforms, but now yet another reason), so when I saw street names (though you clearly mentioned the number), didn't think to test that.

However, using numeric fields I can reproduce your issue in both 2.9.3 and 3.1.1.....

If I set up a domain with Long/Short, add an existing domain to it and save, it WILL overwrite the current value with no error/warning at all.

Probably best to start a tech support call with ESRI on this so it can get in the que to eventually, maybe, think about fixing it.

R_

 

0 Kudos
PLadd
by
Occasional Contributor III

@RhettZufelt I appreciate you taking the time to look into this and identifying the underlying issue.  I will start a tech support case and follow-up here if anything comes of it.

0 Kudos
RhettZufelt
MVP Notable Contributor

@PLadd 

Upon furthur testing, I see both the GP tool (Table to Domain) and arcpy.management.TableToDomain both work as expected, and will give an error if you try to append a duplicate domain value.

Might be a workaround in the meantime.

R_

0 Kudos
PLadd
by
Occasional Contributor III

Yes, this is a good workaround.  I can setup a temp table to be used with Table to Domain and append it to the appropriate domain as needed. 

Here's the error I got doing Table to Domain (append) that I would expect if I were simply editing an existing domain value.  Thanks again @RhettZufelt.

PLadd_0-1683568940573.png

 

0 Kudos
PLadd
by
Occasional Contributor III

ESRI has escalated this to  #BUG-000158369

0 Kudos