Creation of "Related Records" from within a Questionnaire.
The Questionnaire functionality enables users to create "related records" directly from a question using a subform.
The most common use case would be that, while for example an Inspection is being performed, and corrective Action has been identified, and this Action needs to be created and saved to the application from within the Questionnaire.
Setting up the creation of "Related Record"
|
NOTES
- The steps below assume that the subform exists. If not, then it needs to be configured.
- For ease of use, it is highly recommended that the pages within the subform are kept short. This is particularly important if the subform is to be used with Roam on a mobile device.
|
- On the root component of the subform, to be used for the "related record", (for example: "Actions") create a Text field.
- This text field:
- needs to be set to at least 2,000 characters long
(Note: the field can neither be a URL, nor a Memo field) - should be represented in the subform (which is used to create the related records) as a hidden field.
NOTE: if the field needs to be visible during the configuration process (as a reference), it cannot to be set as 'read only'.
- This text field stores the information about the related source question. The content of this field will be a 'JSON' structure. The format of this structure is static, and will look similar to the following example:
{
"questionnaireName": "Supplier Requirements - with related records",
"sectionName": "ACME Housebrand Policies and Guidelines",
"questionText": "Are copies of HB Policies available?",
"questionResult": "Not Met",
"questionAnswer": 0 }
- It is possible to use "Rules" to copy the content of this field into other (additional) fields in the target component, so that reporting and user readability would improve.
- Create a "1-to-many" relationship from the component that is related to the Questionnaire component, to the root component of the subform (for example "Take 5" can have many "Actions").
- Add the Text field created in Step 1 as a field onto the subform and set the Field Input Type to be Text - Multi-Line. Then drag this to the Hidden fields section.
NOTE: if the field needs to be visible during the configuration process (as a reference), it cannot to be set as 'read only'. Once this set up is complete the field that the relationship points to MUST NOT be changed, as this will break the relationship between the questionnaire and related record.
- Add the subform on to the form where the Questionnaire is used. The subform:
- must be either on the same page as the questionnaire, or it can be on another page as long as this page is visible.
- cannot be formatted as a grid form.
- Modify the field properties for the Questionnaire field as in the following example:
Limitations
If you intend to allow the creation of related records from within a Questionnaire, please be aware of the following limitations:
- Placement in the web application interface:
Related records will be created using a "floating subform" dialogue. It is necessary to have the subform - either on the same page as the questionnaire - or on another page which must be visible to the user (i.e. not a hidden page).
- Reporting:
Unlike other relationships, there is no linkage between Questionnaires and related Records via a database relationship, using primary and foreign keys.
Instead, 'tenuous' or 'soft' links are being employed - more details on these links, and how to report on these related records, can be found here.
|