Skip to main content

Survey Logic Best Practices

Tips for Structuring Logic in your Survey Document

Updated over a week ago

Precision matters.

MX8 Lab’s AI reads every instruction literally. Clear, consistent logic and formatting in your survey document ensures your survey is programmed exactly as intended.

Default Responses

When to use:

If your study includes term points, you must define default responses for every question with a term point. These enable the AI to simulate data for all questions — including those with potential terminations.

Logic format:

default = "qualifying response"

Example:

Q. How old are you?

Type: Open-End (Numeric)

default = 22

Term Logic

Best practice:

Write termination logic on a separate line, not attached to a response option.

If you include “Disqualify” or “Terminate” within an answer choice, the AI assumes it’s part of the response list.

Don’t do this:

Q1. What is your gender?

Response Options:

- Male (Disqualify)

- Female

- Non-binary

Do this instead:

Q1. What is your gender?

Response Options:

- Male

- Female

- Non-binary

If Male at Q1, Term

Recodes

When to use:

If, for example, you want to report by generational cohorts, but your study captures age as an open-end numeric question, you’ll need to include recoding logic in your code.

Recoding translates raw responses (like a specific age) into categorized variables (like Gen Z, Millennial, Gen X, etc.) for easier analysis and reporting.

When creating recodes or logic based on previous questions, always specify:

  • The source question/variable

  • The conditions (e.g., “If selected” or “If equals”)

  • The output values

  • Whether the recode is exclusive, inclusive, or multi-select

Example:

If Q2 (Age) = 9–26, Recode as Gen_Z

If Q2 (Age) = 27–42, Recode as Millennial

If Q2 (Age) = 43–58, Recode as Gen_X

If Q2 (Age) = 59–77, Recode as Boomer

If Q2 (Age) = 78+, Recode as Silent_Generation

Quotas

When to use:

If you need your sample framework to be balanced across specific audience segments for weighting and analysis, always define quotas directly in the survey code.

Quotas ensure your study collects the right mix of respondents — for example, by age, gender, region, or customer type — and that results accurately represent your target population. Quotas may be for a single question or nested.

Quotas from your survey will be pre-populated in the Quota tab in the platform.

Example:

Q1. What is your gender?

Response Options:

- Male

- Female

Set Quota

If “Male” at Q1 50%

If “Female” at Q1 50%

Common Logic

Randomizing Lists

To randomize the order of response options:

randomize = True

Multi-Select Questions

If randomizing or including exclusive options:

Fixed Options = Other, None of the above

Exclusive Options = None of the above

Single-Select Questions

If randomizing:

Fixed Options = Other

Max Select/Ranking Questions

If limiting the number of selections from a list or ranking exercise, always include the min and/or max number of responses depending on the survey.

Example:

Max options = 3

Min options = 1

Scales

Always define:

  • The number of points, and

  • The anchor labels (if applicable)

Example:

5-point scale

Labels: “1” = “Not at all important”, “5” = “Very important”

Branching Logic

Purpose

Branching logic directs respondents to the right follow-up questions based on their previous answers. Because MX8’s AI follows logic literally, every condition must be explicitly stated — don’t rely on implied or conversational phrasing. Logic must be based on the exact response option.

Best Practices

Write one clear instruction per line, specifying:

• The source question (e.g., Q5)

• The condition (e.g., “If selected,” “If equals,” “If not selected”)

• The destination or action (e.g., “Show Q6,” “Skip to Q10,” “Terminate”)

Syntax Example

If Q5 = "Yes", Show Q6

If Q5 = "No", Skip to Q10

Question Example

Q5. Do you currently subscribe to any streaming services?

• Yes

• No

If Q5 = "Yes", Show Q6

If Q5 = "No", Skip to Q10

MX8 Labs Tips:

When in doubt, think like the AI — every line of logic should be explicit enough that a computer can’t misunderstand it.

This means:

  • Avoid relying on colors, highlights, or special characters — the AI does not interpret visual cues.

  • Reference exact question numbers and response text in all logic statements (branching, fixed options, exclusives, etc.)

  • Avoid using numbers to reference response options - use the exact wording (e.g. instead of Ask Q2 if “1”, “2” or “3” at Q1 use “Ask Q2 if “Nike”, “Converse” or “Adidas” at Q1

  • Write every rule in plain text

Did this answer your question?