Unique Registry entry
Specify that a column or a combination of columns must be unique in order to save a record, and a message to be displayed if uniqueness is violated.
EMu provides two different Registry entries for specifying the uniqueness of fields, the Unique Registry entry and the Unique Index Registry entry. Both of these entries can be used to specify that one or more fields are unique. See Unique-valued fields Registry entries for details of the differences between the two.
Tip: In general, unless you are looking to enable uniqueness checking and auto-incrementation of a value in a field, it is recommended that you use the Unique Registry entry to specify the uniqueness of columns.
The Unique Registry entry specifies that a column or a combination of columns must be unique in order to save a record, and a message to be displayed if uniqueness is violated:
- This is a client-side entry and uniqueness is checked when the record is saved. If a field or a combination of fields required to be unique is not unique, the record is not saved and the message displays warning the user to change the value.
- This setting can be overridden using a Unique Override Registry entry (users / groups are able to save a record even if a Unique Registry entry specifies that a column or a combination of columns must be unique). The warning message defined in the Unique Registry entry will display, but the user will have the choice to save the record anyway.
Usage
This Registry entry can be assigned to users and groups:
Key | User | User | Group | Group | Group | Group |
---|---|---|---|---|---|---|
Key 1 | User
|
User
|
Group
|
Group
|
Group
|
Group
|
Key 2 | user | user | group | group | Default
|
Default
|
Key 3 | Table
|
Table
|
Table
|
Table
|
Table
|
Table
|
Key 4 | table | Default
|
table | Default
|
table | Default
|
Key 5 | Unique
|
|||||
Key 6 | column;column;... | |||||
Value | message |
User
|
user | Table
|
table | Unique
|
column;column;... | message |
User
|
user | Table
|
Default
|
Unique
|
column;column;... | message |
Group
|
group | Table
|
table | Unique
|
column;column;... | message |
Group
|
group | Table
|
Default
|
Unique
|
column;column;... | message |
Group
|
Default
|
Table
|
table | Unique
|
column;column;... | message |
Group
|
Default
|
Table
|
Default
|
Unique
|
column;column;... | message |
where:
column;column;... |
is one column or a combination of columns (separated with a semicolon) that must be unique (or empty) in order to save a record. Note that if more than one column is specified, it is the combination of columns that must be unique, not each individual column in the combination. For example, if a unique combination of three columns is required to save a record, two records can share two of the three values, as long as the third value is different. If the combination of Field1, Field2 and Field3 must be unique, these two records could be saved: Record 1: Field1 = A, Field2 = B, Field3 = C Record 2: Field1 = A, Field2 = B, Field3 = D Note:
|
message |
is a message shown if the combination is not unique. In a multilingual system, translations of the message can be provided by separating translations with the language delimiter (e.g. |
Note:
- Uniqueness is only checked when a record is saved.
- If the column or combination of columns is not unique, the warning message displays and the cursor moves to the control associated with the first column listed in the Unique Registry entry.
- Unique fields are typically set at the
Group|Default
level and are the same for all users, although they can be set for specific users and groups. - If a unique-valued field is empty but not mandatory, the record can still be saved.
Example
This entry specifies that the Birth date, Surname and First name combination in the Parties module must be unique in order to save a record:
Key | Setting | Description |
---|---|---|
Key 1 | Group
|
|
Key 2 | Default
|
|
Key 3 | Table
|
|
Key 4 | eparties
|
|
Key 5 | Unique
|
|
Key 6 | BioBirthDate;NamFirst;NamLast
|
Together these three fields must be unique before the record can be saved. |
Value | This record is not unique. | The message to display if the field or combination of fields is not unique. |
When a record is saved in the Parties module, a check is made to determine whether the three specified fields are a unique combination; if not the warning message displays.