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 () in FintechOS Studio.
  2. Select Evolutive Data Core.
  3. Select Data Model Explorer.
  4. In the list of business entities, double click the entity for which you wish to add uniqueness constraints.
  5. In the Edit Business Entity page, expand the Entity Unique Constraints section and click the Insert button.
  6. 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.
  7. Click the Save and Reload () button at the top right corner of the page.

Add Unique Constraint Attributes

  1. In the entity unique constraint page, in the Entity Unique Constraint Attributes section, click the Insert button to add an attribute
    NOTE  
    You cannot insert attributes in enabled constraints. If your constraint is enabled, you must disable it first (see Disable a Unique Constraint 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 the Save and Close button () at the top right corner of the page.
  4. 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.

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:

Disable a Unique Constraint

To disable an enabled constraint, click the Disable button in the entity unique constraint page.