Do you want to ensure that your form respondents are asked the questions that actually apply to them? Skip logic, known as “relevance” in SurveyCTO, allows you to make questions in your data collection instrument either appear or be skipped, depending on how previous questions were answered. Well-designed skip logic means that enumerators never have to worry if the next question they see is the right one to ask, saving time and avoiding confusion. In this article, you’ll learn a few different ways to use skip logic to make your forms more logical and increase the quality of your data.
For more examples, as well as guidance on how to add skip logic to your forms on the SurveyCTO platform, you can read this multi-part series of Support Center articles.
Example 1: Skip logic with multiple conditions
Relevance expressions are applied to the questions that you want to be shown or be skipped. If there are questions in your form that are only relevant to subjects who meet multiple conditions, relevance expressions can be written to satisfy them. In a health-related form for example, let’s assume that there are reproductive health questions only relevant to women in between the ages of 12 and 56 years. In this case, the multiple conditions are age and gender. You can apply the following relevance expression to satisfy those conditions:
${age} > 12 and ${age} < 56 and selected(${gender}, 'female')
This expression refers to the previous fields that captured age and gender. Joining these two conditions with “and” means that each of those conditions must be true before the field will be relevant. So the value in the field “age” must be greater than 12 and less than 56, and the response selected in the “gender” field must be “female” in order for the question to which this relevance expression is applied to appear. You can add as many conditions as are needed.
Example 2: Skip logic with single conditions and multiple possibilities
Instead of setting relevance to be met by multiple conditions, it can also be met by one out of several possible conditions. Let’s continue from our previous example of making certain questions only relevant to women between the ages of 12 and 56. Suppose you have a follow-up question that you only want to ask if the respondents indicate that they use one out of a number of contraceptive options. In this example, all of the options are presented in a choice list. The relevance expression might look like the following:
selected(${contraceptive_measures}, 'iud') or selected(${contraceptive_measures}, 'pill') or selected(${contraceptive_measures}, 'condom')
When relevance conditions are joined by “or,” if any one condition is true, then the field with this relevance condition will appear in the form. In this example, the expression is true if “iud,” “pill,” or “condom” is among the choices made in the “contraceptive_measures” field.
Example 3: Skip logic with negative conditions
It usually makes sense to express relevance positively, which means basing it on what a field is equal to, as opposed to what it isn’t equal to. Expressing relevance negatively, however, is useful for situations when the positive relevance expressions will be lengthy or cumbersome.
Let’s assume you asked your respondents to indicate what they consider to be the best birth control option. Let’s also assume you want to ask those who didn’t chose IUDs why they don’t think they’re the best option. To express this positively, you could list out every option as a relevance condition, except for IUDs. This would be the following:
selected(${contraceptive_measures}, 'injection') or selected(${contraceptive_measures}, 'pill') or selected(${contraceptive_measures}, 'condom') or selected(${contraceptive_measures}, 'implant') or selected(${contraceptive_measures}, 'other')
But we don’t advise doing this. It’s more efficient to express the relevance negatively, as follows:
${gender} = 'female' and not(selected(${contraceptive_measures}, 'iud'))
In a positive relevance expression, it can take time to write out all the conditions or click through them in the SurveyCTO online form designer. Additionally, the longer your expression, the more opportunities there are to make mistakes and omissions. Negative relevance expressions diminishes the chance of creating an incorrect expression and generating inaccurate data.
Example 4: Skip logic conditions using “and” and “or”
SurveyCTO also makes it possible to create relevance conditions using both “and” and “or.” In the context of our example, let’s say that you want respondents to be asked a follow-up question if they answered that they are from a certain region (“Region X”) and if they answered affirmatively to using either birth control pills or an IUD. This condition would be expressed as follows:
selected(${region}, 'x') and (selected(${contraceptive_measures}, 'pill') or selected(${contraceptive_measures}, 'iud'))
In this expression, the specified value for “region” must be met, as well as either of the specified values for “contraceptive measures.” While this is a simple example, you can add as many conditions as are needed, allowing you to create highly-targeted relevance.
Example 5: Skip logic with dates
You might find it useful to make fields relevant based on date values. Let’s assume in the country you’re collecting data in, a law was passed that mandates that patients be notified of new health information privacy protections by their care providers during visits. Let’s also assume you want to ask some questions to respondents who have visited care providers after the implementation of the law. To identify those respondents, you can ask all respondents the date of the last time they visited a care provider and set a relevance condition if that date value is on or after the date of the law’s implementation (assume it’s December 31, 2018). The expression would be as follows:
${captured_date} >= date('2018-12-31')
If the date stored in “captured_date” is greater than or equal to December 31, 2018, then the questions will appear. Relevance expressions can also be used to make fields relevant relative to the current date and if a date value falls between two dates or within a specific number of days before or after a certain date.
Explore further
Relevance, like any other type of expression (e.g., constraints and calculations) can make use of values stored in any field type and function. Therefore, the range of possibilities for applying relevance extend beyond the examples presented here. Read these support articles for more guidance and sample forms, and reach out to our stellar support team with any questions about how to apply relevance to your forms.