A variety of widgets can reference lists by including tags known as listcalls. Listcalls tell the system to locate a specified list and use its elements in a question, table, or variable.
setlist: BRANDS
1. Brand 1
2. Brand 2
3. Brand 3
4. Brand 4
1. Which brands have you purchased in the past year?
type: checkbox
optsfrom: BRANDS
Details
- Listcall tags can reference either standalone lists (setlists) defined via the
setlist
widget or inline lists defined as part of another question, table, or variable. - For r9+, setlists are not required to appear before the widgets that reference them and can be placed anywhere in the survey.
- Listcalls can also reference information from both local survey spreadsheets and system sheets.
- Heredoc may be used with listcalls when multiple lines of logic are required.
- Listcall tags allow for inclusion and exclusion syntax so that a subset of options from a list or spreadsheet can be displayed.
- Element decorators and option data decorators may also be included as part of a listcall as shown below.
Listcall tags
The following tags are commonly used as listcalls.
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
The rowsfrom
tag allows you to use a list as table rows instead of defining the rows locally in a table.
setlist: 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
Most simple tables only require a single column. But when additional columns are needed, use the colsfrom
tag to reference a setlist.
In the example below, a multicolumn table is required to allow respondents to input how much they spent each month in a 3 month span.
setlist: MONTHS
1. August
2. September
3. October
setlist: 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 listcalls optsfrom
and colsfrom
would be typically used.
To create a vscale table, include the vscale: y
tag.
setlist: QUALITIES
1. Overall ambiance
2. Quality of service
3. Quality of meals
4. Speed of service
5. Pricing
6. Drink selection
setlist: 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 listcall 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.
setlist: 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.