AnsweredAssumed Answered

Unexpected behavior around unique constraint on field

Question asked by tom.rippetoe on Apr 20, 2018
Latest reply on Apr 26, 2018 by tom.rippetoe

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.  Here's how to reproduce the behavior

  1. Create a new hosted feature layer in AGOL
  2. Add a text field, lets call it 'testid'
  3. Set a unique constraint on testid
  4. Add the hosted feature layer to a new map
  5. Use the Map Viewer Edit tool to create a new feature and do not enter a value for 'testid'. Save that feature
  6. Now try to create another new feature

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 feature in the hosted feature layer.  If i go back to feature with the missing value for testid and populate the field with a unique value, all goes back to working as expected.


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 testid, the system can't handle that?


Anyone else see this behavior? Is this the expected behavior?