The following section presents the Key property.
Keys are very important properties in ActivityInfo and they help you build flexible Forms. A Key helps you uniquely identify a Record. When you assign the Key property to a field you identify a Record, you individualize it. This is very useful when you want to reference a specific field in a Form.
When a Form has a Serial Number field, it automatically becomes the Key field of the Form. This is useful and preferable in Protection cases when you don't want to reveal information when you refer to a Record of a Form.
If you haven't added a Serial Number in your Form then it is advised that you select another field to define as the Key to your Form.
Examples of Key uses
- Keys are necessary to allow users to import Records to a Subform or to Reference another Form. This is because users need to link Records by using a common field (i.e. the Key or the Serial Number).
- When you make a Date/Week/Month or any other time-related field a Key field you can use it to add Locks on Records. This is very useful for Monthly or Weekly Reporting Subforms for example.
- A combination of Key fields can be used to prevent users from adding more than one Record for that combination (e.g. a Name and Surname).
- A Single Selection field which is the unique Key in a Form will alert users if they select the same option more than once.
- A Reference field which is the unique Key in a Form will alert users if they select the same referenced Record more than once.
- If you add a Serial Number field in your Form, this field automatically becomes the Key field for your Form and you cannot add other Keys.
- You can add up to 5 Keys in a Form (or only one Serial Number).
- A Key Field is Required and cannot be hidden from data entry.
- You cannot set Relevance rules to a Key field.
- Quantity, Calculated, Geographic Points, Multiple selection & Attachments fields cannot be Key fields.
In this example, we make a Single Selection field a Key field for our Form. Then we create another Form which refers to it to allow users to select one of the cities for which there are available Records and link their Records to it.
A Key can be also used to inform users that there may be a duplicate for a specific combination of fields.
In the example below, the "Date of distribution" and the "School Name" are Key fields. When users try to add a Record and add the same Date and School Name as in another Record , they get a warning.