A variety of widgets can reference lists by including tags known as list calls. List calls tell the system to locate a specified list and use its elements in a question, table, or variable.
set list: BRANDS
1. Acer
2. Asus
3. Apple
4. Dell
5. HP
6. Lenovo
1. Which brands of computers have you ever purchased?
type: checkbox
optsfrom: BRANDS
Details
- List call tags can reference either standalone lists (set lists) defined via the
set list
widget or inline lists defined as part of another question, table, or variable. - Set lists are not required to appear before the widgets that reference them and can be placed anywhere in the survey.
- List calls can also reference information from both local survey sheets and system sheets.
- Heredoc may be used with list calls when multiple lines of logic are required.
- List call tags allow for inclusion and exclusion syntax so that a subset of options from a list or sheet can be displayed.
- Element decorators and option data decorators may also be included as part of a list call as shown below.
List call tags
The following tags are commonly used as list calls to carry forward answer choices.
For | Tag |
Question and table options | optsfrom |
Table rows | rowsfrom |
Table columns | colsfrom |
Ranking items/options | optsfrom or itemsfrom |
Card sort cards | cardsfrom |
Blocks | list |
Loops | loopfor |
Additional examples
Creating table rows from a list
Most simple tables only require rows and answer options. The rowsfrom
tag allows you to use a list as table rows instead of defining the rows locally in a table.
set list: STREAMING_OPTS
1. Netflix
2. Disney+
3. Hulu
4. Sling TV
5. Apple TV
6. YouTube TV
2. What are your experiences with the following streaming services?
type: radio table
1. Love it!
2. It's alright
3. Not a fan
4. Not familiar
rowsfrom: STREAMING_OPTS
Creating table columns from a list
When additional columns are needed in your table, use the colsfrom
tag to reference a set list.
In the example below, a multicolumn table lets respondents enter their monthly spending for the EXPENSES list across a three month span.
set list: MONTHS
1. August
2. September
3. October
set list: EXPENSES
1. Rent / Mortgage
2. Utilities
3. Groceries
4. Insurance
3. What was your monthly spend for each of these items for the following months?
type: integer table
datatype: whole
prefix: $
rowsfrom: EXPENSES
colsfrom: MONTHS
Vertical scale tables (a.k.a., "vscale tables") are radio or checkbox tables that allow respondents to select options for each column instead of each row. For these tables, the list calls optsfrom
and colsfrom
would be typically used.
set list: QUALITIES
1. Overall ambiance
2. Quality of service
3. Quality of meals
4. Speed of service
5. Pricing
6. Drink selection
set list: RESTAURANTS
1. Ed Boudreaux's
2. Reza's
3. Rosetta's Kitchen
7. What is the primary reason you tend to visit each of the following restaurants?
type: radio table
vscale: y
optsfrom: QUALITIES
colsfrom: RESTAURANTS
Reusing inline options
Derived lists are lists that are pulled in (or derived from) a previous question, table, or ranking exercise. When using a previous question or table's options, reference them as 'QX.options' or 'TX.options', where 'X' is the question ID. Table rows would be referenced as 'TX.rows' and column elements would be 'TX.columns'.
5. Which of the following stores have you visited in the last six months?
type: checkbox
randomize: y
1. Target
2. Walmart
3. Home Depot
4. Lowe's
5. Best Buy
6. Bed, Bath, Beyond
5A. Which of the following stores do you enjoy visiting?
type: checkbox
optsfrom: Q5.options
5B. How long would it take to drive to these stores from your home?
type: radio table
1. Less than 15 min
2. 15 to 30 min
3. 30 to 35 min
4. More than 45 min
rowsfrom: Q5.options
Programmers should note that derived lists pipe in all options/elements from the referenced question. If only selected options should be piped in, you can instead use question label shorthand or an anyChecked
function as shown in the next example.
Adding a conditional statement
In the following example, a condition
decorator using the anyChecked
function is applied on the list call in Q11, specifying to display any options from the MEALS list that were selected in Q10. This maintains data integrity as respondents cannot then contradict earlier answers.
set list: MEALS
1. Breakfast
2. Brunch
3. Lunch
4. Dinner
5. Snack time
10. On an average day, when do you eat fruit or vegetables?
type: checkbox
optsfrom: MEALS
11. Which of these times do you eat fruits or vegetables most frequently?
type: radio
optsfrom: MEALS {if anyChecked($Q10,[id])}
Comments
0 comments
Please sign in to leave a comment.