The following section describes how to add a Reverse Reference field when designing a Form. Reverse Reference fields allow you to “reverse” an existing Reference field which references your form. This enables users to view and move between referenced records from the Table View, as well as enabling queries on related records in your Reports.
To create a Reverse Reference field, you must first have an existing form with a Reference field defined which points to your current form. Reference fields which reference other forms cannot be reversed in your current form.
Before you start
- Make sure you have already added a database and
- You have added a Reference field in another Form, which points to your current Form.
How to add a Reverse reference field
Assuming you're an administrator for a Case Management Database and you want to see the number of beneficiary records for each partner organization, you can achieve this using a Reverse Reference field. You need at least two forms for this:
A Beneficiary Form: This is the source form where you collect details about beneficiaries. In this form, there is a reference field called "Name of partner organization".
A Partner Organization Form: This is the second form, where you keep a list of partner organizations that has been referenced in the “Beneficiary Form” above. You want to include a Reverse Reference field here that links to the “Beneficiary form”.
- Go to your current Form, in this case, the “Partner organizations" form and in the Form Design page, click on the add field button to add a new field.
- Click on "Reverse reference” from the Fields palette.
- Search for the Database and the Form which reference your current Form. Click on the arrows to reveal the contents of each Database, Folder or Form.
- Select the Form and the Reference field you want to reverse and click on “Continue”.
- Fill in the Properties of the Reverse Reference field, and in the Settings check the boxes you want to apply for the field. The original Reference field selected will be shown under “Reverse reference" section.
- Click on "Done" to add the field.
- The Reverse Reference field has been added to the Form.
- When you finish adding fields, click on "Save" to save the Form.
How to view related Records via Reverse Reference fields
- On a Form with a Reverse Reference field, in this example the “Partner organization" form, open the Table View to view your records.
- The newly added Reverse Reference column should appear in the Table View by default when you open the form. Alternatively, you can open the Column Selection Panel, and select the Reverse Reference field from the list of available columns.
NOTE: If the field was set to “Hide from table”, it will not appear in the list of available columns or in the Table View. - On the Table View, a blue column will appear showing the count of records which reference each record in your current Form.
- Click on the arrow on any record to view the related records on the referencing form.
- Alternatively, you can also click on the reverse reference button on the Records Details Pane.
- The referenced form will open in the Table View, and only records which reference the selected records will be shown. In this example the “Beneficiary Information” form with the records of beneficiaries per partner organization will be shown.
You can toggle to view all records, or show only selected records.
- To return to your original form, click on the “Back” button.
How to query related records via Reverse Reference fields
- Go to “My reports” and add a new Pivot Table.
- On the data sources interface, select two forms which have a Reference Field (source form) and Reverse Reference Field (reference form) pair and click “Done”. In this example, we select the "Beneficiary Information" and "Partner organizations” forms and click "Done".
- On the Report Design Pane, the selected Form (and its Fields) will appear in the list of available fields as well as the referencing form via the Reverse Reference field.
- Choose a field from the form to include as a Measure or Row/Column Dimension. In this example, lets find how many beneficiary records reference each of our partner organizations. From the "Beneficiary Information, Add "Count of all records" as a measure, and add "Partner organization name” as a row dimension.
You have now added Reverse Reference fields, viewed related Records via Reverse Reference fields and queried related records through Reverse Reference fields.
Permissions are respected while using this feature. Ensure that you have permission to see the source form, to view any records that refer back to it or to see the field that shows the reverse reference.