Help
Rules & Conditional Logic
Build intelligent surveys with conditional rules that show, hide, or skip questions based on respondent answers — manually or with AI assistance.
1. What Are Survey Rules?
Survey rules are the backbone of intelligent survey design. They let you define conditional logic that dynamically controls what a respondent sees based on the answers they provide. Instead of forcing every participant through the same linear set of questions, rules allow your survey to adapt in real time — showing relevant follow-ups, hiding irrelevant sections, and routing respondents down personalised paths.
Why Use Rules?
Rules transform a static questionnaire into a dynamic, conversational experience. Here are the key benefits:
- Shorter surveys — Respondents only see questions that apply to them, reducing fatigue and abandonment rates.
- Higher quality data — By filtering irrelevant questions, you avoid confusing respondents and collecting meaningless answers.
- Personalised experience — Each respondent follows a unique path that feels tailored to their situation.
- Screening and qualification — Disqualify ineligible respondents early so you only collect data from your target audience.
- Complex branching — Build multi-path surveys where different answers lead to entirely different question sets, all within a single survey.
How Rules Work
Every rule consists of two parts: a condition (the trigger) and an action (the result). When a respondent submits an answer that satisfies the condition, the corresponding action is executed immediately. Multiple rules can be defined on a single survey, and they are evaluated in the order they appear in the rules panel.
Anatomy of a Survey Rule
CONDITION
Source Question
Q1: Are you satisfied with our service?
Operator & Value
EQUALS
“Yes”
THEN
ACTION
Action Type
QUESTION_ON_PAGE
Target
Jump to Q3 on Page 2 (skip Q2)
When to Use Rules
Consider adding rules in these scenarios:
- Demographic filtering — Route respondents based on age, role, or industry.
- Satisfaction follow-up — Ask detractors why they are unhappy, while promoters see a referral prompt.
- Product-specific questions — Only show questions about features the respondent actually uses.
- Screening surveys — End the survey immediately if a respondent does not meet eligibility criteria.
- Multi-language or regional routing — Branch to different question sets based on respondent location or language preference.
2. Rule Conditions
A condition defines the criteria that must be met for a rule to fire. Each condition evaluates the respondent’s answer to a specific source question against a value you specify. SurveyAnalytica supports 11 condition types covering text matching, numeric comparisons, emptiness checks, and pattern matching.
Condition Types Reference
| Condition | Description | Example |
|---|---|---|
| EQUALS | Exact match against the provided value. Case-sensitive for text answers, exact for numeric values. | Answer equals "Yes" |
| NOT_EQUALS | The answer is anything other than the specified value. Useful for exclusion logic. | Answer is not "No" |
| CONTAINS | Checks whether the answer text includes the specified substring anywhere within it. | Answer contains "recommend" |
| NOT_CONTAINS | The answer text does not include the specified substring. Good for filtering out unwanted content. | Answer doesn’t contain "complaint" |
| GREATER_THAN | Numeric comparison where the answer must be strictly greater than the specified value. | Score greater than 7 |
| LESS_THAN | Numeric comparison where the answer must be strictly less than the specified value. | Score less than 4 |
| GREATER_THAN_OR_EQUAL | Numeric comparison where the answer must be greater than or exactly equal to the specified value. | Rating >= 8 |
| LESS_THAN_OR_EQUAL | Numeric comparison where the answer must be less than or exactly equal to the specified value. | Rating <= 3 |
| IS_EMPTY | The respondent did not provide any answer. No comparison value needed. Useful for optional question logic. | Response is blank (skipped question) |
| IS_NOT_EMPTY | The respondent provided some answer. No comparison value needed. Confirms engagement with a question. | Response is not blank (answered) |
| REGEX | Evaluates the answer against a regular expression pattern. Powerful for validating structured input like emails, phone numbers, or custom formats. | Email matches ^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$ |
Choosing the Right Condition
Aa
Text Matching
Use EQUALS or NOT_EQUALS for radio buttons, dropdowns, and yes/no questions where answers are fixed values. Use CONTAINS or NOT_CONTAINS for free-text fields where partial matching is needed.
#
Numeric Comparisons
Use GREATER_THAN, LESS_THAN, and their inclusive variants for NPS scores, slider values, rating scales, and any question that produces a numeric answer.
?
Emptiness Checks
Use IS_EMPTY and IS_NOT_EMPTY for optional questions where you want different follow-up paths based on whether the respondent chose to answer at all.
.*
Pattern Matching
Use REGEX for advanced scenarios where you need to validate structured input. Supports full regular expression syntax for maximum flexibility.
3. Rule Actions
Once a condition is satisfied, the rule executes an action that controls the survey flow. SurveyAnalytica provides 10 action types organised into three categories: navigation, visibility, and page control. Each action type targets specific elements within your survey.
Navigation Actions
Navigation actions change where the respondent is directed next. They override the default sequential flow of the survey.
| Action | Description | Target |
|---|---|---|
| TOP_OF_PAGE | Jumps the respondent to the top of a specific page in the survey. All questions on that page become visible. Useful for directing respondents to an entirely different section. | Page number |
| QUESTION_ON_PAGE | Jumps directly to a specific question on a specific page. More precise than TOP_OF_PAGE when you want to skip only certain questions at the beginning of a page. | Page number + Question ID |
| END_SURVEY | Immediately ends the survey and records the response as complete. The respondent sees the end/thank-you page. Their partial data is saved. | None (survey ends) |
| ABANDON_SURVEY | Ends the survey without recording the response. The respondent’s data is discarded. Use this for disqualification screening where you do not want partial data in your results. | None (survey abandoned) |
Visibility Actions
Visibility actions show or hide specific questions or answer options within questions. These do not change navigation; they modify what is visible on the current or upcoming pages.
| Action | Description | Target |
|---|---|---|
| FILTER_QUESTIONS | Hides one or more specific questions from the survey. Hidden questions are skipped and do not appear to the respondent. Useful for removing follow-ups that do not apply. | One or more Question IDs |
| SHOW_QUESTIONS | Makes previously hidden questions visible. Use in combination with FILTER_QUESTIONS when you have questions that start hidden and only appear under certain conditions. | One or more Question IDs |
| FILTER_OPTIONS | Hides specific answer options within a question. The question itself remains visible, but certain choices are removed from the option list. Ideal for piped or filtered choice lists. | Question ID + Option IDs |
| SHOW_OPTIONS | Makes previously hidden options visible within a question. Use when answer choices should only appear based on earlier responses. | Question ID + Option IDs |
Page Control Actions
Page control actions show or hide entire pages in the survey flow. They affect all questions on the targeted page at once.
| Action | Description | Target |
|---|---|---|
| SHOW_PAGE | Makes a previously hidden page visible in the survey flow. The page and all its questions become accessible to the respondent when they navigate to that point in the survey. | Page number |
| HIDE_PAGE | Removes an entire page from the survey flow. The respondent skips over the hidden page as if it does not exist. All questions on that page are effectively invisible. | Page number |
4. Creating Rules Manually
The Rules panel in the survey builder provides a straightforward interface for creating and managing conditional logic. Follow the steps below to add your first rule. Each rule is defined by selecting a source question, condition, value, action, and target.
Step-by-Step Guide
- 1Open the Rules panel — In the survey builder, locate the toolbar at the top of the canvas. Click the Rules icon (a branching-path icon) to open the rules panel. It slides in from the right side of the screen, showing all existing rules for the survey.
- 2Click “Add Rule” — At the top of the Rules panel, click the + Add Rule button. A new blank rule card appears, ready for configuration. The card expands to show all the fields you need to fill in.
- 3Select the source question — From the If answer to dropdown, choose the question whose answer will trigger this rule. The dropdown lists all questions in your survey by their label and question number (e.g., “Q1: How satisfied are you?”).
- 4Choose a condition type — From the Condition dropdown, select one of the 11 available condition types (EQUALS, NOT_EQUALS, CONTAINS, etc.). The condition determines how the respondent’s answer is evaluated against your specified value.
- 5Set the condition value — In the Value field, enter the comparison value. For text conditions, type the exact text or substring. For numeric conditions, enter a number. For IS_EMPTY and IS_NOT_EMPTY, this field is not required and will be hidden automatically.
- 6Choose an action type — From the Then dropdown, select the action that should occur when the condition is met. The available actions include navigation (TOP_OF_PAGE, QUESTION_ON_PAGE, END_SURVEY, ABANDON_SURVEY), visibility (FILTER_QUESTIONS, SHOW_QUESTIONS, FILTER_OPTIONS, SHOW_OPTIONS), and page control (SHOW_PAGE, HIDE_PAGE).
- 7Select the target — Based on the action type you chose, a target selector appears. For navigation actions, choose the destination page or question. For visibility actions, select which questions, options, or pages to show or hide. You can select multiple targets for visibility actions.
- 8Save the rule — Click the Save button on the rule card to confirm your configuration. The rule becomes active immediately in the survey builder preview. You can test it by previewing the survey and providing the triggering answer.
Add New Rule
x
IF ANSWER TO
Q1: How satisfied are you with our service?
CONDITION
EQUALS
VALUE
Dissatisfied
THEN
QUESTION_ON_PAGE
TARGET
Page 3 > Q8: What could we improve?
Save
Cancel
Editing and Reordering Rules
After creating rules, you can manage them from the Rules panel:
- Edit — Click on any existing rule card to expand it and modify the condition, value, action, or target.
- Delete — Click the trash icon on the rule card to remove it. A confirmation dialog appears before deletion.
- Reorder — Drag and drop rule cards within the panel to change their evaluation order. Rules higher in the list are evaluated first.
- Duplicate — Click the copy icon to duplicate an existing rule. This is useful when you need similar rules for multiple answer values.
5. AI Rule Builder
The AI Rule Builder lets you create survey rules by describing what you want in plain English. Instead of manually selecting conditions and actions from dropdowns, simply type a natural language description of the logic you need, and the AI will generate the corresponding rule configuration for your review.
How It Works
The AI Rule Builder is powered by a streaming AI assistant that understands your survey structure. It knows all your questions, pages, answer options, and supported rule types. When you describe a rule in natural language, the assistant:
- Parses your intent — Identifies the source question, condition, value, action, and target from your description.
- Maps to rule configuration — Translates your description into the exact condition type, action type, and target references.
- Generates a rule card — Presents a structured rule card showing the complete configuration for your review.
- Waits for approval — The rule is not applied until you explicitly approve it. You can reject it, modify the prompt, and try again.
Using the AI Assistant
- 1Open the AI Rule Builder — In the Rules panel, click the AI Assistant button (sparkle icon) at the top. A chat-like interface opens alongside the rules panel.
- 2Describe your rule — Type a natural language description of the conditional logic you want. Be as specific as possible about which questions, answers, and actions are involved.
- 3Review the generated rule — The AI responds with a structured rule card showing the source question, condition, value, action type, and target. Review each field carefully.
- 4Approve or reject — Click Approve to add the rule to your survey, or Reject to discard it and try a different prompt. You can also click Modify to adjust specific fields before approving.
AI Rule Builder
x
If the user selects “Dissatisfied” in Q3, skip to the
feedback section on page 4
You
AI Assistant
GENERATED RULE
Source:
Q3: How satisfied are you?
Condition:
EQUALS
“Dissatisfied”
Action:
TOP_OF_PAGE
Page 4 (Feedback Section)
Respondents who are dissatisfied will be directed to the detailed feedback page.
Approve
Reject
Modify
Example Prompts
Here are examples of prompts you can type into the AI Rule Builder to generate rules:
Skip Logic
“If the answer to Q2 is ‘No’, skip Q3 and Q4 and go directly to Q5.”
Disqualification
“End the survey immediately if the respondent is under 18 in Q1.”
Branching
“If Q5 answer contains ‘enterprise’, show page 3. If it contains ‘personal’, show page 4.”
9+
NPS Routing
“If the NPS score in Q7 is greater than or equal to 9, jump to the referral section on page 5.”
Conditional Options
“Hide the ‘Enterprise Plan’ option in Q10 if Q3 answer equals ‘Individual’.”
Multi-Rule
“Create three rules: scores 0-6 go to page 2, scores 7-8 go to page 3, scores 9-10 go to page 4.”
Reviewing and Modifying AI Suggestions
The AI Rule Builder presents generated rules as structured cards that you can review field by field. Here is how to handle each scenario:
- Rule looks correct — Click Approve to immediately add the rule to your survey. It appears in the Rules panel alongside your manually created rules.
- Rule is close but needs adjustments — Click Modify to open the rule in edit mode. You can change any field (source question, condition, value, action, or target) before saving.
- Rule is wrong — Click Reject to discard the suggestion. Refine your prompt and try again. Being more specific about question numbers, exact answer text, and target pages improves accuracy.
- Multiple rules needed — The AI can generate multiple rules from a single prompt. Each rule appears as a separate card, and you can approve or reject them individually.
6. Common Rule Patterns
While the combinations of conditions and actions are virtually unlimited, most survey logic falls into a handful of well-established patterns. These patterns cover the vast majority of real-world use cases and serve as excellent starting points for your own rule configurations.
Skip Logic
Skip irrelevant questions based on previous answers. For example, if a respondent has never used your product, skip all product-experience questions and jump to the general feedback section. Uses QUESTION_ON_PAGE or TOP_OF_PAGE actions with an EQUALS or NOT_EQUALS condition on a qualifying question.
Disqualification
End the survey early for respondents who do not meet eligibility criteria. Place screening questions at the beginning of your survey, then use END_SURVEY or ABANDON_SURVEY when a disqualifying answer is detected. Common with age verification, role-based filtering, and consent questions.
Branching
Create different paths through the survey based on a pivotal answer. One question routes respondents to entirely different sets of follow-up questions. Uses TOP_OF_PAGE or HIDE_PAGE/SHOW_PAGE to control which sections each respondent sees. Ideal for product-specific or role-specific question paths.
Conditional Options
Show or hide specific answer choices within a question based on earlier responses. For example, if a respondent selects “Free plan” in Q2, hide the “Enterprise support” option in Q5. Uses FILTER_OPTIONS and SHOW_OPTIONS actions to dynamically adjust available choices without removing the entire question.
Branching Visualised
The following diagram illustrates a common branching pattern where a single question routes respondents down two different paths before they reconverge at a final question:
SOURCE QUESTION
Q1: Choose your plan
Option A: Personal
Option B: Business
PERSONAL PATH
Q2a: Personal usage details
BUSINESS PATH
Q2b: Company size & needs
Q3: Final feedback
Both paths converge
Pattern Implementation Examples
Skip Logic Example
Scenario: Q1 asks “Have you used our mobile app?” If the answer is “No”, skip Q2 (“Rate the app experience”) and Q3 (“What features do you use?”) and jump directly to Q4.
| Field | Configuration |
|---|---|
| Source Question | Q1: Have you used our mobile app? |
| Condition | EQUALS |
| Value | “No” |
| Action | QUESTION_ON_PAGE |
| Target | Q4 on Page 1 |
Disqualification Example
Scenario: Q1 asks “Are you 18 years or older?” If the answer is “No”, end the survey without recording data.
| Field | Configuration |
|---|---|
| Source Question | Q1: Are you 18 years or older? |
| Condition | EQUALS |
| Value | “No” |
| Action | ABANDON_SURVEY |
| Target | None |
NPS Branching Example
Scenario: Q5 is an NPS question (0-10 scale). Route detractors (0-6) to a “What went wrong?” page, passives (7-8) to a general feedback page, and promoters (9-10) to a referral page.
| Rule | Condition | Value | Action | Target |
|---|---|---|---|---|
| Rule 1 (Detractors) | LESS_THAN_OR_EQUAL | 6 | TOP_OF_PAGE | Page 3 (Issues) |
| Rule 2 (Passives) | GREATER_THAN | 6 (+ second rule: LESS_THAN 9) | TOP_OF_PAGE | Page 4 (Feedback) |
| Rule 3 (Promoters) | GREATER_THAN_OR_EQUAL | 9 | TOP_OF_PAGE | Page 5 (Referral) |
7. Troubleshooting
Even well-designed rules can sometimes behave unexpectedly. This section covers the most common issues, their root causes, and how to resolve them. If your rules are not working as expected, start here before reaching out to support.
Common Issues
| Problem | Cause | Solution |
|---|---|---|
| Rule not firing | Wrong condition type selected. For example, using EQUALS when the answer includes extra whitespace or formatting, or using a text condition on a numeric field. | Verify the condition matches the answer format. For choice questions, ensure the value matches the exact option text. For numeric questions, use numeric condition types. Use the survey preview to test with the exact answer value. |
| Multiple rules conflict | Two or more rules target the same question or page with contradictory actions. For example, one rule hides Q5 while another shows Q5 based on overlapping conditions. | Review all rules in the Rules panel and check for overlapping conditions. Reorder rules so the most specific conditions are evaluated first. Remove duplicate or contradictory rules. Consider combining conditions into a single rule if possible. |
| Skipped questions still showing | The rule targets the wrong page or question number. This often happens when questions are reordered or pages are added after the rule was created. | Open the rule and verify the target page number and question ID are correct. If you have recently reorganised your survey, update all affected rules to reflect the new structure. |
| AI-generated rule incorrect | Ambiguous or vague prompt given to the AI Rule Builder. The AI may misidentify the source question, choose the wrong condition type, or target the wrong element. | Be more specific in your description. Reference questions by their exact number (Q3) or full label text. Specify the exact condition type if you know it. Mention page numbers explicitly. Review and use the Modify button to fix individual fields. |
| Rule fires on every response | Condition value is too broad. For example, using CONTAINS with a very short string that matches most answers, or using IS_NOT_EMPTY on a required question (which is always answered). | Narrow the condition value. Use EQUALS instead of CONTAINS for exact matching. If using IS_NOT_EMPTY, make sure the source question is actually optional. Test with multiple different answer values in preview. |
| Hidden question data missing | Questions hidden by FILTER_QUESTIONS are not submitted. If a respondent’s path hides a question, no data is recorded for it in the response. | This is expected behaviour. Hidden questions produce null/empty values in your data. Account for this in your analysis by filtering for non-null responses. If you need default values, add them during data processing. |
| Rule order matters unexpectedly | Rules are evaluated top-to-bottom. When multiple rules match the same answer, only the first matching navigation rule takes effect. Visibility rules all apply independently. | Reorder rules using drag-and-drop in the Rules panel. Place the most important and specific rules at the top. Remember that navigation rules (TOP_OF_PAGE, END_SURVEY) stop further rule evaluation, while visibility rules (FILTER_QUESTIONS, SHOW_QUESTIONS) all execute. |
| REGEX condition not matching | Regular expression syntax error or escaping issue. Special characters need proper escaping in the value field. | Test your regex pattern independently using an online regex tester before entering it. Ensure special characters like dots, brackets, and backslashes are properly escaped. Remember that the pattern must match the entire answer string if anchored with ^ and $. |
Debugging Checklist
When a rule is not behaving as expected, work through this checklist:
- 1Verify the source question — Open the rule and confirm it references the correct question. If questions have been reordered or deleted, the reference may be stale.
- 2Check the condition type — Ensure you are using the right condition. Text questions should use text conditions (EQUALS, CONTAINS). Numeric questions should use numeric conditions (GREATER_THAN, LESS_THAN). Optional questions should use emptiness checks (IS_EMPTY, IS_NOT_EMPTY).
- 3Validate the comparison value — Make sure the value in the rule exactly matches what the respondent would select or type. Watch for trailing spaces, case sensitivity, and special characters.
- 4Confirm the action type — Verify the action matches your intent. Navigation actions redirect the respondent. Visibility actions show or hide elements without redirecting. Page control actions affect entire pages.
- 5Check the target — Ensure the target page, question, or option still exists and has the correct ID. If you restructured your survey after creating the rule, the target may need updating.
- 6Review rule order — If multiple rules apply to the same question, check which one fires first. The first matching navigation rule wins. Reorder if needed.
- 7Test in preview — Open the survey preview and submit the triggering answer. Observe whether the expected action occurs. Try adjacent answers to ensure the condition boundaries are correct.
Need more help? If you are experiencing an issue not covered in this guide, contact our support team at support@surveyanalytica.com or use the in-app chat. For video tutorials on survey rules and conditional logic, visit the SurveyAnalytica Learning Center.