AYTM Logic


AYTM logic is a simple yet powerful way to program most surveys on the platform, covering everything from simple skip logic and piping to very advanced researcher needs, including custom variables, references, monadic survey design, groups, and more! With a series of simple language statements, written in [square brackets] right in the survey fields, you can build a tailored survey taking experience for respondents, while keeping full control of how the data is collected and compiled for analysis.


Here are a few examples of what you can do with AYTM Logic:


  • Show or hide a question/answer if respondent has selected a specific answer on another question
  • Pipe-in top answer text from a ranking (reorder) question
  • Skip respondent to the end of the survey if specific conditions are met
  • Modify question text based on a cluster respondent becomes assigned to as a result of a typing tool section of the survey or other conditions
  • Set up sequential monadic studies: show each respondent 3 batteries of questions out of 15 total batteries in the group
  • Program a quiz, keep track of the progress and display customized results screens at the end.


Variable types


Direct references


Direct references point to a specific survey question, or to one of its subparts. You can think about it as an address of any given field within the survey. Use the following conventional letters to refer to a question, sub-question or one of its answers. A few example of direct references:


  • PQ1 - refers to the first Pre-Qualification question
  • PQ1A1 - refers to the first Answer on the first pre-qualification question
  • Q1 - refers to the first Question
  • Q1A1 - refers to the first answer on the first question
  • Q1SQ1 - refers to the first Sub-Question of the first (matrix) Question
  • Q1SQ1A1 - refers to the first Answer on the first Sub-Question of the first Question

EXAMPLES:


  • [Hide if PQ1A1] - If you insert this logic into a question field, entire question will be hidden for those respondents who have selected the first answer on the first pre-qualification question of the survey.
  • [Q1A1] - Say first answer on the first question was "Toyota". By inserting this reference into any following field in the survey you can remind respondents of their choice and ask for clarifications. For example: if you program: "You have mentioned earlier that your favorite car brand is [Q1A1]. Please share why." respondent will see: "You have mentioned earlier that your favorite car brand is Toyota. Please share why."

References are programmed to refer to the same element, even if its location has changed due to addition of new elements in front of it, or even due to dragging it to a different place. Thus, [Show if Q1A1] will become [Show if Q2A1] if you add a new question in front of Q1. Same applies for other levels of the hierarchy: sub-questions and answers.


If you delete an element, referenced in an AYTM logic, the reference will be highlighted in orange. We will also add a "?" sign in front of it (e.g. [Show if ?Q1A1]), indicating that it now points to a different question than initially targeted, and it needs your attention. Don't worry - it is not possible to launch a survey without fixing all broken references.




All question types

Question level

[Q1] or [PQ1]

  Single-choice prequal

Answer level

[PQ1A1]

  Multiple positive choices prequal

Answer level

[PQ1A1]

  Multiple negative choices prequal

Answer level

[PQ1A1]

  Radio buttons

Answer level

[Q1A1]

  Checkboxes

Answer level

[Q1A1]

  Sliders

Sub-question level

[Q1SQ1]

  Sliders

Sub-question - answer level

[Q1SQ1A1]

  Progressive matrix

Sub-question level

[Q1SQ1]

  Progressive matrix

Sub-question - answer level

[Q1SQ1A1]

  Smiley rating

Sub-question level

[Q1SQ1]

  Smiley rating

Sub-question-Smiley level

[Q1SQ1A1]

  Star rating

Sub-question level

[Q1SQ1]

  Star rating

Sub-question-Star level

[Q1SQ1A1]

  Reorder (ranking)

Item level

[Q1A1]

  Side-by-side comparison

Answer level

[Q1A1]

  Distribute

Item level

[Q1SQ1]

  Polarity Scale

Scale level

[Q1SQ1]

  Polarity Scale

Scale-left

[Q1SQ1A1]

  Polarity Scale

Scale-right

[Q1SQ1A2]

  Video response

Talking point

[Q1A1]*

  Combobox

Item level

[Q1A1]

  Forms

Field level

[Q1A1]

  Quadrant Analysis

Entity level

[Q1E1]

  Quadrant Analysis

Entity-Attribute level

[Q1E1SQ1]

  Quadrant Analysis

Entity-Attribute-Star/Slider value

[Q1E1SQ1A1]*

  Competitive Topography

Entity level

[Q1E1]

  Competitive Topography

Entity-Attribute level

[Q1E1SQ1]

  Competitive Topography

Entity-Attribute-Star/Slider value

[Q1E1SQ1A1]*

*- in development



Aliases


Complex surveys often evolve over the time, questions get added or removed as the study takes shape. When it happens, one of the ways to avoid eventual correction of direct references is to assign special aliases to the key fields of your survey. They work just like the direct references but will remain constant regardless of the position of the field. They always start with the "@" sign immediately followed by an alphanumeric (A-Z, a-z,0-9,_) alias name you come up with to help you remember and identify the reference. @aliases are referencing an exact field within question where they are entered or the question itself. Aliases must be unique within a survey.


EXAMPLES:


  • [@likes_Purple] was placed in a question Q18, asking of the color preferences, at the purple answer (A5) . This is later used in a different question [Show if @likes_Purple] to only address the subset of respondents who selected that answer. Now you can move Q18 and A5 within it to any position and the reference will still work.



