Defining Key fields

The following section describes how the Key property works and presents how to define one or more fields as Key fields when designing a Form. It also describes how you can prevent users from adding duplicate Records by defining Key fields (i.e. key points of information that should not be repeated).

Keys are very important properties in ActivityInfo and they help you build flexible Forms. The Key property is used to uniquely identify a Record. 

This is very useful for a variety of cases as a Key allows you to easily reference a specific field in a Form. 

Examples of Cases where Key fields are used:

  • A Key field is necessary to allow users to import Records to a Subform. A Key field needs to be identified in the Parent Form to allow you to link the Records you plan to import to a Subform to the correct Record of the Parent Form.
  • A Key field allows you to easily Reference the Record of another Form. This can be the Serial Number of a Record or a specific field which has been defined as a Key field.
  • 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 more easily.
  • A combination of Key fields can be used to prevent users from adding more than one Record for that combination.
  • A Single Selection field which is the unique Key in a Form will prevent users from adding a Record where the same option is selected more than once.
  • A Reference field which is the unique Key in a Form will prevent users from adding a Record where the same referenced Record is selected more than once.

If you add a Serial Number in your Form, then this becomes the Key of the Form automatically. To use the Serial Number and make it easier to recognise, you can customize it using a Text field or a Single Selection field. 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.

Key points about Keys:

How to define a Key field
  • In the Form Design page, click on the field you want to make Key.
  • In the Field Card editor, check the box next to "Key".
  • Click on "Done" to save the field.
  • When you finish adding fields, click on "Save" to save the Form.

A field that is defined as Key, appears with the label "KEY" in the Form Designer.

How to use a combination of Key fields to prevent users from adding duplicate Records
  • In the Form Design page select the fields which will act as Key fields by checking the Key property to make them keys.
  • Users will get an error if they add a Record with information that has been already added for these fields.
How to use a Single Selection field as a Key to prevent users from adding duplicate Records
  • In the Form Design page select the Single Selection field which will act as a Key by checking the Key property.
  • Users will get an error if they select the same option.