Skip logic

Introduction

Skip logic enables survey authors to route respondents to various places in the survey and/or disqualify them from participating, typically based on responses from previous questions.

For example, you could set up skip logic like this:

If Age < 18
Skip to: Disqual

This skip logic directs to the Disqual survey ending if the respondent's answer to the Age question is less than 18.

Adding a skip logic element

A skip logic element can be added to logic groups. These groups can be placed between any page in the survey and can contain skip logic or quotas.

  1. Click any Add button.
    The survey authoring interface with the add buttons highlighted.
  2. Select the skip logic element.
    Select Skip Logic in the Add Menu
  3. Configure the skip logic settings.
    Skip Logic Element

Be sure to position the skip logic element appropriately in the survey flow. The placement of each skip determines when it is evaluated.

Anatomy of skip logic

Skip logic is made of two pieces:

  1. Logic statements
  2. Conditions
Skip Logic Parts

Logic statements

Skip logic elements consist of logic statements, which define conditions to be evaluated and executed when "true."

There are two types:

  1. If-statements
  2. Always-statements

Set the type in the logic statement menu.

If Always Type

You can add multiple logic statements to the same skip logic element by clicking the + Add logic statement button. This can help organize similar skips together, although multiple statements in one element are not inherently related.

The order of your skips and statements is important. Skips are evaluated sequentially, so both the order and specificity matter. For more information, see the Order of execution section below.

If-statements

The default logic statement type is If. This works like a traditional if/then statement: “If this condition is true, then perform this action.”

Each If-statement is defined by conditions (see more on conditions below), which form the rule evaluated when the statement is encountered.

Always-statements

The second type is the Always option. Unlike If-statements, these don’t require specific criteria. When an Always-statement is encountered, its action is executed immediately, regardless of any conditions.

Think of these as: “Always perform this action when this statement is encountered.”

Conditions

Conditions are the rules that determine whether the skip gets executed or not.

Skip Logic Condition

There must be at least one condition per logic statement, though you can add multiple conditions to build more complex skip logic.

Configuration of conditions requires a few settings:

  1. Data source
  2. Operator
  3. Inputs/values
  4. Result/action

Data source

This step allows you to choose which survey data (survey question responses or pass-in variables) to build logic from.

To choose a data source, click the data source menu and then select the source you wish to reference. The dropdown menu consists of a list of your survey questions, followed by a section with any pass-in variables you have created.

Data Source Dropdown

Once you choose a data source, the settings for the condition (operator menu and input/value setting) may change (see more below).

Operator

Operators are used to compare or assign values, and perform operations, similar to operators in mathematics and scripting languages.

The operators available in the operator menu vary depending on the data source chosen. Each source type has unique characteristics compatible with certain operators and inputs/values.

The operator options that may appear in the menu are:

  1. Includes any/does not include any
  2. Includes all/does not include all
  3. Is any/is not any
  4. Is answered/is not answered
Operator Dropdown
There are special implications when using the “any” or “all” operator types with text data sources (open-end questions and pass-in variables). Be sure to read each Text entry data section for each operator below for instructions on how they work.

Operators and numeric data types

If a numeric data source is selected, the Operator menu will contain several new operators compared to other question types.

You will find all your typical arithmetic operators, in addition to a few others:

  1. Is equal to/is not equal to (=, ≠)
  2. Is greater than/is greater or equal to (>, ≥)
  3. Is less than/is less or equal to (<, ≤)
  4. Is between
  5. Is Answered (learn more below)
Is equal to/Is not equal to operators

The Is equal to and Is not equal to operators evaluate to "true" if the value provided by the respondent is or is not explicitly the value that you indicate, respectively.

Is greater than/Is greater or equal to operators

The Is greater than and Is greater or equal to operators evaluate to "true" if the value provided by the respondent is greater than (higher in value than) or equal to the value that you indicate, respectively.

Is less than/Is less or equal to operators

The Is less than and Is less or equal to operators evaluate to "true" if the value provided by the respondent is less than (lower in value than) or equal to the value that you indicate, respectively.

Is between operator

The Is between operator is a range function. You input two values and the function evaluates to "true" if the value provided by the respondent falls on or between the two values that you specify (Is between is inclusive).

The “Includes any” operator

The Includes any operator is available to use with all data source types, except for variables. When used with the text entry data sources (open-end questions and pass-in variables), the settings will change compared to the list data sources (single & multi-select question, grids, etc.). Be sure to read the Input/value field in conditions section to learn about these special nuances.