All question types

Question level

[Q1] or [PQ1]

  Single-choice prequal

Answer level

[PQ1A1]

  Multiple positive choices prequal

Answer level

[PQ1A1]

  Multiple negative choices prequal

Answer level

[PQ1A1]

  Radio buttons

Answer level

[Q1A1]

  Checkboxes

Answer level

[Q1A1]

  Instruction text

Instruction text

[Q1A1]

  Sliders

Sub-question level

[Q1SQ1]

  Progressive matrix

Sub-question level

[Q1SQ1]

  Smiley rating

Sub-question level

[Q1SQ1]

  Star rating

Sub-question level

[Q1SQ1]

  Reorder (ranking)

Item level

[Q1A1]

  Side-by-side comparison

Answer level

[Q1A1]

  Distribute

Item level

[Q1SQ1]

  Polarity Scale

Scale-left

[Q1SQ1A1]

  Polarity Scale

Scale-right

[Q1SQ1A2]

  Video response

Talking point

[Q1A1]*

  Forms

Field level

[Q1A1]

  Quadrant Analysis

Entity level

[Q1E1]

  Competitive Topography

Entity level

[Q1E1]

*- in development



Variables


Sometimes referring to an answer chosen earlier in the survey is not enough. You may want to cluster respondents by many conditions, based on the way they answered different questions, their known demographics etc. You can declare and alter variables throughout the survey and then adjust survey logic accordingly.


If your survey is a quiz, you can increase or decrease the running score for each respondent as they fail or succeed answering your questions. The value of your variable will be kept individual for each respondent and you can refer to it when you are ready to show the results or alter survey experience based on their achievements. Please note: Instead of "QuizScore" you can use any alphanumeric variable name that suits your needs (A-Z, a-z, 0-9,_). Underscores are allowed.


  • [QuizScore = 0] - Initializes variable "QuizScore" with the value 0.
  • [QuizScore + 1] - Adds 1 to the value of variable "QuizScore"
  • [QuizScore - 5] - Subtracts 5 from the value of variable "QuizScore"

Another example: you can create a variable "NPS" and assign respondents value "Promoter" or "Detractor" based on the answers they gave on your NPS (Net Promoter score) question. Later on you can append an extra modifier to the variable, if you find them to be an influencer on top of being a Promoter.


  • [NPS = "Promoter"] - Initializes variable "NPS" with the text value "Promoter"
  • [NPS + "and Influencer"] - Adds "Influencer" string to the "NPS" variable: resulting in "Promoter and Influencer"

As you can see from the examples above, variables can store text or numbers for further use in the logic. To simplify things AYTM Logic doesn't require you to declare variables so you can start using them where you want. The type of variable (text or numbers) is determined on initialization when you used it for the first time. By default each variable stores an empty value "". You can use the following characters in the name of the variable: A-Z, a-z, 0-9 and the underscore symbol "_". Variable names must always begin with a letter. String values of variables must be surrounded by quotes and may contain any character. Variable names can't be identical to a few reserved names: uuid, var1, var2, var3, device, browser, gender, income, education_level , age, children, relationship_status, ethnicity, employment, career, show, hide, group, if, not, max, or, and, exclude, and exit. Also no variables can start with letter Q# (followed by a number) or letters PQ# (followed by a number), as they are reserved for direct references.


You can show respondent the value of any variable by surrounding its name in square brackets. For example,


  • [QuizScore] - From the example above, will show respondent the score they've achieved by the time they enter the field.

You may also want to use this method to see the value of a variable during survey programming process to check that everything works as expected and then remove it before launching if you don’t want respondents to see it.


Furthermore, you can use one of the reserved variable names in square brackets to pipe in their value: uuid, var1, var2, var3, device, browser, gender, income, education_level, age, children, relationship_status, ethnicity, employment, and career. For example, you can type in the following Question: "We've noticed that you're using [device] to take this survey. Is this correct?". Respondent, answering on an iphone will see: "We've noticed that you're using mobile to take this survey. Is this correct?"




Var1, var2, and var3 can be mapped to give you access to any custom variables you are passing through the URL when using list surveys.


Variables will be initialized and updated when respondent exits the question, so you can't rely on a manipulation with the variable within a question until they've made their choice and moved to the next one.



Arrays


In some situations it is convenient to have multiple individual elements (numbers, texts, variables) to be combined in a single collection - an array. Once an array is created, whether the same for everyone, or different for each respondent, it can be used in many scenarios:


  • Extract individual elements by their indices
  • Display the whole array to the respondent, each element delimited with a comma
  • Compare to another array and see if they match or not
  • Do an exact search within an array. For example, you might want to find if respondent said "agree" or "yes" in any of his OE responses (previously collected into an array)
  • Search for a part of text in an array. Useful for checking if respondent mentioned specific brand in his OE response, given an array of possible misspells of the brand

