Randomizing form section order

This article accompanies this sample form. Please read the following and test the sample form. Either save a copy of the sample form in your Google Drive or download as an Excel workbook.

In this article, we present an alternative to the standard approach to randomizing the order of sections of questions. While the structure of SurveyCTO forms are linear, there are ways of working around this, so that your forms appear to behave otherwise in practice. The solution discussed here is a more elegant method for randomizing sections of questions, involving less redundancy than the standard approach. It uses randomly generated numbers and hyperlinks to guide users through an enforced routing. 

Standard approach

The most common approach users have employed to have sections of a survey appear in a random order includes the following steps: 

  1. Prepare a survey with one order of questions in a group.
  2. Make copies of that group of questions so that the same questions exist in the form design more than once.
  3. Re-order the copied groups of fields so that they appear in different orders. 
  4. Use relevance based on a random number so that only one of these groups appear randomly each time the form is completed.

For example, you could program Section A, Section B, and Section C, and then replicate the sections but in different orders, like ABC, BCA, or CAB. 

The above approach has a number of drawbacks, particularly when it comes to making changes once the routing has been set up and the sections replicated. Anyone making corrections or minor changes after this step has to be careful to apply these changes to every copy of the section that exists, greatly complicating form maintenance. 

We already have some content in our documentation about randomizing form elements but not about randomizing entire sections. Ideally, users should be able to program each section just once and then establish different sequences through these sections as necessary. We are happy to provide a solution here that comes quite close to achieving this goal.  

Alternative approach 

This alternative approach is an advanced solution that is more easily understood when working in SurveyCTO’s spreadsheet-based form design environment. It would not be possible to program all of the required elements in this form design approach in the online form designer. However, most of it could be prepared in the online form designer and the two form programming methods are interoperable, so you could start in the online designer, get as far as you can, export to Excel, make changes and upload to update the same form on the server.

Requirements

In devising this approach, we settled on the following criteria that need to be satisfied for this solution to work properly: 

  • Respondents must be restricted to only moving through the survey in a linear fashion.
  • Respondents must not be allowed to move ahead to the next section until the current section is complete.
  • Respondents should not be able to swipe backwards into a section that is out of the current sequence.
  • Respondents should only be able to submit the survey when all of the sections have been completed.

Now that we’ve established the goals we are working towards, let’s take a look at how we accomplish them. Click here to view a functioning version of the form design we created in Google Drive. You won’t be able to edit this one, but you can save a copy to your own Google Drive or download it as a Microsoft Excel workbook and work from a local copy on your computer. To deploy, visit the Design tab of your server console and under the Your forms and server datasets section, click on +, then Upload form definition. Choose the Excel file or Google Sheet.

How to do it

Given the complexity of this setup, this is a screenshot of the entire example survey. Follow along with the numbers to see how each component ties in to making the survey behave the way we want. This survey has three sections (A,B,C)  and there are three possible routes (ABC,BCA,CAB) to which a respondent could be assigned.

Note: A copy of this image is attached at the bottom of this article so that you can download it and zoom in if you'd like. 

randomize_section_order.png

  1. Field: “route” - This is where the route a respondent will use is determined. After a random number is drawn, this field assigns that result to one of three routes. In this case, because we are working with 3 potential routes, the intervals are 0-.33, .33-.66, and .67-1, each representing ⅓ of the possible range of values between 0 and 1 which are generated by the expression, once(random())
  2. Fields: “first”, “second”, “third” - These fields ended up not being necessary for the purposes of this survey, but they have been left in since you might find them useful for analysis, and they provide a good place to put reminders about each route in the notes column.
  3. Fields: All note type fields in this survey - Note fields are how we control the routing.
    1. The note fields contain hyperlinks to whichever section the user is supposed to go to next.
    2. The note fields have an expression in the required field parameter. Until the survey is complete, users cannot swipe forward from the note fields. They must select the hyperlink to move forward. 
    3. Relevance statements based on the routing assignments control which note fields are presented before and after each section. (and)
  4. Groups: “grp_a” and “grp_b” -  Relevance statements on groups prevent users from accidentally swiping backwards into a section they are not supposed to be in yet. How was this relevance statement determined here?
    1. Let’s take Section A for example. If you look at the notes column near , you can see the routings ABC, BCA, and CAB
    2. Looking at these options, you have to decide what circumstances need to be satisfied before Section A becomes relevant. In the first scenario (route 1), A is the first section. In the second and third scenarios, Section C must be finished before Section A becomes relevant. 
    3. So, the relevance statement is based on the logic in 4b. Either the survey starts with Section A, or Section A becomes relevant after Section C has been completed. 
      • ${route}=1 or ((${route}=2 or ${route}=3) and ${c_fin}=1)
  5. Fields: All of the fields that start with “from_” - At the end of each group is a set of note fields which directs respondents to the next section on their route. Setting these up is where the extraneous fields left in point 2 come in. 
    1. Again take note of the three possible routings: ABC, BCA, and CAB.
    2. Looking at the possible routes, you have to decide how many note fields are needed at the end of Section A. In the first scenario (route 1), after A comes B. In the second scenario (route 2), A is the last section. In the third scenario (route 3), Section A is again followed by B.
    3. Based on requirements as determined in 5b, two note fields are required at the end of Section A, because there are only two possibilities for the next step after Section A; Section B or the end.
    4. See that these note fields only become relevant once the section has been completed. You need to use your knowledge of the section to set the parameters here. Since this short example only has one question per section, the relevance of the note fields with further directions is based on the only question in the section having a response.
  6. Field: Continue - “continue” is the final field in the form. It is required, and it only becomes relevant when all of the sections have been completed. The field “continue” is used in an expression in the required column of all of the routing notes. Before the field ‘continue’ has been answered, the note fields are required and act as barriers to uncontrolled forward movement. They also prevent the survey from being finalized, because a note field which is relevant and required can never be satisfied. Once “continue” has been answered, the survey can be finalized.  

You can follow the same logic in points 4 and 5 for sections B and C (and any other further sections you might decide to add. 

  • Based on your possible orders, look at the circumstances under which a section will become relevant. Use this determination to decide on your relevance expression for the group.
  • Based on your possible orders, look at the possible next destinations from within the current section. Use this determination to decide how many note fields you will need at the end of a section to guide users to the next section on their route. 
  •  

By now you might be feeling a little bit confused and that’s to be expected as, again, this is an implementation that makes use of a few advanced techniques to work according to the requirements we stated earlier. We suggest that you read through the requirements, review the steps, and examine the form a few times to make sure you have a grasp on what’s going on. 

Device setup

Because we want to ensure that users advance through this survey in a linear fashion, there are two settings you’ll want to make sure are disabled on your Android devices to prevent users from bypassing the required note fields. Both of these settings are located in SurveyCTO’s Admin Settings under the User can access form entry items heading. 

Note: You can open the Admin Settings by pressing the 3-dot button in the upper right-hand corner from Collect’s main menu. 

  1. Go To Prompt - make sure this is unchecked
  2. Skip to Next - make sure this is unchecked

This will prevent users from trying to violate the routing rules we’ve determined in the form design.

Do you have thoughts on this support article? We'd love to hear them! Feel free to fill out this feedback form.

0 Comments

Article is closed for comments.