If you choose include any, then any of the specified inputs/values can be "selected" or considered "true" for the condition criteria to be met and the skip to be executed.

Include any is like inserting an "or" in between inputs/values if multiple are specified.

Includes Any Example

For example, in the image above we have specified that if the Age single select question Includes any of the three response options, "0-9" OR "10-19" OR "20-29" (in other words, if you are younger than 30), then skip to the survey ending, Disqual.

When this gets converted to code and evaluated, the specified values for that condition are grouped together by being wrapped in parentheses. (This is important when doing advanced skip logic with multiple conditions).

If (Age = 0-9 OR Age = 10-19 OR Age = 20-29)

Skip to: Disqual

With the sequential nature of the inputs/values and logic configuration of this example, we have created a number range or a comparison operation.

This example could also be (softly) interpreted as:

If (Age < 30)

Skip to: Disqual

The “Includes all” operator

The Includes all operator is available to use with multi-select questions, multi-select grids, and open-end questions. Note that this operator has special implications when used with the text entry data sources (open-end questions) compared to the list data sources (multi-select question, grids, etc.). Be sure to read the Input/value field in conditions section to learn about these special nuances.

If you choose include all, then all the specified inputs/values must be "selected" or considered "true" for the condition criteria to be met and the skip to be executed.

Include all is like inserting an "and" in between inputs/values if multiple are specified.

Includes All Example

For example, in the image above we have specified that if the Beverages multi-select question includes all three response options, "Sprite" AND "Root Beer" AND "Coke" (in other words, if the respondent chose all three of these options), then skip to the Retailers multi-select question.

Like the includes any operator, when the logic statement gets converted to code and evaluated, the specified values for that condition are grouped together by being wrapped in parentheses. (This is important when doing advanced skip logic with multiple conditions).

If (Beverage = "Sprite" AND Beverage = "Root Beer" AND Beverage = "Coke")

Skip to: Retailers

Operators and text entry data types

If a text entry data source is selected, the "any" and "all" operators have an additional implication. That is, they also set the parse method.

Parsing is a scripting operation that searches through data, given criteria. The parse method, then, is the way by which the operation is performed. It determines the success criteria for the operation and what value(s) get returned from the parser.

Implicit parse method

Both the includes any and includes all operators set an implicit parse method when used on text data sources.

An implicit parse means that any individual words, or combinations of words, from the text data source matching the inputs/values specified in the skip condition count as fulfilling the condition criteria. In other words, the parser searches the entire text block (considering each individual word and/or combinations of words as potential matches to the inputs/values in the skip condition).

For example, let's assume we had an open-end question prompt that read "Please tell us what your preferred vehicle color is when purchasing a new vehicle." and three respondents answered with the following responses:

  1. Blue
  2. My favorite color is blue, but I also like green.
  3. I like neutral-colored vehicles. I think they are classier.

Let's also assume that we set up our skip condition with the "include any" operator, and with "blue" and "green" inputs/values.

Our implicit parse method would count respondents 1 and 2 as meeting the skip condition criteria and execute the skip because they either included the word "blue," or "green," or both in their response. Respondent 3 did not use "blue" or "green" so they would not be skipped.

Explicit parse method

The Is any operators set an "explicit" parse method for text data sources.