Syntax:


  • [ar << 1] Create new array with number 1, or add to existing array number 1
  • [ar << 1,2,3,4] Create new array with numbers 1,2,3,4 , or add to existing array numbers 1,2,3,4
  • [ar_1 << "first", "second", "third"] Create new array or populate an existing one with texts "first", "second", and "third"
  • [v4 << '0', 1, 2, 3] multiple types in an array are supported
  • [ar3|3] pipe in third item from ar3
  • [ar3] pipe whole array, comma delimited
  • [ar4|3 + 1] add 1 to the third item in ar4
  • [show if ar4|501 = 7] shown if 501th item in ar4 equals 7
  • [show if ar3 = ar4] shown if arrays are equal to each other (order of items matters)
  • [show if "first" in ar_1] shown if there's at least one "first" in the ar_1
  • [show if "st" like ar_1 ] shown if there's at least one text that contains "st" in ar_1

EXAMPLES:


You asked respondents where their most exciting vacation took place in an open-ended question. Further, if respondent mentioned a variation of the US country name, you want to ask additional questions. At the beginning of the survey, in a section that every respondent would see you would put [usvariants<<"US","U.S.","United States","USA","U.S.A.","United States of America"] array declaration. This array can now be used in the section of questions to only show them if US was mentioned in the OE: [show if Q5RC like usvariants]


During a survey you assign respondents labels, such as "early bird", "influencer", etc. At the end of the survey you want to show some questions to each labeled group, e.g. only "early bird" respondents would see Q10, only "influencers" would see Q11, and so on. While a respondent can be profiled to multiple labels at once, you would require multiple individual variables ([earlybird=1] if respondent is an early bird, [influence=1] if respondent is an influencer, etc). A solution with arrays is much more elegant. You would use an array named "labels". During the survey, if respondent satisfies the profiling criteria, you would add the label to the array with [labels<<"influencer"]. At Q10 you would simply write [show if "early bird" in labels], and in Q11 [show if "influencer" in labels].



Reference Usage


References and aliases can be used in multiple ways, achieving a wide range of possible text and survey flow manipulations. Below you will see different ways references and aliases can be used to point to a specific text or an image, check if respondent was exposed to a question, and many other uses.



Exposure


When references or aliases pointing to a question or a sub-question are used in survey flow operators without any additional modifiers, they are treated as a True/False, based on whether the respondent was exposed to (saw) the question or not. Exposure logic is only limited to references and aliases pointing to question or sub-question levels.


EXAMPLES:


  • [show if @selectedForDetailedInspection] - The alias @selectedForDetailedInspection was placed in a question, which only a portion of respondents saw. The logic was placed in a different question, restricting the exposure to only this particular subset of respondents.
  • [show if Q5] - Same as above, but with a direct reference to the question, Q5 in this case
  • [show if Q5SQ1] - Same as above, but referencing exposure to the first sub-question of Q5
  • [skip to Q10 if Q5] - Skips respondent to the Q10, if respondent was exposed to Q5.
  • [skip to Q10 if not Q5] - Skips respondent to the Q10, if respondent was NOT exposed to Q5


Choice


When references or aliases pointing to an answer are used in survey flow operators without any additional modifiers, they are treated as a True/False, based on whether the respondent has selected this answer or not. Selection logic is only limited to references and aliases pointing to an answer.


EXAMPLES:


  • [show if @selectedForDetailedInspection] - The alias @selectedForDetailedInspection was placed on an answer level. The logic was placed in a different question, restricting the exposure to only those who selected the answer where the alias resides.
  • [show if Q5A1] - Same as above, but with a direct reference to the first answer in the fifth question
  • [show if Q5SQ1A1] - Same as above, but with a direct reference to the first answer of the first sub-question in the fifth question
  • [skip to Q10 if Q5A1] - Skips respondent to the Q10, if respondent selected A1 on the Q5.
  • [skip to Q10 if not Q5A1] - Skips respondent to the Q10, if respondent did not select A1 on the Q5


Piping Text


It is possible to extract question/sub-question/answer texts using direct references. This can be done by simply mentioning the reference in the logic, without any modifiers. The logic can be placed at any level: question, sub-question, answer. Please note, that respondent has to have been exposed to the element first before the text can be used in the logic. If the exposure didn't happen, "logic error" would be piped instead. Please note, if you want to pipe answer text in questions which have the sub-question level, you must mention a sub-question in the reference. For example, [Q1SQ1A5] would be the right way of piping fifth answer text from the first question.


EXAMPLES:


  • [Q10] - Wherever this logic is placed, question text from Q10 would be piped in.
  • [Q10 if Q5A1] - This will pipe text from Q10 if respondent chose the first answer from the fifth question
  • [Q10 if @promoter] - This will pipe text from Q10 if respondent was aliased as promoter somewhere previously in the survey.
  • [Q10A1] - Wherever this logic is placed, first answer text from Q10 would be placed instead of the logic.
  • [Q10A1 if Q5A1] - This will pipe text from the first answer of Q10 if respondent chose the first answer from the fifth question
  • [Q10A1 if @promoter] - This will pipe text from the first answer Q10 if respondent was aliased as promoter somewhere previously in the survey.
  • [Q10SQ1] - Wherever this logic is placed, first sub-question text from Q10 would be placed in place of the logic.
  • [Q10SQ1A1] - Wherever this logic is placed, first answer from the first sub-question text from Q10 would be placed instead of the logic.


