Entity Unique Constraints

Unique constraints allow you to define attributes or combinations of attributes that must have unique values for each entity record. For instance, in an entity that stores personal data, you may want to set up the Social Security Number to be unique for each person. Or, in an entity that stores invoices, you may want to configure the combined invoice number and invoice series to be unique for each invoice.

Once enabled, unique constraints prevent record inserts or updates that do not meet the defined uniqueness criteria. You can define multiple constraints for the same entity.

Create a Unique Constraint for an Entity

  1. Open the Main Menu () and select Evolutive Data Core > Data Model Explorer.
  2. Double-click the entity for which you wish to add uniqueness constraints, expand the Entity Unique Constraints section and click Insert.
  3. In the Add Entity Unique Constraint page:
    1. Enter a Name for the constraint. You cannot have multiple constraints with the same name for the same entity, but you can reuse constraint names on different entities.
    2. Optionally enter a Display Name for the constraint. This is the name that will be displayed in the user interface.
    3. Optionally enter a Decription for the constraint.
  4. Click Save and Reload ().

Add Unique Constraint Attributes

  1. In the Edit Entity Unique Constraint page, go to Entity Unique Constraint Attributes section and click Insert.
    NOTE  
    You cannot insert attributes in enabled constraints. If your constraint is enabled, you must disable it first (see Entity Unique Constraints for details).
  2. Select an Attribute that you wish to include in the constraint, from the drop-down list. The Name field will be filled-in automatically.

  3. Click Save and Close ().
  4. Repeat for any additional attributes you wish to include in your constraint. If you add multiple attributes, the constraint will evaluate if all the attributes combined are unique, not if each attribute is unique.

Enable/Disable a Unique Constraint

When you create a unique constraint, it is disabled by default. To enable the constraint, click Enable in the Entity Unique Constraint page. If you need to disable it, you can toggle back to Disable.

IMPORTANT!  
If the existing entity records don't meet the constraint requirements, you will not be able to enable the constraint. The following message will be displayed: