Action Logic: What is "set variable"?
Variables work the same as Tags except Tags are a single value while Variables have a key and a value. For example:
Variable in Logic Editor
- If… respondent selected “I prefer Pepsi” at Q1, Then… we want to set a variable with a key called “Brand” and with the value:“Pepsi Drinks”, and
- If… respondent selected “I prefer Coke” at Q1, Then… we want to set variable also with the same key “Brand” but with the value:“Coke Drinks”.
Variable in Question Editor
You can then pipe this variable value into questions, descriptions, choices, etc. using the inject format: {{ variable:key }} and using the “Brand” key as seen below:
Variable in Question Preview
The respondent below must have selected "I prefer Pepsi" at Q1 because they are seeing the variable value: "Pepsi Drinks" in the question preview below at Q2. However, if they had selected "I prefer Coke" instead at Q1, they would have seen "Coke Drinks" below at Q2.