Response Text


It is possible to extract answer texts(s) for only chosen elements by appending “R” modifier to the reference. For all supported question type this command would return one or more elements that were chosen by a respondent. One exception: for an Open-ended question this command returns the actual text respondent entered in the field.
To obtain n’th selected answer text, you can append a number to get selection at this position. Please note, that the system records responses in order they were given by respondent, so randomization of items will influence the order of responses. If there is more than one element returned, the system will connect them with commas, and a ", and " at the last element. This rule changes to an alternative rule relevant to the chosen survey locale.


EXAMPLES:


  • [Q10r] - Q10 is a single-choice question. This reference, wherever placed, would then pipe text from the answer that respondent chose in Q1. A common use-case would be to construct a question text similar to the following: You have selected [Q10r] as your favorite animal. Please share why.
  • [Q10r1] - Q10 is a multi-choice question. This reference, wherever placed, would then pipe text from the first answer that respondent chose in Q10.
  • [Q10r] - Q10 is a multi-choice question. This reference, wherever placed, would then pipe text from all chosen answers in Q10. The items would be connected with delimiters and conjunctions. A common use-case would be to construct a question text similar to the following: You have selected [Q10R] as your favorite animals. Please share why. The respondent would see something like: “You have selected cows, horses, and goats as your favorite animals”
  • [Q10r1 if Q10rn>0] - Q10 is a multi-choice question. This reference, wherever placed, would then pipe text from the first answer that respondent chose in Q10 if they have made at least one choice.
  • [Show if Q1r='six month ago'] - The element of the command will only be shown if the response on Q1 was "six month ago"


  Single-choice prequal

Response text

[PQ1r]

  Multiple positive choices prequal

All response texts delimited

[PQ1r]

  Multiple positive choices prequal

One response text delimited

[PQ1r1]

  Multiple negative choices prequal

All response texts delimited

[PQ1r]

  Multiple negative choices prequal

One response text delimited

[PQ1r1]

  Radio buttons

Response text

[Q1r]

  Checkboxes

All response texts delimited

[Q1r]

  Checkboxes

One response text delimited

[Q1r1]

  Open ended

Open ended response text

[Q1r]

  Sliders

All response texts (answer texts) delimited

[Q1r]

  Sliders

One response text

[Q1r1]

  Progressive matrix

All response texts (answer texts) delimited

[Q1r]

  Progressive matrix

One response text

[Q1r1]

  Smiley rating

All response texts (Smiley texts) delimited

[Q1r]

  Smiley rating

One response smiley text (e.g. "Angry")

[Q1r1]

  Star rating

All response texts (Star texts) delimited

[Q1r]

  Star rating

One response star text (e.g. "1 star" "5 stars")

[Q1r1]

  Reorder (ranking)

All top ordered items, delimited

[Q1r]

  Reorder (ranking)

One top ordered item text

[Q1r1]

  Side-by-side comparison

All top ordered items texts delimited

[Q1r]

  Side-by-side comparison

One top ordered item

[Q1r1]

  Distribute

/th>

All tick text responses, delimited

[Q1r]

  Distribute

One tick text response

[Q1r1]

  Polarity Scale

All tick values reported, delimited (no sign)

[Q1r]

  Polarity Scale

One reported tick value (no sign)

[Q1r1]

  Combobox

Response text

[Q1r]

  Cascade

Response texts, delimited

[Q1r]

  Cascade

Response text from one field

[Q1r1]*

  Forms

Reported field texts, delimited

[Q1r]*

  Forms

One reported field text

[Q1r1]*

  Quadrant Analysis

All response texts (Star/slider texts) delimited

[Q1r]

  Quadrant Analysis

One response texts (Star/Slider texts)

[Q1r1]

  Competitive Topography

All response texts (Star/slider texts) delimited

[Q1r]

  Competitive Topography

One response texts (Star/Slider texts)

[Q1r1]

*- in development



Number of Responses


Use "RN" addition to the reference to obtain the number of selected items. This is relevant for multi-choice question types, as one may create survey flow based on how many checkboxes were ticked by respondents.
For the optional open-ended question, the "RN" returns 0 if respondent opted to proceed without writing anything.


EXAMPLES:


  • [Q10rn] - This logic will display the number of selected answers in Q10, as a plain number
  • [Q10SQ1rn] - This logic will display the number of selected answers in the first sub-question of Q10, in a plain number
  • [show if Q10rn>1] - The item where this logic resides will only be shown if the number of selected answers in Q10 is greater than 1.
  • [show if Q4 and Q4rn=1] - Q4 is an open-ended question type, with the "optional" feature enabled. This code will make the element visible if respondent was exposed to the fourth question, and wrote something in it.


Comment Text


By appending "C" to the end of the reference you can extract and display the open-ended response from an appropriate element.


EXAMPLES:


  • [Q10c] - Q10 is an open-ended question. This command will extract the comment from the question and pipe it in place of the logic.
  • [Q10A1c] - Q10 is a single-choice question, and the first element has an open-ended field enabled. This command would extract the answer, and pipe it in place.
  • [Q10rc] - This command will extract all open-ended responses from Q10 and display them with delimiters and conjunctions.
  • [Show if Q1rc='six month ago'] - The element of the command will only be shown if the response on an open-ended question Q1 was "six month ago"


