<?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 Unexpected behavior around unique constraint on field in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240795#M11897</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have taken advantage of the newly added capability of setting a unique constraint on a field in a hosted feature layer. I am seeing some odd behavior around that functionality.&amp;nbsp; Here's how to reproduce the behavior&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a new hosted feature layer in AGOL&lt;/LI&gt;&lt;LI&gt;Add a text field, lets call it '&lt;STRONG&gt;testid&lt;/STRONG&gt;'&lt;/LI&gt;&lt;LI&gt;Set a unique constraint on&amp;nbsp;&lt;STRONG&gt;testid&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Add the hosted feature layer to a new map&lt;/LI&gt;&lt;LI&gt;Use the Map Viewer Edit tool to create a new feature and do not enter a value for&amp;nbsp;'&lt;STRONG&gt;testid'. &lt;/STRONG&gt;Save that feature&lt;/LI&gt;&lt;LI&gt;Now try to create another new feature&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The system wont let me create a new feature. Instead, after clicking the place on the map where i want to add the new feature, no new feature is added and a popup window is displayed with the values from another&amp;nbsp;feature in the hosted feature layer.&amp;nbsp; If i go back to feature with the missing value for &lt;STRONG&gt;testid&lt;/STRONG&gt; and populate the field with a unique value, all goes back to working as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect it's happening because behind the scenes a new feature is created with 'null' or empty (or default if set) values for each attribute. And when the system sees a duplicated value, i.e. null/empty value for the field &lt;STRONG&gt;testid&lt;/STRONG&gt;, the system can't handle that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone else see this behavior? Is this the expected behavior?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Apr 2018 20:01:25 GMT</pubDate>
    <dc:creator>Trippetoe</dc:creator>
    <dc:date>2018-04-20T20:01:25Z</dc:date>
    <item>
      <title>Unexpected behavior around unique constraint on field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240795#M11897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have taken advantage of the newly added capability of setting a unique constraint on a field in a hosted feature layer. I am seeing some odd behavior around that functionality.&amp;nbsp; Here's how to reproduce the behavior&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a new hosted feature layer in AGOL&lt;/LI&gt;&lt;LI&gt;Add a text field, lets call it '&lt;STRONG&gt;testid&lt;/STRONG&gt;'&lt;/LI&gt;&lt;LI&gt;Set a unique constraint on&amp;nbsp;&lt;STRONG&gt;testid&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Add the hosted feature layer to a new map&lt;/LI&gt;&lt;LI&gt;Use the Map Viewer Edit tool to create a new feature and do not enter a value for&amp;nbsp;'&lt;STRONG&gt;testid'. &lt;/STRONG&gt;Save that feature&lt;/LI&gt;&lt;LI&gt;Now try to create another new feature&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The system wont let me create a new feature. Instead, after clicking the place on the map where i want to add the new feature, no new feature is added and a popup window is displayed with the values from another&amp;nbsp;feature in the hosted feature layer.&amp;nbsp; If i go back to feature with the missing value for &lt;STRONG&gt;testid&lt;/STRONG&gt; and populate the field with a unique value, all goes back to working as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect it's happening because behind the scenes a new feature is created with 'null' or empty (or default if set) values for each attribute. And when the system sees a duplicated value, i.e. null/empty value for the field &lt;STRONG&gt;testid&lt;/STRONG&gt;, the system can't handle that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone else see this behavior? Is this the expected behavior?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2018 20:01:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240795#M11897</guid>
      <dc:creator>Trippetoe</dc:creator>
      <dc:date>2018-04-20T20:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behavior around unique constraint on field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240796#M11898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This looks like a bug and better error messaging is needed.&amp;nbsp;If you were to run into the issue in the future, would you prefer to have a unique field created and entered for such a field or receive an error message indicating that the field entered is not unique?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd suggest contacting support services so a trackable bug can be logged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kelly&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Apr 2018 22:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240796#M11898</guid>
      <dc:creator>KellyGerrow</dc:creator>
      <dc:date>2018-04-25T22:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behavior around unique constraint on field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240797#M11899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey &lt;A href="https://community.esri.com/migrated-users/241508"&gt;Tom Rippetoe&lt;/A&gt;!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saw &lt;A href="https://community.esri.com/migrated-users/3063"&gt;Kelly Gerrow&lt;/A&gt;'s message here. We have logged a bug for this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUG-000113512 Unable to create new features in a Hosted Feature Service that has a field with the unique constraint if a feature was added without a value in the constrained field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should appear on our support.esri.com in a couple days and/or if you submit a Case to Support Services we can attach you to it for additional tracking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Stephanie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2018 19:54:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240797#M11899</guid>
      <dc:creator>StephanieWendel</dc:creator>
      <dc:date>2018-04-26T19:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behavior around unique constraint on field</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240798#M11900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kelly and Stephanie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for tracking this issue and creating the bug report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/people/KGerrow-esristaff"&gt;KGerrow-esristaff&lt;/A&gt;, I think there are two separate use cases here: 1) editing existing data and 2) creating new data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the first case, i think an big, bright error message indicating that the value entered fails the 'uniqueness constraint' would be most helpful.&amp;nbsp; Currently, AGOL simply deletes the duplicated value, leaving the input empty.&amp;nbsp; That has caused us some problems when we didn't notice that the value we entered was replaced by a blank value (that's what got us stuck in the second use case).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second case is a bit harder to work thru given AGOLs current pattern of creating a new record in the database as soon as the geometry is created. I don't know how it would/could work that AGOL hold the feature in memory, checking that all attributes pass their various constraints, and then having the user click a 'save' or 'insert' or some such button to send the data to the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully this helps. I love a good architecture discussion - it'd be interesting to know how you guys think about situations like this.&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2018 21:14:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/unexpected-behavior-around-unique-constraint-on/m-p/240798#M11900</guid>
      <dc:creator>Trippetoe</dc:creator>
      <dc:date>2018-04-26T21:14:11Z</dc:date>
    </item>
  </channel>
</rss>

