For more complex or advanced table scenarios, such as multicolumn tables with varying question types or tables that require advanced functions, use the start table
widget.
To create a an advanced table, you need to:
- Begin with the
start table
widget. The input is the table ID. - Apply the
intro
tag to provide the question text. - Apply the
type
tag with the desired input. - Add rows and/or columns.
- Provide a list of answer options (for closed-ended tables only).
- Add the
end table
tag after all other tags.
Tip! Although start table
can be used for any table design, question-style syntax is recommended in simpler tables.
Details
- Answer options, rows, and columns can be created with inline lists (within the table's code like T1 above) or pulled in from set lists (standalone lists), derived lists (from another question), or sheets.
- The
options
tag is optional when including inline options. - When using an external list, a listcall tag such as
optsfrom
,rowsfrom
, orcolsfrom
is required to reference the list. - The
rows
,columns
,rowsfrom
, andcolsfrom
tags support heredoc formatting if desired. -
Vertical scale ("vscale") tables can be created with
start table
if need be. - Include a double hyphen '--' to define individual columns in a multicolumn table.
Tags
Common table tags
In addition to the type
tag, the following tags are frequently used with start table
.
Tag | Description |
col id separator |
Specifies character(s) to insert between the table ID and the column ID. If not specified, defaults to 'C'. |
|
Specifies the column options in a table.
|
decline to answer |
Creates an opt-out ("decline to answer") option for the entire table. |
dta col and dta row |
Creates an opt-out column or opt-out row, respectively. |
|
Specifies instructions to guide the respondent. |
|
Specifies the question text. |
|
Specifies the answer options in a closed-ended table. If listing options inline, the |
row id separator |
Specifies character(s) to insert between the table ID and the row ID. If not specified, defaults to 'R'. |
|
Specifies the row options in a table where the rows are the questions. |
Creates a running total of all answers in a given column. | |
use table id |
Accepts 'y' (default) or 'n'. Controls whether rows (or columns in vscale tables) are named based on the table ID. For example, in table T10 with five rows:
|
vscale: y |
Allows respondents to select options for each column instead of each row. vscale: y is only for use with radio and checkbox tables. |
Tip! For a list of table formatting and header tags, see Table formatting and display options and Table headers.
Advanced table tags
Whereas the table above shows tags that actually can be applied to both simple and advanced tables, the following tags can only be used with the start table
widget.
Tag | Description |
-- |
Separates table columns so that each column of questions can be defined differently. This is especially useful for columns that vary in response type (radio, checkbox, text, etc.). |
col id |
Assigns an alphanumeric ID to the table column. If the tag is not included, the columns will default to being assigned numeric values in sequential order (1, 2, etc.). |
Defines validation conditions for the columns within a table. The column validation tag accepts a condition as input, followed by the message decorator and message text in curly brackets — e.g., column validation: countChecked($Q11C[id]) <= 2 { message: Select no more than 2 attributes for [text]. } . |
|
enable when |
Enables or disables a question or table column when a specified condition is true. |
row validation |
Defines validation conditions for the rows within a table. The row validation tag accepts a condition as input, followed by the message decorator and message text in curly brackets — e.g., row validation: countChecked($Q10R[id]) <= 2 { message: Select no more than 2 attributes for [text].} . |
Defines validation conditions for a question or table. The validation tag accepts a condition as input, followed by the message tag and message text in curly brackets — e.g., validation: anyChecked([value],1,2) {message: Select option 1 or 2 } . |
Multicolumn tables
To build a multicolumn table (a.k.a., "multitype" or "mixed type" table), some tags must be placed at the table's root, and other tags must be placed on the columns or rows.
- At a minimum, a multicolumn table requires that the rows are defined at the root.
- Tags and other descriptors for the whole table must be included at the root.
- Options and types can be defined at the root or the column level.
- It is also possible to set a global type at the table's root, and then redefine or override the type at a column or row as shown in the intro example.
Defining the table type on each column
set list: BRANDS
1. Brand A
2. Brand B
3. Brand C
set list: YES_NO
1. Yes
2. No
set list: QUALITIES
1. Good value
2. Dependable
3. Good quality
99. None of these {exclusive: y}
start table: 2
intro: What are your thoughts on the following brands?
rowsfrom: BRANDS
--
heading: Would recommend?
optsfrom: YES_NO
type: radio
--
heading: Qualities associated with brand
optsfrom: QUALITIES
type: checkbox
end table
Additional examples
Contact information table with varying input types
When contact information is required for a survey, you can create single column tables where each row requires a different input type. Each row-question is defined by including a line space between rows and specifying the question-type and options per row.
Tip! You can create most contact forms with a simple text table. See an example here.
Table with opt-out column
The following example asks respondents to provide a text description of a list of products. In case the respondent is unfamiliar with a product, a second column is created for them to opt-out for that product.
The enable when
tag uses RID syntax so that, if the 'Unfamiliar' option is selected, the text field in Column 1 will be disabled for that product. To re-enable the text field for a row, simply uncheck the cell in the opt-out column.
Note that if need be, you can also create simpler opt-out columns or opt-out rows in text tables via the dta col
and dta row
tags, respectively.
Enabling columns based on previous responses
The show if
tag can be applied to column definitions to determine whether a column should be displayed. In T5, Column 1 and Column 3 are displayed based on the responses to Q4A and Q4B.
Comments
0 comments
Please sign in to leave a comment.