<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: AddCodedValueToDomain, how to add an empty string value in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583671#M45768</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Randy, thanks for the response. Yes, "&lt;SPAN style="background-color: #ffffff;"&gt;I don't think it is possible to have a coded value domain where" the code is an empty string.&amp;nbsp; That's why I posted this question. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;ESRI hasn't documented whether it is or isn't possible, but trial and error indicates that it's not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I suspect that our workgroup has mis-used the isNullable option, with the intention of allowing empty values. A field that isNullable can be deleted from the attribute table.&amp;nbsp; The field is REQUIRED, whether it contains values, or not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;My understanding is that a database null value is quite different than storing a 6-characer string, "&amp;lt;Null&amp;gt;", which is what ESRI's ArcMap table user interface is attempting, when it throws the&lt;SPAN&gt;&amp;nbsp;error that "This field will only store string values with up to 2 character(s)".&amp;nbsp; I may start a separate thread on that topic, but hate wasting time spitting into the wind, complaining about ESRI software, unless it's a stupid-user-problem and I might learn the error of my ways from the GIS community.&amp;nbsp; If I solve either issue, I'll post the workaround or solution.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Jun 2019 12:22:24 GMT</pubDate>
    <dc:creator>JonHall</dc:creator>
    <dc:date>2019-06-04T12:22:24Z</dc:date>
    <item>
      <title>AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583669#M45766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a code snippet we're using to create a domain, and add values to it, for the purpose of constraining street name prefix directionals:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.CreateDomain_management(GeodatabaseName, "StreetNameDirectional", "prefix directional of parsed street name", "TEXT", "CODED")