Item position


By appending “P” literal after a direct reference you can get the position on which this item appeared to a particular respondent. The value is returned as a usable text, such as “first” “second” etc. If the item was not seen by respondent, an empty “” would be returned.
This is especially useful if respondent previously expressed item preference through Reorder (ranking) or Side-by-side comparison exercise, the knowledge of the item ordered position can be further used to ask the reasoning: You mentioned apples were your [Q1A1p] choice, why? If apples took the second place in the Q1 ranking question, respondent would see You mentioned apples were your second choice, why?.


EXAMPLES:


  • [Q12A1p] - Q12 was a single-choice question with randomization on. This logic placed further in the survey would yield “first”, “second”, “third” etc. texts, depending on the order of items seen.
  • -[Show if Q12A5p=”first”] - if the fifth item of the Q12 was seen on the first position, this logic will be activated, allowing display of the element it is situated in.


Convert to numeric value


There are multiple places where there is a need to convert text into a number for further manipulations. This is valid for almost all reference modifiers, and can be achieved by appending “V” at the end of the command. This tells the algorithm to attempt to smartly convert the text into a simple numeric value. In most cases it would search for digits until it hits a non-numeric symbol, or the end of text. If it is impossible to find a number, the algorithm returns 0.
For open-ended question, or questions that support open-ended responses on item level, the open-ended response can be converted to a number with this operation. We recommend using Forms question type with a numeric mask such as ### to enforce numeric only input to avoid respondents entering non-numeric symbols.
For references that use positional modifier “P”, the system converts the texts into numbers knowing that “first”=1, “second”=2, and so on. This allows for cleaner logic such as [show if Q5A5pv<4] that would show the element only if Q5A5 item was in the top 3 positions in Q5.
This numeric value functionality is especially useful for question types that support numeric input, such as Distribute (actual numerical input), Polarity Scale (0-100 values), Smileys (e.g. for 3 smileys values are -1, 0, 1), Stars (star count).


EXAMPLES:


  • [Q1A1pv] - assuming Q1 was a ranking exercise, this logic would pipe-in the numeric value of a position of the first element in Q1.
  • [skip to EXIT if Q1A1cv<18 or Q1A1cv>25] - assuming Q1 was Forms question type with the first element enforcing numeric input, this would redirect all respondents out of the survey if their response to the Forms field was less than 18 or greater than 25.
  • [show if Q1cv>0] You said you use shampoo [Q1cv] times a week - Q1 was a simple open-ended question, asking how many times respondent uses shampoo per week. The response is then converted to a number, and only people who entered a number, and this number being greater than 0, would be shown the next question where this logic resides.
  • [hide if Q5SQ1rv<10] - Q5 is a distribute question type, asking to allocate 100 dollars on different items (simulation of a shopping experience). First item (SQ1) was a branded toothbrush. The next question (where this logic is located) will not be shown if the amount allocated to the branded toothbrush is less than 10 dollars.
  • You are in a good mood about these products. Please share the details. [show if Q8SQ1rv>0 and Q8SQ2rv>0] - Q8 is Smileys question type with 5 possible smileys. The element would be shown only if all of the two elements in Q8 received positive (higher than neutral) smileys. Remember: smileys are coded as -2 -1 0 1 2.
  • You said you find this product Calm. Which of these were the reasons [show if Q9SQ1A1 and Q9SQ1rv>60] - Q9 is Polarity Scale question type, exploring respondents’ opinion on a product on two-sided scales. First pair was Calm-Exciting. The next question (this logic’s location) will only be shown to respondents who’ve dragged the slider to the Calm side (Q9SQ1A1), and their slider was far away from center (Q9SQ1RV>60). Remember: Polarity Scale ranges from 0 to 100 both directions.


Image


To show an image associated with the element, append "i" to the direct reference and the image will become attached to the field. To specify image options, you can also add "x" to toggle expanded view, "s" to allow image scrolling, and "xs" if you want both functionalities enabled.


Please note: if respondent didn't see the sourced image, no image will be shown.



EXAMPLES:


  • [Q1i] - Wherever placed, this command will place an image taken from the first question.
  • [Q1ix] - Wherever placed, this command will place an image taken from the first question, and make it expanded.
  • [Q1is] - Wherever placed, this command will place an image taken from the first question, and make it scrollable.
  • [Q1ixs] - Wherever placed, this command will place an image taken from the first question, and make it both expanded and scrollable.
  • [Q1A1i] - Wherever placed, this command will place an image taken from the first answer on the first question.
  • [Q1R1i] - Wherever placed, this command will place an image taken from the first response on the first question.
  • [show if q1R1i] - The element will be shown if the first response from the first question had an image


Ranges


There are multiple ways you can omit writing multiple "and"/"or" operators. This can be done on one level (answers), or on multiple (both answers and subquestions, answers and questions, etc.).



Comma = AND


Comma can be used instead of writing repeating "X and X and X" sequence. The shortcut allows a faster alternative to repeating the same question and sub-question numbers.


