Uniqueness Rules. Established on a per table basis in the Schema Configuration tool in Specify 7. You can now configure fields of a given table to enforce uniqueness during data entry on that table. These rules are scoped and can correspond to just one field or encapsulate several fields all scoped to the same level of uniqueness in the database.
Multiple fields. This means that both fields must be unique. For example, if both field1 and field2 are unique to Database, then there can be multiple field1’s which have the same value, but there can not be two records of Table which has both field1 and field2 as the same value.
Scope. Uniqueness Rules can be scoped depending on your needs for the rule. Scope options range from as broad as the database level down to a table with relation to the rules’ base table. When Specify checks for uniqueness during data entry, the unique fields must only be unique within the selected scope.
Check out this article on Specify’s Institutional Scoping to learn more about table hierarchy and scoping.
This tool allows users to configure uniqueness rules for the fields of a given table in the schema. This tool.
Live Validation. After each edit made to a uniqueness rule during configuration, Specify checks for any existing records that violate a uniqueness rule. If violating records are found, the Save button will be disabled and appear red to indicate a conflict.
Duplicates. This tool features a button to download all the data that conflicts with the uniqueness rule being configured for a certain field. This is done via an Export Duplicates button in the Configuration dialog. Clicking the Export Duplicates button initiates a download of a CSV file to your device. The purpose of this file is viewing what duplicate field entries exist that conflict with a certain uniqueness rule. This file provides data on what duplicate field entries consist of and the number of times the duplicate field exists in your database.
Number of Duplicates fieldName # entry with duplicates # entry with duplicates
Locality shortName-in_Database.csv (280 Bytes)
Global Scoping A uniqueness rule with a scope set beyond the discipline level is considered “Global”. Global scope levels include division, institution, and database. A uniqueness rule that is scoped globally will be enforced for all disciplines in the database.
This example of the main dialog is for a table that has no system default rules or user-configured rules. The name of the base table you are working with will appear in the first part of the dialog header.
When a uniqueness rule is added, a row of two read-only fields will appear, one under each title.
As more rules are added, these rows of fields under each section forms an apparent grid view.
Unique Fields Displays the field name(s) of each uniqueness rule.
Scope Displays the scope of each uniqueness rule.
Add Uniqueness Rule Adds a new uniqueness rule row to the dialog.
Close Closes this dialog. If there is an attempt to Close with unsaved changes, a safety dialog to confirm your choice will appear.
Save Saves any changes made since opening or last Save.
- Button will appear orange when Save is enabled.
- If a field in the dialog is invalid, the Save button will be disabled and appear red.
Edit Button Depicted by the pencil icon, this button opens the Configure Business Rules dialog, where changes to uniqueness rules can be performed.
Unique Field Name Field This read-only field displays the field names included for that business rule. When a new rule is added, this field defaults to the name of the first field of an alphabetical list of the base table’s fields.
Scope Field This read-only field displays the scope that the uniqueness rule is set to enforce. By default, the scope field value will be set to Database for newly added rules.
The top portion of this dialog is for configuring the fields that you wish to establish uniqueness for. It is comprised of a drop down list of available fields and an Add button. If clicked, the Add button renders a red minus sign to the right of each drop down list of fields.
Field List Similar to on the main schema configuration page, the list is divided into Fields and Relationships.
Add Button If you wish to configure your rule to include more than one field, this button will add another field list drop down below.
Red Minus Button If clicked, it will delete the field drop down that it is positioned by.
This portion of the dialog is for configuring the scope of a uniqueness rule. It includes a field mapper that functions the same as our Query Builder field mapper.
note: dialog not available for system default rules
Scope Mapper This mapper functions the same as our Query Builder field mapper in that you simply click on your choice so that it is highlighted in the list, followed by clicking the gray box with an arrow to finish set the scope. Tables with the arrow icon to the right will open another mapping list of related tables. You will know your selection was successful when the table name appears in the field below.
Scope Field The field at the bottom of this section displays the current scope of the uniqueness rule. If more than one table is included in the mapping path, this field will show this path with - > between each table name.
If your scope selection fails validation in the database, this field will be highlighted red to notify that duplicates exist. A failed validation will prevent the establishment of that uniqueness rule at the time.
– link to user tools guide for finding schema config
If your base table has default uniqueness rules, they will appear in the dialog already.
The rule will be assigned the field that resides at the top of the alphabetical field list for the current table. There is a chance this field will have duplicate entries in the database and signal as invalid.
Note that the field and scope can not be changed from the grid view. You must click the edit button to the left of the field name and make changes in the configuration dialog.
To open the configuration dialog, simply click the pencil icon to the left of the field name.
- double click or use the arrow button to set scope
- note: there can be differences in rule behavior depending on this path even if the last
scopeNameis the same.
Note: Changes made to uniqueness rules will not be saved to the database until the Save button is clicked. Changes will be lost if the Uniquess Rule dialog is closed or navigated away from before saving.