Overview
In the process of designing Forms within ActivityInfo, maintaining data integrity and preventing duplication is crucial. The Unique property enables you to constrain values entered in a Field so that only one Record in the Form can contain a given value for that Field. This article explains how you can use the Unique property to enforce uniqueness constraints for Fields, ensuring that specific Field values remain distinct across all Records within a Form.
Behavior
If you mark a Field as Unique in a Form, it means that only one Record in that Form can have the same value in that particular Field. This helps to keep your data clean and prevents any confusion or errors caused by having the same information repeated in different places within the Form.
When you set a Field as Unique, you are prevented from adding more than one Record with the same value for that Field within the Form where that Field is located, and among the Records you can view based on your permissions.
Choosing between Unique and Key field properties
Both the Key and Unique Field properties prevent adding duplicate Records to a Form. However, a Field can be either Key or Unique, not both. To switch between these properties, uncheck the undesired Field property in the Form Designer.
You would set a field as Key rather than Unique if the Field contains the values you would like to lookup when referencing that Form.
Supported Field types
The uniqueness constraints can be applied to the following Field types:
- Barcode
- Calculated
- Date
- Fortnight
- Month
- Serial Number
- Single selection
- Text
- User
- Week
Setting uniqueness constraints
To enforce uniqueness constraints for a Field, follow these steps:
- Navigate to the Form to which you would like to add uniqueness constraints.
- Click “Form settings.”
- Either add a new Field or edit an existing Field.
- Scroll down to “Settings” and select the "Unique" property for the Field.
The Unique Field property is only shown when relevant and applicable to the specific Field type.
- Click Done to save the changes made to the Field.
- Click Done to save the changes made to the Form.
When you create or edit a Record that contains a Field with a uniqueness constraint, ActivityInfo verifies that the relevance and validation rules are respected.
Blank or missing values are disregarded in uniqueness computations.
Limitations
Uniqueness constraints are not assessed for Records entered using the following:
Example
Ensuring Unique Beneficiary IDs in Cash Distribution Programs
An example of enforcing uniqueness constraints in ActivityInfo might involve a Form used to track beneficiary payments in a cash distribution program. Suppose there is a Field designated as "Beneficiary ID" which is marked as Unique.
This means that the ID number of each beneficiary must be distinct, meaning no more than one beneficiary can have the same ID within the Form.
By following these steps, you can confidently enforce uniqueness constraints for fields within ActivityInfo, ensuring that your data remains accurate, distinct, and free from duplication.