Portal Hosted Feature Layer: Add Unique Constraint

721
5
04-13-2022 02:45 PM
Blevins_Mark
Occasional Contributor

This article describes how you can add a unique constraint to a field of a hosted feature layer in AGOL. Is this functionality not present in Enterprise Portal? The edit button is not present when trying to add a unique constraint to a hosted feature layer field in enterprise.

0 Kudos
5 Replies
Rich
by
New Contributor II

I am experiencing the same issue. Is there any help available with this?

Thanks.

0 Kudos
GerberMatthew
New Contributor III

I am also experiencing the same issue.   The profile of the feature service is there on the portal item data page, but not editable.  I assumed it may need to be set on the publish side, but can not find the "Switch".

0 Kudos
GerberMatthew
New Contributor III

I think I have found a work around.

https://gis.stackexchange.com/questions/132530/enforcing-unique-values-in-field-when-editing-in-arcm...

The solution in this URL is the one posted by Farid.  Where an attribute index was created and the "Unique" checked.   I was able to successfully create a unique value over 2 attributes by adding both attributes into the "selected fields" the index was created on.

Eg.  I have 2 attributes "AdministrationArea" and "ObservationID"... ObservationID has to be unique per AdministrationArea.... but each AdministrationArea can each have an ObservationID which exists in another admin area.     

[Area A, ID = 1]

[Area A, ID = 2]

[Area B, ID = 1] 

I have not break tested this yet, but looks promising.  Using the smart editor widget in WAB returns the non-user friendly database error text to the user.   But at least the user is getting something to say "Hey your ID value already exists in the feature class"

0 Kudos
Sara_
by
New Contributor III

Hi

Are you able to provide screenshots what you did? I'm trying to follow. 

I'm trying to use this Unique Constraint functionality on Enterprise. We have samplers using Field Maps submitting duplicate QR codes. I'm also having this issue of no edit button, although it exists on AGOL. 

Thanks 

Sara

0 Kudos
GerberMatthew
New Contributor III

Hi Sara,

 

Right click the feature class and go to properties --> Indexes --> Click "Add" --> Give the index a name; Check the "Unique" check box; Select the attributes the accumulation/concatenation of their values need to be unique by --> Click OK.

GerberMatthew_0-1670370485791.png

I think this will only work when editing in "Online" mode where transactions are to the database.

0 Kudos