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:

Designing a Subform on Magpi

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 far right corner 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.

Below is a picture of a 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. Below is how to add a subform




Subforms on the Mobile Device

On a mobile device, the subform controls allow the user to iterate through the required number of items, asking each question in the subform, until the user decides to advance past that subform loop.  Here is an example of a subform that allows the data collector to repeat a child subform for each child in a household:

How logic can be applied to skip a subform or not

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 start with a question (#1 in the image below) to check if a woman meets the criteria, and if she does then the subform question (#2 in the image below) will be displayed.  If the answer to #1 is "No" (i.e. if the woman does not meet the criteria), then the subform (#2) will be skipped and the data collector will go to the next question (#3 in the image below).

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 "Role_Model" In the image below, you can see that for the subform question "Role_Model" it shows in the first row that there are "1 records".  If you click "1 records" it will open another window to show you the subform records.




2 - open the subform

As you will remember from the image above, the main form called "Main_Subform" has a subform question in it called "Role_Model". That subform question displays a subform called "RoleModel_Childform", which you can see in the list.   If you select "RoleModel_Childform" in the form list, as in the image below, you will see the data records for the subform.



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.