[GIS] Coded value domains, Allow Null Values = no. Why does it default to zero

arcgis-10.2arcgis-desktopdomainsfile-geodatabase

Trying to use Coded Value Domains with Allow Null Values = No in a File GDB, ArcGIS 10.2. Through an GIS.SE question that I can't seem to find again, I found this through ArcGIS help:

"Note:
The geodatabase model is such that it will insert an empty value (numeric = 0, text = "") instead of a database NULL if, and only if, the field in the database has a NOT NULL constraint on it."

I get that this prevents Null values from being entered. But it defaults to blanks or zeros, which overrides my domains when a new feature is created! So someone can add a feature and accept 0 in a field that has a coded value domain, which to some degree defeats the purpose of having the Coded Value domain to force certain values.

What I would like is to force someone to select a value before it will allow the feature to be saved. I thought this was the point of a domain?

Am I missing something or not understanding something about databases? Is this just a limitation, or am I trying to get it to do something that it inherently shouldn't do?

Best Answer

The behaviour you describe is correct. All because you give a field a domain and set field to not allow NULLS does not mean that ArcMap will capture the fact they the user may not touch that field during editing. So when they save edits they can insert a nothing even though you have a domain.

There are 2 routes here:

  1. Accept this odd behaviour then do some post edit validation through the Validate Features button on the Editor tool bar.
  2. Add to your domain list an "Unknown" value lets say UNK code and set that to be the default value for the field. Thus a user can create a feature, not touch that field but it has a valid domain value (in this case UNK). It would be up to you/them to then search for UNK values and resolve.
Related Question