EXAMPLES:


  • [show if Q1A1,3,5] - This is shorter and more convenient way of writing [show if Q1A1 and Q1A3 and Q1A5]. The element would be shown only if the answers A1, A3, and A5 were selected on the first question.
  • [skip to Q5 if Q1A1,5 and Q2A1] - While the comma allows writing neat combination, if there's a need to add a different level, "and" would still have to be used. In this case the respondent skips to Q5 if they selected A1 and A5 from Q1, and the first answer from the second question.


Colon = AND


Colon symbol can be used instead of writing repeating "X and X and X" sequence of consecutive elements. The shortcut allows a faster alternative to repeating the same question and sub-question numbers, as well as it allows increased readability, as it only requires two numbers to reference the whole range


EXAMPLES:


  • [show if Q1A1:3] - This is shorter and more convenient way of writing [show if Q1A1 and Q1A2 and Q1A3]. The element would be shown only if the first three items were selected on the first question.
  • [skip to Q5 if Q1A1:3 and Q2A1] - While the colon allows writing neat combination, if there's need to add a different level, "and" would still have to be used. In this case the respondent skips to Q5 if they selected A1 through A3 from Q1, and the first answer from the second question.


Dot = OR


Dot symbol can be used instead of writing repeating "X or X or X" sequence of elements. The shortcut allows faster alternative to repeating the same question and sub-question numbers.


EXAMPLES:


  • [show if Q1A1.3.5] - This is shorter and more convenient way of writing [show if Q1A1 or Q1A3 or Q1A5]. The element would be shown only if any of the answers A1, A3, and A5 were selected on the first question.
  • [skip to Q5 if Q1A1.3 or Q2A1] - While the dot allows writing neat combination, if there's need to add a different level, "or" would still have to be used. In this case the respondent skips to Q5 if they selected A1 or A3 from Q1, or the first answer from the second question.


Dash = OR


Dash symbol can be used instead of writing repeating "X or X or X" sequence of consecutive elements. The shortcut allows omitting of repeating the same question and sub-question numbers, as well as it allows increased readability, as it only requires two indices to denote the whole range


EXAMPLES:


  • [show if Q1A1-3] - This is shorter and more convenient way of writing [show if Q1A1 or Q1A2 or Q1A3]. The element would be shown only if any of the first three items were selected on the first question.
  • [skip to Q5 if Q1A1-3 or Q2A1] - While the dash allows writing neat combination, if there's need to add a different level, "or" would still have to be used. In this case the respondent skips to Q5 if they selected any of A1 through A3 from Q1, or the first answer from the second question.


Multi-level


It is also possible to shorten the logic for cases, when the same answers need to be checked on multiple questions or subquestions. The ranges can be applied on multiple levels of the hierarchy at once with the syntax as in Q1:3A1-2 and Q1SQ1.3.4A1-2. Any range operation can be used.


EXAMPLES:


  • [show if Q1:3A1-2] - This is shorter and more convenient way of writing [show if (Q1A1 or Q1A2) and (Q2A1 or Q2A2) and (Q3A1 or Q3A2)]. The element would be shown if at least one of the first two items was selected in each of the questions 1, 2, and 3.
  • [show if Q1SQ1.3.4A1-2] - This is shorter and more convenient way of writing [show if (Q1SQ1A1 or Q1SQ1A2) or (Q1SQ3A1 or Q1SQ3A1)]. The element would be shown if respondent made selection at least once in A1 or A2 in subquestions 1 or 3.


Random number


For special cases when you want to use random numbers in your logic, [rand from:to] can be used to generate a random integer within defined range. The number can then be shown to respondent, used in survey flow operations, or in any other logic operations.


EXAMPLES:


  • Imagine you were given [rand 2:7] days of vacation... - a random number in range 2,3,4,5,6,7 would be shown to the respondent in place of logic
  • [savedRandom=rand 1:100] - store random number in a numeric variable for later use in [show if savedRandom<30] to only show some element to roughly 30% of respondents.


Survey Flow Operations


In most cases you will use AYTM Logic to alter survey flow. To tell the platform what you want to happen, open the square bracket and type one of the following expressions or commands:



[Skip to...]


Will divert survey flow to the specified question if the destination question will allow this respondent in. If this command contains conditionals, the survey flow will be altered if the condition is satisfied, otherwise the respondent will proceed to the next question in line. This command extends the "rabbit" functionality available in the UI of the platform.
If multiple destinations are specified, as in [Skip to Q5 or Q7 or Q9], the system will first check if there is at least one destination available for this respondent. If multiple are availabe, respondent will be redirected to one random destination of the available. If none of the destinations are available, the respondent will proceed to the next question in line. Availability of the destination can be altered by [hide..] and [show...] logic in the questions, and by the fact that the question was already seen by the respondent.


EXAMPLES:


  • [Skip to Q10] - will forward all respondents to question #10 after the question where this command resides (assuming Q10 accepts all respondents)
  • [Skip to Exit] - will forward all respondents to the end of the survey (while counting them as a valid complete)
  • [Skip to Q10 if Q5A2] - will forward respondents to question #10 if they selected second answer on the 5th question (assuming Q10 accepts all respondents)
  • [Skip to Q10 if @influencer] - will forward respondents to question #10 if they were aliased "influencer" previously in the survey (assuming Q10 accepts all respondents)
  • [Skip to Q10:15] - will randomly skip to any question in range Q10-Q15. If, for example, only two questions Q13 and Q15 can be entered by a respondent, the system will choose randomly out of Q13 and Q15.


