Linking Forms - Branching
There may be cases when data you wish to collect within a form does not fall into the hierarchical structure previously described. We also provide another method of adding flexibility that we describe as ‘branch forms’.
Briefly, a branch form is one that is not within the overall hierarchy, but can be linked to a form at some level in the hierarchy, and can be completed none, one or more times.
As an example, within the teacher form in our demo project, we may wish to collect data on each teacher's absences during the year due to sickness.
In this case we would have a question on the teacher form asking the number of episodes of absence due to sickness. Some teachers may answer ‘none’ and some may answer 1, 2, 3 etc.
Branch forms allow us to define a new form (in this case about sickness (form D)), outside the hierarchical structure, that appears once or more times in response to a the answer in another form (as in the following figure).
Defining a branch form using the form builder
Within the demo, when viewing the Teacher Form, expand the 'Links with other forms' section from the left hand side of the form builder and drag a 'Branch Form' onto the form, following the 'What is the name of the teacher?' question, as in the following screenshot:
The branch form point has been inserted and within the Field properties, we must fill in:
Label: This will be the question the user sees at the point the branch form is reached.
ID: This is the name of the branch form.
Within the 'Advanced options' the option to 'Edit branch form' is given. To add our branch form questions we click this and the following screen will appear:
In this case, we choose to select 'NO, I do not have a unique key...' which will autogenerate one for us:
Clicking OK, takes us to the Branch form (see below screenshot).
You will notice that the Key field from the teacher form (ie 'What is the name of the teacher?') has automatically been inserted in the branch form and indicated with an arrow - This is the Key which will link the sickness forms to a specific teacher entry.
We now add enter two more fields, a date field requesting 'start date of absence' and a numeric field requesting 'how many days were you absent?' as in the following screenshot:
After selecting 'Save Project' we are ready to capture data on phones as in the following figure:
The sickness branch form is triggered from within the Teacher form after the name of the teacher is entered. The sickness form can be filled in none, one or more times and the number of branch entries is updated within the main form. Once complete, the rest of the teacher form is completed as normal.
We will now move on to the section describing loading a project on your android device