Introduction: Subforms on Paper
A subform is a form that is embedded into another form (which is usually referred to as the main form, or parent form, to the subform). Here is an example of a main form which collects information related to an entire household, with a subform that collects information on each child in the household (i.e. the subform repeats the same questions for each child).
On paper, this might be referred to simply as a "roster" or "list" of residents, but the key feature that makes it a form+subform combination is that it will generate two data files once data is entered into a computer:
1 - household data file (from main form) – this will have one row per household, and one column for
- interviewer name
- name of household head
- did any children sleep in this house
- household ID (when using Magpi this is automatically generated, and invisible to the data collector)
2 - child data file (from subform) - this will have one row per child, and one column for
- child name
- child age in years
- child gender
- was this child vaccinated
- household ID (when using Magpi this is automatically generated, and invisible to the data collector)
The child data file will also include a household ID number which will allow the data analysts to know which child records are associated with which household records.
Here is an illustration of the household and child data files that would result from the form shown above, with children present in the first and third households interviewed:
Below is an image showing the Magpi design screen for that same form. The main form is called "Subform_Example" and the inserted subform is called "child_subform".
And here is the subform called "child_subform" that is inserted in the form in the image above:
On the main form, a subform is represented as a question which is then linked to another form marked as a subform. This "subform question" acts as the point from which the user will jump from the main form questions to repeat the subform questions as many times as they like, before returning to the parent form.
Open your form on the design view. To enter the subform question, locate the question toolbar at the top of the screen, select 'New question' then select 'Subform' . You can also use the question short cut with the combination 'Ctrl + Y' to create the subform question.
Then you can enter your question and add a keyword to the question that relates to the subform. The keyword will be used to show prompts to the user when using the subform.
You can then connect this subform question to its subform.
Subforms on the Mobile Device
How logic can be applied to skip a subform
Each subform appears as a question on its own in the main form. You can determine whether the data collector will see a subform, or will skip that subform, by applying logic to the main form.
For example: You want to survey women who have children between 0-59 months. You can place the appropriate subform question (to collect data on the children, one at a time) inside a skip pattern. Start with a question to check if a woman meets the criteria, and if she does then the subform question will be displayed. If the woman does not meet the criteria, then the subform question will be skipped and the data collector will go to the next question.
Viewing subform data
To view data from a subform, there are two approaches:
1 - open the main form that contains the subform
In this example "Main_Subform" is the main form containing several subforms. One of the subforms is called "child_subform." In the image below, you can see that for the subform question "child_subform" it shows in the first row that there are 2 records. If you click the words "1 records" it will open another window to show you the subform records.
If you choose to export the data from the main form to Excel, it will include the subform data in a second worksheet inside the Excel workbook.
2 - open the subform directly from the form list
Above we showed you how to open the subform data from within the main form data view. You can also just open the subform directly from the form list.
How do subforms use up my upload credits?
The short answer is: they don't. If, in the example above, you were to interview a household with three children (i.e. a household form and three child subforms) and then upload them to Magpi, you would be charged one upload credit for the household form but none for the subforms.