This article explains how to utilise question grouping in your custom forms.
Adding a group of questions to a form
1. Create a new or open an existing form
In this example, we will create a form to collect data about a organisation's teams.
2. Add a field group question type
Click the “Add Question” and select the “Question group” question.
3. Select a title for the group of questions
Choose an appropriate title that indicates what the group of questions is for.
In our example, we want to collect data about different teams so we will give our question group the title of “Teams”.
4. Add questions to the group
Now we are ready to add the questions that will collect data for a team.
To add a question to the group, click on the “Add Group Question” button inside the question group box.
You can add any questions you like with in a question group. Lets start by add the following:
Team name - Text Field
Team location - Multiple Choice
You’ll notice the these fields are contained with in the “Team” question group.
5. Add conditional questions inside a question group
As mentioned above, the questions inside a question group are contained with in the question group and are not “aware” of questions outside of the group. This is important to note when using conditional logic on questions.
For example, let's say that we want to additionally capture the city where the team is based if the location is “Australia”. To do this, let's start by adding another Multiple Choice question called “Australian city”.
Once we have created the question, we can now add a conditional to the previous “Location” question. The important thing to note here is that the questions available for the conditional will be limited to only those questions with in the question group.
6. Collect multiple answers for a question group
Now that we have our question group for a team, it’s not very useful unless we can capture data about multiple teams. To do this we need to use the “Multiple answers” option at the top of the question group.
Selecting this checkbox will allow users to submit multiple Team answers in the one form!
7. Time to submit the form
Let’s publish the form and save it so that we can submit it!
Heading over to the Fieldworker app, open up the form. Once open we’ll add our first team - USA Sales Team.
Now let's add our second team - Sydney Engineering Team. To add another click on the “Add” button. You’ll notice this adds another group of questions to be filled in.
8. Submit and review result
We can now submit the form and head back to the web app to view the results. Below is an example of the result from the activity feed:
Adding a condition on a question group
Previously you saw how to add a conditional within a question group (this is similar to how you would add conditionals to other fields outside a group). Now we look how to add conditionals on an entire group!
Continuing with our example form Organisation Teams, let’s add another question above the question group. The question will be a simple Yes/no Multiple Choice asking if the organisation has any teams:
Now let’s add a condition on the question group itself. The condition will only show the question group if the user clicks “Yes” in the Multiple Choice question.
One thing you will notice is that the available questions you can base the conditional on is only other questions that sit on the same “level” as the question group. This means that the questions within a question group can only be conditional with each other and CANNOT be linked to questions outside of the group.
Finished question group conditional:
Now head back to the Fieldworker app to see how our new conditional behaves. You will notice that the entire group now reveals itself when answering “Yes”. This can be very handy if you have many questions that depend on the answer of a particular question.