This article describes how to add a Reference field when designing a Form.
Reference fields are very useful fields which make it possible to connect Forms to other Forms or to the built-in Geographic database of ActivityInfo. Users can link their Records to the Records of another Form.
Using a Reference field and multiple Keys in the referenced Form, you can also create a 'cascading' effect to allow users to select from a series of options.
Reference fields or Selection fields
Reference fields and Selection fields are similar, as they allow you to create lists of options. However, they serve different purposes, therefore it is important to choose the appropriate Field type when designing a Form.
- Selection field: creating a list of options inside the Form
- Reference field: references another Form where each option is another Record. Here it is possible to include more information about that option (i.e. meta-data or other kind of information) in the referenced Form. You can use as many fields as needed to capture that information and by making them Key fields you can also bring that information into the initial Form (creating the 'cascading effect').
We strongly suggest you to consider the following best practices:
- Use a Single Selection field to capture a basic list of options that don't require further meta-data or additional information. Examples: age categories, list of options for biological sex, etc.
- Use a Reference field to link to a Reference Form where you will collect additional information for each option (Record). You expect changes to occur on that data (data is described as dynamic rather than static) and you need to link to these options in many Forms in your Database in a consistent way. Examples: partner organizations, list of institutions/entities, etc.
- When referencing a Form, users are able to select from a list of options added to that Form using the Reference field. To limit the options that appear to them to selected options you can set validation rules to the Reference field.
- You can add a prefix to the Serial Number to customize it and make it more readable for your users. This allows you to show - without revealing much information- what the Record is about, if you choose to use the Serial Number as the common reference.
- The maximum length of the characters of a Key field to appear in a dropdown result of a Reference field is 128 characters.
How to add a Reference field to reference one Record of another Form
To add a Reference field, follow these steps:
- Make sure you have defined as Key field the field you want your Form to refer to.
By default, Key fields are used to look up a specific Record in a Form. Alternatively, select the Fields you wish to include in a look up or add your own custom Formulas.
When designing a Form, you can configure what fields on a reference Form may be useful for lookup and the order of displaying them. These may or may not be key fields, or may be just a subset of key fields.
- Navigate to your Form, and in the Form Design page, click on "Reference" to select it from the Fields palette.
- Make sure you have defined as Key the field you want your Form to refer to.
- Search for the Database and the Form that contains the Form and the Records you want to link to. Click on the arrows to reveal the contents of each Database.
- Select the Form and click "Continue."
- Fill in the Properties of the Reference field by providing:
- Label: type the question for which the user will select an option
- Description: optionally provide a description
- Code: optionally provide a code
- In the “Settings” check the boxes you want to apply for the field.
- Click "Done" to add the Field.
The Reference field has been added to the Form.
- Continue adding Fields to your Form.
When you finish adding Fields, click on "Save" to save the Form.
Record Entry
While adding Records, users can now select a Record out of the list of Records of the referenced Form.
While adding Records, users are able to select a Record out of the list of Records of the referenced Form.
In this example, the referenced field was a Single Selection field, defined as a Key field. That is why users see the specific options in the dropdown list.
When lookup fields are defined, the options shown in the dropdown correspond to the lookup fields defined by the Form designer.