[Show if ...]


This operation modifies visibility of a question or any subpart of it to respondents. [Show] unconditionally shows the element. With [Show if ...] you can specify under which conditions this element will be shown. Please remember that if a [skip to ...] logic targets a question with [show if ...] in it, respondents that do not satisfy the show condition will not be redirected, and will proceed with the next question after the question where [skip to...] is located.


EXAMPLES:


  • [Show] - will unconditionally show an element where it's entered for all respondents. You don’t typically need this rule as all questions in the survey are set to be visible by default.
  • [Show if Q5A2] - this element will only be shown if respondent selected second answer on the 5th question


[Hide if ...]


This operation modifies visibility of a question or any subpart of it to respondents. [Hide] unconditionally hides the element. With [Hide if ...] you can specify under which conditions this element will be hidden. Please remember that if a [skip to ...] logic targets a question with [hide if ...] in it, respondents that do satisfy the hide condition will not be redirected, and will proceed with the next question after the question where [skip to...] is located.


EXAMPLES:


  • [Hide] - will unconditionally hide an element where it's entered for all respondents
  • [Hide if @influencer] - will hide the element for all respondents aliased "influencer"
  • [Hide if not @influencer] - will hide the element for all respondents NOT aliased as "influencer"


[Mask by...]


Mask operation is a shortcut for situations, when you want to show only items selected by respondent on an earlier question without the need to write [Hide if...] in every field.
Please note: Masking logic currently does not work in prequalification questions. Masking by a prequalification question is also not allowed at the moment.


EXAMPLES:


  • In the example below [mask by Q1] limits visible options to those that respondents selected in Q1. Please note the additional logic needed to hide the second question if respondent selected just one checkbox on the first question.




[Rev-mask by...]


[rev mask by ...] does a reverse operation of the [mask by ...] - it limits the elements to be displayed to those not selected in the referenced question.


EXAMPLES:


  • In the example below [rev-mask by Q1] limits visible options to those that respondents did not select in Q1. Please note the additional logic needed to hide the second question if respondent selected just one checkbox on the first question.



Please note: In both mask by... and rev-mask by… logic it’s important to keep in mind that platform will not compare the literal match of answers in the referred and marked questions. It will hide or show answer choices based on their numbers in the editor. For example, if Q1A1 was selected, Q2A1 will be shown etc. Please make sure that you keep the items and their order as appears in the editor - synchronized. This also gives you control over altering the wording if needed. For example, if on the first question “Which of the following sports do you practice regularly?” respondent has selected Q1A1 “Skiing”, on the second masked question you may want to ask it a bit differently: “If you had to choose, what would you rather do?” with answer: Q2A1: “Ski”...



[Group ...]


Allows you to group certain questions or batteries of questions within the survey and control how many batteries each respondent should answer before exiting the group. The battery assignment is based on the least fill criteria - the batteries of questions that were assigned to respondents the least often will be preferred. If the respondent can't enter a battery ([hide] logic was placed in the first question of the battery), the algorithm searches again, as proposes a different battery until either the maximum limit reached, or there are no batteries left. Please note: this logic can be added in any field of the survey but we recommend adding it to the first question or at the beginning of the group itself.


EXAMPLES:


  • [group Q5-10 and Q11-12 and Q13-18 max 2] This logic is placed in one of the fields in the beginning of the survey. Three "nodes" - batteries of questions are defined: Q5 through Q10; Q11, Q12; Q13 through Q18. Note that the batteries are defined with ranges, with the OR variants. The batteries are connected with the AND operator. The last piece "max 2" defines that the respondent will enter two nodes out of the three. Once respondent enters any of the mentioned questions in a normal survey flow, this logic activates, and throws them to the two randomly selected batteries. When respondent completes the requirement, they will continue along the normal survey flow. The respondent will proceed to the first unseen question - most likely Q19 in this example.


Priority


Rules with higher priority will override conflicting rules with lower priority. AYTM Logic (1) is the highest.


  1. 1. AYTM Logic. Rules described above.
  2. 2. RABBITS. Navigation, controlled by skips, set up in the editor’s UI (both direct & random modes)
  3. 3. ORGANIC FLOW. By default - questions are shown sequentially from the first one to the last one.


Glossary


[...]

- AYTM logic must always be surrounded by square brackets

Q

- question

SQ

- subquestion

E

- entity

A

- answer

R

- response

Rn

- number of responses

Rc

- all comments, comma separated

Ri

- first image

c

- comment

i

- image

@

- field alias

or

- “or” operator

.

- alternative “or” operator

-

- alternative “or” operator - used for ranges

and

- “and” operator

,

- alternative “and” operator

:

- alternative “and” operator - used for ranges

+

- add

-

- subtract

*

- multiply

>

- greater than

<

- smaller than

>=

- greater or equal than

<=

- smaller or equal than

=

- equal to

!=

- not equal

<<

