<?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 Storing NULL-value into row with not-null constraint in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120044#M3138</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Today I´ve encountered a really bad issue when stroing features to my geodatabase (I´m using a FileGDB, but colluegues of mine said it also occurs on SDE or MDB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a new feature and set one of its values to NULL using&lt;/P&gt;&lt;PRE class="line-numbers language-csharp"&gt;&lt;CODE&gt;IFeature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;set_Value&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;theFieldIndex&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;. As the field has a not-null-constraint on it (checked it in ArcCatalog)&amp;nbsp;I see its value is somehow converted to an empty string which I find really annoying. I´d expected to get an error when storing the feature as it violates the constraint. Swallowing the error and set it to an empty string is absolutely inacceptable as the empty string may be a valid value as well. However we can´t distinguish valid empty strings with invalid ones any more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this intended behaviour? If so can I bypass it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Nov 2016 09:43:44 GMT</pubDate>
    <dc:creator>CarstenSchumann</dc:creator>
    <dc:date>2016-11-18T09:43:44Z</dc:date>
    <item>
      <title>Storing NULL-value into row with not-null constraint</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120044#M3138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Today I´ve encountered a really bad issue when stroing features to my geodatabase (I´m using a FileGDB, but colluegues of mine said it also occurs on SDE or MDB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a new feature and set one of its values to NULL using&lt;/P&gt;&lt;PRE class="line-numbers language-csharp"&gt;&lt;CODE&gt;IFeature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;set_Value&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;theFieldIndex&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;. As the field has a not-null-constraint on it (checked it in ArcCatalog)&amp;nbsp;I see its value is somehow converted to an empty string which I find really annoying. I´d expected to get an error when storing the feature as it violates the constraint. Swallowing the error and set it to an empty string is absolutely inacceptable as the empty string may be a valid value as well. However we can´t distinguish valid empty strings with invalid ones any more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this intended behaviour? If so can I bypass it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2016 09:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120044#M3138</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2016-11-18T09:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Storing NULL-value into row with not-null constraint</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120045#M3139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Test the field before you set its value? &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;String&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;IsNullOrEmpty&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myString&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//do something&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;x ==null &amp;nbsp; -- &amp;nbsp; x==string.Empty &amp;nbsp;Tests if you need to determine one or the other?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why would you set a field to null when you have an non-null constraint within the database (sounds like a recipe for problems &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;) &amp;nbsp;Handle nulls and emptyness before doing any database transactions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:59:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120045#M3139</guid>
      <dc:creator>TedKowal</dc:creator>
      <dc:date>2021-12-11T06:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Storing NULL-value into row with not-null constraint</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120046#M3140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Carsten,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you try ?&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;IFeature&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444; border: 0px; font-weight: inherit;"&gt;set_Value&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;theFieldIndex&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;"&gt;DBNull.Value&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additional information about editing data in ArcMap;&amp;nbsp; with&amp;nbsp;AdvancedArcMapSettings.exe which is located at "C:\Program Files (x86)\ArcGIS\Desktop10.X\Utilities"&amp;nbsp;you can change the behaviour of storing empty strings as null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="AdvancedArcMapSettings.exe Storing empty strings as Null values" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/291393_AdvancedArcMapSettings_Null.PNG" style="width: 620px; height: 257px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Dec 2016 20:24:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120046#M3140</guid>
      <dc:creator>MuratKarahan</dc:creator>
      <dc:date>2016-12-27T20:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Storing NULL-value into row with not-null constraint</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120047#M3141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The question is not why I want to put null into a column with a non-null constraint, but why ArcGIS doesn´t complain when I try this. Imagine we have some client where we can enter values for new features. How should a user determine if he&amp;nbsp;may or may not enter NULL into a given field?&amp;nbsp;I´d expect an exception from ArcGIS in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The whole point of the constraint seems quite useless to me if ArcGIS automatically circumvents the problem by resetting the value and thus avoid the error in the first place. We could get rid of those constraints then.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 09:54:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120047#M3141</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2017-01-20T09:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Storing NULL-value into row with not-null constraint</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120048#M3142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Checking every value myself is quite overkill to me, as we have thousand of types with millions of attributes which I can´t check for `DBNull`. However as far as I understand the constraint should prevent exactly this, namely putting nulls into fields where it isn´t allowed. So why should I care myself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway the hint with the&amp;nbsp;advanced settings might help, but as we are creating our own desktop-client I´m not sure we even have this program. I will check this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 10:02:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/storing-null-value-into-row-with-not-null/m-p/120048#M3142</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2017-01-20T10:02:45Z</dc:date>
    </item>
  </channel>
</rss>

