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
- Open the Main Menu () in Innovation Studio.
- Select Evolutive Data Core.
- Select Data Model Explorer.
- In the list of business entities, double click the entity for which you wish to add uniqueness constraints.
- In the Edit Business Entity page, expand the Entity Unique Constraints section and click the Insert button.
- In the Add Entity Unique Constraint page:
- 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.
- Optionally enter a Display Name for the constraint. This is the name that will be displayed in the user interface.
- Optionally enter a Decription for the constraint.
- Click the Save and Reload () button at the top right corner of the page.
Add Unique Constraint Attributes
- In the entity unique constraint page, in the Entity Unique Constraint Attributes section, click the Insert button to add an attributeNOTE
You cannot insert attributes in enabled constraints. If your constraint is enabled, you must disable it first (see Disable a Unique Constraint for details). - Select an Attribute that you wish to include in the constraint, from the drop-down list. The Name field will be filled-in automatically.
- Click the Save and Close button () at the top right corner of the page.
- Repeat for any additional attributes you wish to include in your constraint. If you add multiple attributes to a constraint, the constraint will evaluate if all the attributes combined are unique, not if each attribute is unique.
Enable a Unique Constraint
When you create a unique constraint, it is disabled by default. To enable the constraint, click the Enable button in the entity unique constraint page.
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:
Disable a Unique Constraint
To disable an enabled constraint, click the Disable button in the entity unique constraint page.