domDict = {"N":"North", "S": "South", "E": "East", "W": "West", "NE": "Northeast", "NW": "Northwest", "SE": "Southeast", "SW": "Southwest"}
for code in domDict: 
 arcpy.AddCodedValueToDomain_management(GeodatabaseName, "StreetNameDirectional", code, domDict&lt;PRE class="lia-code-sample line-numbers language-none"&gt;)&lt;/PRE&gt;&lt;P&gt;In ArcMap's Table interface, while editing a row, the 8 values and descriptions appear in the combo-box list for &lt;SPAN&gt;fields that have that domain applied. So far, so good.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;However, after a row has a value of "N" in that field, there is no way to change it from "N" back to none, i.e. an empty string, using the&amp;nbsp;&lt;SPAN&gt;combo-box list&lt;/SPAN&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can use the Field Calculator to set it&amp;nbsp;equal to "", an empty string, but that's not an intuitive solution. I want an empty string value with a description of "none".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ArcCatalog tree, Database Properties, Domain tab, I tried adding a 9th row to the StreetNameDirectional domain with no value, and Description = "None". Click Apply, looks okay, close ArcCatalog, and there's no 9th row of domain values &amp;amp; descriptions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adding two double-quotes as the 9th row Value for the domain, with&amp;nbsp;&lt;SPAN&gt;Description = "None", only succeeds in adding a pair of double-quote ASCII characters in the prefix directional field.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to do this programmatically, using arcpy.&lt;/SPAN&gt;AddCodedValueToDomain_management, but I can't even do it through the ArcCatalog user interface. I can't find anything documented RE: including an empty string in a coded value domain.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should add a related annoyance, that's more trivial: The field is nullable, so "&amp;lt;Null&amp;gt;" appears at the top of the&amp;nbsp;&lt;SPAN&gt;combo-box list.&amp;nbsp; I don't want the user to choose a null value, I want an empty string value; and ArcMap won't let you select &amp;lt;Null&amp;gt; from the list, throwing an error that "This field will only store string values with up to 2 character(s)".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance for any assistance you may provide.&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583669#M45766</guid>
      <dc:creator>JonHall</dc:creator>
      <dc:date>2021-12-12T16:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583670#M45767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think it is possible to have a coded value domain where the "code" is None/Null.&amp;nbsp; To have an option of "&amp;lt;Null&amp;gt;" show up in the domain selections (where the actual code stored is a NULL value), you need to set the field using the domain to "Allow NULL Values".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="449553" alt="directional domain &amp;lt;Null&amp;gt; example" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/449553_directional.png" /&gt;&lt;IMG __jive_id="449554" alt="field properties" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/449554_field_properties.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Typically, I set the default value of my fields using domains to use a code like "?" or "NA".&amp;nbsp; These would then display a description of "None", "Missing" or a prompt to "Make a selection".&amp;nbsp; I would then set allow null values to "No".&amp;nbsp; I would set any fields with a null to this default value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 03:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583670#M45767</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2019-06-04T03:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583671#M45768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Randy, thanks for the response. Yes, "&lt;SPAN style="background-color: #ffffff;"&gt;I don't think it is possible to have a coded value domain where" the code is an empty string.&amp;nbsp; That's why I posted this question. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;ESRI hasn't documented whether it is or isn't possible, but trial and error indicates that it's not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I suspect that our workgroup has mis-used the isNullable option, with the intention of allowing empty values. A field that isNullable can be deleted from the attribute table.&amp;nbsp; The field is REQUIRED, whether it contains values, or not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;My understanding is that a database null value is quite different than storing a 6-characer string, "&amp;lt;Null&amp;gt;", which is what ESRI's ArcMap table user interface is attempting, when it throws the&lt;SPAN&gt;&amp;nbsp;error that "This field will only store string values with up to 2 character(s)".&amp;nbsp; I may start a separate thread on that topic, but hate wasting time spitting into the wind, complaining about ESRI software, unless it's a stupid-user-problem and I might learn the error of my ways from the GIS community.&amp;nbsp; If I solve either issue, I'll post the workaround or solution.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:22:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583671#M45768</guid>
      <dc:creator>JonHall</dc:creator>
      <dc:date>2019-06-04T12:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583672#M45769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We may be in agreement, but to be clear, "&amp;lt;Null&amp;gt;" is not a six-character string or the description of a coded value.&amp;nbsp; It is the file geodatabase's representation&amp;nbsp;that a null value is&amp;nbsp;in the field.&amp;nbsp; When it appears in a drop-down list, like a display of a database table in edit mode or an application like Collector, when "&amp;lt;Null&amp;gt;" is selected, a null value will be placed in the field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 16:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583672#M45769</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2019-06-04T16:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583673#M45770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right, Randy, that's the behavior I expected, but ArcMap throws that error&lt;/P&gt;&lt;P&gt;message, and no null value is saved in the field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 17:38:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583673#M45770</guid>
      <dc:creator>JonHall</dc:creator>
      <dc:date>2019-06-04T17:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583674#M45771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What type of geodatabase are you working with?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jun 2019 21:28:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583674#M45771</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2019-06-04T21:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583675#M45772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The file geodatabase schema, created with arcpy script, defining the fields&lt;/P&gt;&lt;P&gt;and domains, has been loaded into enterprise SDE on SQL Server.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2019 01:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/583675#M45772</guid>
      <dc:creator>JonHall</dc:creator>
      <dc:date>2019-06-05T01:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: AddCodedValueToDomain, how to add an empty string value</title>
      <link>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/1096808#M62310</link>
      <description>&lt;P&gt;I am also interested in this. Using an SDE domain, is there a way to allow the user to choose blank/empty string from the domain pick-list instead of choosing null? I want the actual data/value stored to be an empty string....not null.&lt;/P&gt;&lt;P&gt;Example: when a road name has a pre-directional (north, east, south, or west) the user would choose the appropriate value from the domain ("N", "E", "S", "W"), but for road names that do &lt;EM&gt;not&lt;/EM&gt; have a pre-directional at all, the user would choose a blank/empty string 'value').&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nesw.png" style="width: 121px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22669i97A485D1932B4792/image-size/large?v=v2&amp;amp;px=999" role="button" title="nesw.png" alt="nesw.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 15:53:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addcodedvaluetodomain-how-to-add-an-empty-string/m-p/1096808#M62310</guid>
      <dc:creator>Matt-Goodman</dc:creator>
      <dc:date>2021-09-09T15:53:07Z</dc:date>
    </item>
  </channel>
</rss>

