goto routes respondents to a question, labeled group, or page based on a condition being "true." After routing, the survey continues from that point and follows any page or group conditions thereafter.
5. Which of the following have you eaten in the past three months?
type: checkbox
instructions: Select all that apply.
randomize: y
1. Strawberry
2. Banana
3. Apple
4. Pear
5. Sweet potato
6. Carrot
7. Avocado
100. Notrealfood {goto: bad}
99. None of these {exclusive: y} {term: y}
Details
-
gotocan be used as a tag, element decorator, or standalone widget:-
Widget –
gotois independent of other questions/variables and requires a question ID, page label, or group label as input. Use aconditiontag to define the trigger. For complex logic (e.g., Perl statements), use the widget. -
Tag –
gotois attached to the question/variable the condition is based on and requires a target label or question ID as input. Use aconditiondecorator to define the trigger, (e.g.,goto: bad {if anyChecked($Q5,100)}). Multiplegototags can be applied to the same question. -
Element Decorator –
gotois attached to an option and is triggered when the option is selected. No condition is necessary. Multiplegotodecorators can be used per question, one per answer option.
-
Widget –
-
gotois mainly used for routing to system groups like"term"for deferred terminations or"bad"for respondents that fail quality checks. - Use the
onloadtag to executegotoon page load instead of page submission.
Caution! goto overrides group conditions, allowing respondents to enter a group even if its condition is false. However, group conditions are re-evaluated after each page submission, and if not met, respondents are routed out immediately.
Additional examples
Using 'goto' as a single line tag
In cases where using the goto decorator is not possible, it can be used as a tag instead. In the example below, the goto is attached to the question as a tag to terminate anyone who is under 18.
1. How old are you?
type: integer
range: 0-120
goto: term {if $Q1<18}
Using 'goto' as a standalone widget
If the goto tag cannot be easily applied, such as when termination depends on multiple questions, it can be used as a standalone widget.
In this example, respondents who are under 25 and live in the Northeast will be sent to a later point in the survey labeled 'YNE'.
3. What is your age?
type: radio
1. Under 25
2. 25-44
3. 45 or older
4. In what region do you live?
type: radio
1. Northeast
2. South
3. Midwest
4. West
goto: YNE
condition: anyChecked($Q3,1) and anyChecked($Q4,1)
Overriding deferred terminations
A common use case for goto is to override a deferred termination. A respondent can be terminated before they reach the deferred term point by including goto: term as a tag or widget along with the appropriate condition.
For example, if a survey uses defer term to terminate respondents at the 'deferred' page, but respondents under 18 should be terminated immediately at QAGE, add the goto: term widget and apply the same condition as the term if tag.
app config
singlepage: y
defer term: deferred
AGE. What is your age?
type: integer
range: 1-99
term if: $QAGE < 18 {text: AGE | Under 18} {id: AGE} {goto: term}
1. Have you participated in any research on this topic in the past year?
type: radio
1. Yes {term: y}
2. No
2. Do you have any pets in your household?
type: radio
1. Yes
2. No
new page: deferred
text: The rest of the survey continues here.
Creating confirmation loops with the 'goto' decorator
Confirmation loops can be created with goto to verify answers for previous questions and redirect the respondent to a previous question to edit their prior response(s).
In this example, respondents who claim to have 20 or more cats and dogs will be shown Q3. If they verify that they did answer the previous questions correctly, they can continue. If 'No' is selected at Q3, the goto decorator routes the respondent back to Q1 so they can alter their responses for Q1 and/or Q2.
1. How many cats do you live with?
type: number
datatype: whole
size: 3
2. How many dogs do you live with?
type: number
datatype: whole
size: 3
3. You indicated you have 20 or more pets living with you. Is that correct?
show if: $Q1 + $Q2 >=20
type: radio
1. Yes
2. No {goto: Q1}
Comments
0 comments
Please sign in to leave a comment.