Show a question based on a participant flag
Using participant flags to control question visibility
This example shows how to display a question only if a participant flag has a certain value. We’ll use the case where a pregnancy question is shown only when the gender flag is set to female.
Create a single choice question as described here. In our example the title text is "Are you currently pregnant or think you might be pregnant?" with options "yes" and "no".
Go to the "Condition" tab to define conditional logic. Click “+ add value”.
In the dropdown menu, scroll to the Participant Flags section and select “Participant flag with key and value exists".
Enter "gender" in the key text input field and "female" in the value text input field.
Go to the survey simulator by clicking "View" in the top toolbar and selecting "Simulator".
You can now simulate a female participant by adding a "gender-female" pair in the context list. Therefore, click the pencil icon next to "Survey context" in the right-hand panel. A modal window titled "Survey Context Variables" will open.
Click the plus button to add a new variable.
In the left field, enter the variable name: "gender".
In the right field, enter the value: "female":
Click Save to confirm.
Your Survey Context should now include gender - female
, and the single choice question should be visible.