An explicit parse means that the entire text block (respondent's answer or variable value) must match exactly the word or phrase you specify in the skip condition. In other words, the parser only has one answer to consider: the whole value of the text data source.

Let's continue with the same example from the implicit parse method section above. But this time, the skip condition is set to the "is any" operator, and with "blue" and "green" inputs/values.

Given the same respondent answers, our explicit parse method would count respondent 1 as meeting the skip condition criteria and execute the skip because their answer matches explicitly to the "blue" input/value. Respondents 2 and 3 did not answer "blue" or "green" explicitly so they would not be skipped.

Operations on text data are not case sensitive.

The “Is any” operator

The Is any operator is available for text data types only (open-end questions and variables).

Is any works almost exactly like the Includes any operator covered previously.

If you choose Is any, then any of the specified inputs/values can be considered "true" for the condition criteria to be met and the skip to be executed.

It is like inserting an "or" in between inputs/values if multiple are specified. (see the "includes any" section above for an example of what this looks like)

The difference between is any and includes any is in the special implication for text data types that have been alluded to up till now. This implication is that operators also set the parse method. Continue to the Operators and text entry data sources section to learn about parse methods.

“Is answered” operator

The Is answered and Is not answered operators are straightforward. They are available on survey question data sources and simply evaluate to "true" if the data source (question) you selected was answered or not answered, respectively.

Input/value

This field is where you decide which values of a question or variable are evaluated. To restate the steps taken to get here:

  1. Select a question or variable.
  2. Choose an operator.
  3. Select list items or enter text in the input/value field.

The list items you select/specify in this field set the values that are evaluated to determine whether the skip condition has been met.

The input/value field will work differently depending on the data source you choose.

Data source: response options

If you have chosen a response option data source (survey question) then the input/value field is a dropdown menu, prepopulated with the list items from your survey. Select the item(s) in this dropdown that you would like to include in the logic condition.

Inputs Values Checks

When an item is selected, it is added to a list below the dropdown, in the form of a purple "chip." An item can be removed by clicking the "x" on the right side of the chip, or by opening the input/value menu and unchecking the item.

Inputs Values Chips

Data source: text

If you choose an open-end or variable, the input/value field is a box you can type text into. To specify the values you wish to include in the condition, click the input field, type the value, then press enter.

Text Entry Inputs

This inserts the value in a purple "chip" under the input/value box. Like before, the chips can be removed by clicking the "x" on the right side of the chip.

Skip-to destination

The skip-to destination field where you want to direct respondents that meet the criteria for the current skip logic statement.

To specify the destination, click the dropdown and select where you would like to skip respondents to. Only questions, exercises, and survey endings are valid destinations.

If you are trying to disqualify someone from continuing the survey based on your conditional logic, then the appropriate destination would be a survey ending.

Order of execution

With skip logic, order and specificity matter.

Skip logic is evaluated sequentially. Meaning, if there are multiple skip logic statements back-to-back in your survey, they are evaluated in the order they appear. This is true for multiple logic statements within the same skip logic element and across elements (if you have multiple skip elements one after the other).

The first skip in a sequence that evaluates to "true" will execute and therefore skip over any other skips in that sequence.

Similarly, the specificity of your logic may also influence whether a skip is evaluated. We recommend that you always put the most specific logic first (when you have multiple logic statements in a row). This ensures that your more specific conditions are evaluated and not be trumped by a more general skip condition.

For example, let's say you have the following skip conditions with the data source set to a Brands multi-select question:

  1. If (Brands = "Nike")
    Skip to: Shoes
  2. If (Brands = "Nike" AND Brands = "Adidas" AND Brands = "Puma")
    Skip to: Clothing-Types

Let's also assume that the skips are ordered as written here (#1 coming first, with #2 immediately following). Skip #2 would never be evaluated if the respondent checks "Nike". This is because the logic of skip #1 is more general and logic of skip #2 is more specific/explicit. As soon as a respondent checks the "Nike" checkbox, the skip #1 condition is met. Despite any other options that may have been selected in the Brands question, skip #1 will execute and route respondents to the "Shoes" location in the survey (skipping over skip #2).

To reorder skip logic elements, follow the instructions found in this document for reordering survey elements.

To reorder logic statements, simply click and drag the blue logic statement header bar.

Advanced skip logic

Skip logic in Discover is quite sophisticated. With a simple point-and-click interface you can create complex logic. In this section we explore what advanced skip logic looks like and how it works.

As mentioned before, conditions are the key components of skip logic. Understanding them is essential to configuring skip logic successfully. If you have not already read through the Conditions section and its components sections above, do it now so that you have a solid understanding before moving on.

Skip logic becomes "advanced" when a logic statement has multiple conditions.

Adding multiple conditions

To add extra conditions:

  1. Click the + Add condition button at the bottom of your first condition.
  2. A new condition appears below the previous in your statement.
Add Condition

The new condition contains the same settings as the first, with exception to the condition-level operator menu. Instead of the If or Always statement options, the menu now contains And or Or operators.

And or Dropdown

Condition-level operators are functionally like the operators discussed previously; in fact, they do the same thing just in separate ways.

Remember how multiple inputs/values are compared and evaluated with one of the operators previously discussed (includes any, includes all, is any, etc.)? Depending on the operator chosen, it is like inserting an “and” or an “or” in-between inputs/values and those inputs/values are grouped together inside parentheses.

Condition-level operators functionally do the same thing, but at a higher level. When you select And or Or from this menu, you insert that operator in-between two conditions and those conditions are then evaluated together.

This is immensely powerful. It allows you to build compound logic, referencing multiple data sources with various inputs/values in a single logic statement.

For an example of how this works, continue reading the next section.

Order precedence with condition-level operators

Operators from the condition-level operator menu follow order precedence. That is, they follow a set of rules that indicate the proper order in which conditions should be evaluated.

In common scripting languages, such as JavaScript, "and" has a higher precedence than "or." So, "and" operations are performed before "or" operations, and conditions joined by "and" also get grouped by adding parentheses around them.

This can be very complicated and confusing, so let’s look at an example.

Let’s assume that we have three questions (Occupation, Salary, and Location) and we want to configure a skip that executes when all criteria are met:

  • Occupation is Designer
  • Salary is $80K-$99K
  • Location is Utah

To configure this, we need to create 3 conditions:

  1. In the first condition, we reference the Occupation question, use the includes any operator, and select "Designer" in the input/value field.
  2. Next, we add a second condition by clicking the + Add condition button and choose the And option from the condition-level operator menu. Remember, doing this wraps parenthesis around condition 1 and condition 2.

    Select the Salary question for the data source, includes any operator, and the "80-89K" and "90-99K" options from the input/value menu. Remember here that because we selected multiple inputs/values these inputs are also wrapped in parentheses inside the condition-level parentheses.

    Translated to code, this is what we have so far:
If (Occupation = "Designer" AND (Salary = "80-89K" OR "90-99K"))
  1. The final piece for this condition is the location. We add another condition, set the condition-level operator to And, data source to location, operator to includes any, and input/value to "Utah".

The whole statement should look like this:

Advanced Skip Logic 1

Now because of how order precedence works with multiple And operators, condition 3 (the location condition) is appended to the end of the previous conditions, inside the condition-level parentheses.

So, our completed logic statement would look like this:

If (Occupation = "Designer" AND (Salary = "80-89K" OR "90-99K") AND Location = "Utah")

You can see how the And operations are always grouped, separated by Or operations (if there are any). To illustrate how the Or operator interacts within the logic let’s continue with our example.

Let’s now say that in addition to the demographic we already configured (a designer, $80K-$99K salary, in Utah), we want to add a second demographic to be considered for the skip. We also want to skip if there is a designer making $100K-$120K in California.

To do this, we add another condition (condition 4) to the skip logic statement we have been working with. This time we set the condition-level operator to Or. After that, we follow the same process as before, creating two more conditions but changing the salary range from 80-99K to 100-120K and the location to California.

The skip logic element would look like this:

Advanced Skip Logic 2

And the conversion to logic would look like this:

If (Occupation = "Designer" AND (Salary = "80-89k" OR "90-99k") AND Location = "Utah") OR (Occupation = "Designer" AND (Salary = "100-109k" OR "110-119k") AND Location = "California")

The key thing to note here is that the Or operator is the separator between And operations (which get combined).

Troubleshooting

During skip logic configuration in Discover, you may run into warnings or errors regarding the settings you have chosen. See the following for explanations of these messages:

Selection required for valid skip logic

The indicated input requires a valid selection for skip logic to work. Provide the necessary selections/inputs to resolve the error.

Including all items in a logic condition may produce undesired results

This appears when all the inputs/values have been included in the condition. Including all items in the condition essentially forces all responses to evaluate to “true” and execute the skip. This is as specific as you can get. Placing a skip logic statement with this condition in the wrong place means that it might not get evaluated. Use with caution.>

If this is the desired behavior, you could opt to create a logic statement that instead “always” skips a respondent to a specified question.

“Question name” appears after this skip logic statement in the survey. Unexpected behavior may occur during data collection

This message appears when the data source (question) appears after the skip in the survey flow. This is potentially problematic because if the question has not been answered yet then the skip cannot be evaluated (the logic cannot be validated). Be sure that the data source you select inputs/values to reference at the time the skip is supposed to be evaluated.

“Question name” appears before this skip logic statement in the survey. Unexpected behavior may occur during data collection.

This message appears when the skip-to destination is located before the skip location. This is potentially problematic because you may be sending respondents backwards, creating a loop. Ensure that sending respondents backwards in the survey is the intended behavior. If it is not, you will want to choose a destination in the survey that is after the skip location.