- add to array

,

- (in array context) add more items to array

|

- (in array context) value at position in array

in

- is there at least one in the following array

like

- is there at least part of text in the following array

not

- negative condition statement

1

- numeric value or a variable, number of a field

“one”

- string value of a custom variable (can contain any symbols as long as it’s in quotes)

(...)

- operations in parentheses will be processed before others

[Show]

- show a field

[Hide]

- hide a field

[Show if...]

- show a field if a condition is met

[Hide if...]

- hide a field if a condition is met

[Skip to...]

- skip to a destination if a condition

[Skip to… if]

- skip to a destination if a condition is met

[Mask by...]

- mask a question based on selected answers to an earlier question

[Rev-mask by...]

- mask a question based on non-selected answers to an earlier question

[Group...max...]

- create nodes, group them together, show them randomly to respondents and limit the number of nodes per respondent

[VarName...]

- a way to introduce a custom variable where VarName can be anything you choose using (A-Z, a-z, 0-9 and the underscore symbol "_")

[[Anything]]

- a way to show respondent any regular phrase in square brackets



EXAMPLES:


[PQ1]

- Reference to first prequalification question

[Q1]

- Reference to the first question

[Q1A1]

- Reference to the first answer of the first question

[Q1SQ1A1]

- Reference to the first answer of the first sub-question of the first question

[Q1E1SQ1A1]

- Reference to the first answer of the first sub-question (attribute) of the first entity of the first question. Relevant in Competitive Topography and Quadrant questions.

[Q1i]

- Reference to the image, attached to the first question

[Q1A1p]

- Position ("first", "second" ...) of the referenced item

[Q1A1pv]

- Position (1, 2 ...) of the referenced item

[Q1cv]

- Converted comment response to number of the referenced item

[Q1r]

- Reference to all responses, given by respondent to the first question

[Q1r1]

- Reference to the first response, given by respondent to the first question

[Q1rn]

- Number of response, chosen by respondent on the first question

[Q1r1c]

- Comment, entered by respondent on their first response on the first question

[Q1rc]

- All comments, entered by respondent on the first question

[Q1r1i]

- Image, associated with the first response, chosen by respondent on the first Q

[uuid]

- Reserved variable returning Unique User ID (if available)

[var1]

- Reserved variable returning first custom variable, passed through the survey link (if available)

[var2]

- Reserved variable returning second custom variable, passed through the survey link (if available)

[var3]

- Reserved variable returning third custom variable, passed through the survey link (if available)

[platform]

- Reserved variable returning type of respondent’s operating system (windows, mac, linux, ios, android, windows_mobile, windows_phone, other)

[device]

- Reserved variable returning type of respondent’s device (undefined, pc, mobile, tablet)

[browser]

- Reserved variable returning type of respondent’s browser (chrome, opera, firefox, ie, electron, safari, edge)

[gender]

- Reserved variable returning type of respondent’s gender (f, m)

[income]

- Reserved variable returning type of respondent’s HHI (0-25k, 25k-50k, 50k-75k, 75k-100k, 100k-200k, 200k-500k, 500k+)

[education_level]

- Reserved variable returning type of respondent’s highest education (professionaldegree, nocollege, somecollege, 2yrdegree, 4yrdegree, gradschooldegree)

[age]

- Reserved variable returning type of respondent’s current age (0-99)

[children]

- Reserved variable returning type of respondent’s parental status. Digit represents number of kids (n/a, 0, 1, 2, 3, 4, 5+)

[relationship_status]

- Reserved variable returning type of respondent’s relationship status (single, married, marriedwch, singlewch, widowed, significantother, engaged, divorced, complicated)

[ethnicity]

- Reserved variable returning type of respondent’s ethnicity (whiteamerican, africanamerican, nativeamerican, asianamerican, latinoamerican, multiracial, other, indianamerican)

[employment]

- Reserved variable returning type of respondent’s employment status (fulltime, parttime, retired, unemployed, student)

[career]

- Reserved variable returning type of respondent’s career (acc/fin/bank, adv/design, arts/ent, clerical, healthcare, hospitality, it, legal, management, military, publicsafety, realestate, retail, smbusiness, student, other)



Misc


If you want to use square brackets in your survey in a way that is visible to the respondents, please use double square brackets. If you type: [[optional]] in a field, respondent will see [optional].


AYTM Logic is case insensitive, so [Q1I] would behave the same way as [q1i].


It is possible to have two or more logic commands together, e.g. [show if Q2][hide if Q1A4][Q1i]. The system independently resolves the logic elements, and, if needed, combines them together with a logical AND operator. Let's see how it would work:

  • The system would fetch an image from the Q1.
  • If respondent saw Q2 and did not select Q1A4, this element will be shown.
  • If respondent didn't see Q2 and selected Q1A4, this element will not be shown.
  • If respondent saw Q2 and selected Q1A4, the system would resolve these operations to "show" (true) and "hide" (false). Combining those with an logical AND operator, we get "hide" (false), thus the element will be hidden


Brackets can be used to group the logic into logical chunks, connected with "and", "or", and other operators, e.g. [Q1i if (Q1A1 or Q2A1) and not (Q3A1 or Q4A1)] .