Select to view content in your preferred language

Removing unique constraint in ArcGIS Online.

3164
15
03-20-2019 11:14 AM
BrookeNix1
New Contributor

I'm trying to remove the unique constraint from a field in ArcGIS Online.  I unchecked the box to remove the unique constraint, AGOL says is is deleting the index.  It never deletes.  How do I make this setting stick?

After waiting awhile I receive this error.

Validation failed: Field does not contain unique values. Remove duplicates and try again

0 Kudos
15 Replies
MikeMinami
Esri Notable Contributor

Richard,

Sorry, false alarm. I had a duplicate value.

What I'm looking for is to see if the server is returning a more detailed error message. Here's what to do.

1. Navigate to the field property page

2. Open the Chrome Dev tools by simultaneously clicking <CTRL><SHIFT><i>. Click the Network tab and the Response subtab.

3. Edit the unique property, check the box and click Save.

4. Check the Dev Tools window and click the last request

Do you see a different message than what's shown above?

Mike

0 Kudos
JenAmes
Regular Contributor

I'm having this issue as well, that I'm trying to make a field  unique, but receiving the error that there are duplicates. There are not duplicates, and I've gone through and checked for any null/empty/blank options in the list and there are not. I have not entered any data yet, as it has yet to be collected, is this possibly why? 

 

The data is meant to be used in a publicly viewable app for residents to find where the banner of their military veteran family member has been hung in town. The banners have not been hung yet, but I'm setting up the data for our public works crew to select names rather than manually typing them in, leading to a lot of potential spelling mistakes. I need to be able to enable search on the name field for the map/application so residents can easily find their banner, but I can't seem to do this and thought making the Name field unique would fix this, but I can't make it unique. I saw a solution later in this thread of adding code to the JSON, but either I don't know where the right place is to enter it in the JSON or I did it wrong, because the addition was rejected.

0 Kudos
KhaledHassen
Esri Contributor

Hi Richard,

You will need to turn on schema changes on the view you have.

https://services1.arcgis.com/byI4kn9uGfeTFbS1/ArcGIS/rest/services/Scottish_Wildlife_Trust_reserve_b... 

To do this, you will need to go the admin API of the view:

https://services1.arcgis.com/byI4kn9uGfeTFbS1/ArcGIS/admin/rest/services/Scottish_Wildlife_Trust_res.../updateDefinition

Then use the following json:

{

    "sourceSchemaChangesAllowed" : true

}

Then add the index you need. I think this should resolve your issue. If not pl. let me know.

Khaled Hassen

Online Feature Service Dev Lead.

0 Kudos
MikeMinami
Esri Notable Contributor

Richard,

The question for me is why does this layer have SourceSchemaChangesAllowed set to false? Can you tell us more about your layer? How did you publish it? Is it editable? If so, what are the edit settings? I see that there is one view layer, how have you configured that layer?

The few layers of mine I looked at don't have that property set to false, so I'm wondering if some layer configuration set it that way.

thanks,

Mike

0 Kudos
RichardSiller
Emerging Contributor

Hi Both,

Thanks very much for your help. I tried to set SourceSchemaChangesAllowed to true for both the source feature service and the view layer but whilst the updating process appeared to work, the change didn't seem to apply. 

Given the problem was the view layer, I ended up just deleting it, setting the unique property and then recreating the view. 

I really should have thought that the view was getting in the way - it's not the first time it's caused me problems and is in fact the very reason I wanted to set the unique property in the first place. The source layer gets updated regularly and I used to just do a full update. The view layer now prevents this but I was advised that appending with a unique identifier should work instead.

I originally published via zipped shapefile and the view is the output of a join. I wanted to display some descriptive popup text for each feature but the maximum string length of a shapefile was a constraint. I ended up just joining the polygons to a CSV file containing the text.

Thanks again, 

Richard

0 Kudos
Cesar_Aguilera
Emerging Contributor

hello i'm having a similar issues but the problem is that i can't enable the option for unique values, show an error that said that i have duplicate value, i take a screenshot for the console in chrome, i saw in the conversation some ask for that. 

 

arcgis online error.png

0 Kudos