Skip to main content

Add a unique constraint to a field

You can apply a unique constraint to individual fields in sublayers in a hosted feature layer. When you apply a unique constraint, the relational store ensures that there are no duplicate values stored in the field. You might do this for fields you intend to use to uniquely identify features in the layer. When editors update attributes or add features to a layer, the unique constraint ensures the editor does not add duplicate values. When you append or update data in the feature layer, if the file you use to append or update fields contains a value that violates the unique constraint, the append or update operation will fail.

In most cases, unique constraints are applied to numeric fields, but you can set a unique constraint on any field type except system fields such as ObjectID, GlobalID, and FID.

The layer owner and the organization administrator can set unique constraints on fields in hosted feature layers and hosted tables. Members of a shared update group to which the layer is shared can also set a unique constraint on a field in the layer.

Note:

You cannot add a unique constraint to a layer that participates in a joined hosted feature layer view.

Follow these steps to add a unique constraint to a field in a sublayer of a hosted feature layer or hosted table:

  1. Sign in to the organization.

    You must be signed in as the layer or table owner, an organization administrator, or a member of a shared update group to which the layer or table is shared.

  2. Open the item page for the hosted layer.

  3. Click the Data tab.

  4. If the hosted layer contains more than one sublayer, use the Layer drop-down menu to choose the sublayer to configure.

  5. Click the Fields button to change to the Fields view.

  6. Click the display name of the field to which you will add a unique constraint to open the details for the field.

  7. Click the Edit button Edit next to Unique values and change the setting.

    • To require that the field contain unique values, choose Require unique values and click Save.

    • To allow duplicate values in the field, choose Do not require unique values and click Save.

    When you require unique values, ArcGIS Enterprise confirms that existing values in the field are unique. If they are, the unique constraint is added. If values are not unique, you cannot set a unique constraint on this field until you edit the field so it contains only unique values.