Domain Field Returning Non-Domain Values

1435
17
Jump to solution
04-19-2023 03:57 PM
Labels (3)
minhomo28
New Contributor III

Hi, 

I currently have a field with domain applied to it. I copied over bunch of values to the domain field using field calculator. My expectation was that the domain will exclude all the non - domain values ( Null) and keep only the values that are in the domain list. Apparently, it is not happening. Non - domain values are still showing in the domain field.  Does anyone know how this could be fixed? 

Thanks. 

0 Kudos
1 Solution

Accepted Solutions
JoshuaSharp-Heward
Occasional Contributor III

The code is what's stored in the db and the description is what's shown. If you try to enter the description into the database it won't recognise it as a valid option. When digitising information in pro it will present you the description in the drop down but store the code behind the scenes. You can see that in action by switching off "show domain and subtype descriptions" check box in the attribute table.

So to successfully populate that data over you will have to find a way of converting those "description" values to their respective codes, I'd personally use a dictionary as a lookup table.

View solution in original post

0 Kudos
17 Replies
JoshuaSharp-Heward
Occasional Contributor III

Hi,

There's a button at the bottom of the "Field Calculator" dialogue box called "Enforce Domains" - your problems should be solved by ensuring it's checked before running your calculation https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-field.htm

0 Kudos
minhomo28
New Contributor III

Hi, 

Thanks for the reply. 

Yes, I have been trying to used this function and it has been giving me an error message and doesn't move any values over to the field.

 

 

0 Kudos
JoshuaSharp-Heward
Occasional Contributor III

Hi,

I've tested it on my end and it seems to work - have you set "allow null values" to no on your field with the domain? If so then it would be trying to set non-domain values to Null and then stop working as it's not allowed.

If not, can you post a screenshot of the error message?

0 Kudos
minhomo28
New Contributor III

Hi, 

My domain field do allow Null values. This would be the example of the error message I have been getting. 

minhomo28_0-1682094271538.png

 

 

0 Kudos
JoshuaSharp-Heward
Occasional Contributor III

Oh I thought the calculate field was failing, not completing with warnings. And it's not working for any of the records, even ones that look like they should work? Does your input data match the codes or the descriptions in the domain? 

0 Kudos
minhomo28
New Contributor III

Yes, it is giving a warning and not moving any data over to the domain field. I am pretty sure input data match with code descriptions. 

0 Kudos
minhomo28
New Contributor III

Could this be some sort of setting issue in my database ? 

0 Kudos
JoshuaSharp-Heward
Occasional Contributor III

Can you post a picture of the domain as well as some of the input data that should match the domain? 

0 Kudos
minhomo28
New Contributor III

Those input data should be moving over to domain field since they match the domain list, I believe. 

minhomo28_0-1682027731887.png

minhomo28_1-1682027766783.png

 

0 Kudos