Note: Most question types can be used as table types. Before you continue, we suggest reviewing the Question types overview article first.
The following article provides an introductory look at common table types and the tags used to create them. We will cover both closed-end and open-end tables, and using inline options and standalone list options to create them.
Links to supplementary reading on each of these topics will be included, as will interactive examples for you to try out. We suggest bookmarking this page for reference as you learn how to use our survey programming language (SPL).
This article focuses on question-style table syntax used in "simple tables." More "advanced table" programming will be covered in additional documentation. For a comparison on how these two table styles differ, see Tables.
Anatomy of a table
Like questions, tables (sometimes referred to as a "matrix," "battery," or "grid") can be open-ended as in text or numeric input questions, or closed-ended where respondents may select a single response or multiple responses from a provided answer set. In the vast majority of the tables you will create, you will answer questions by row. The answer set a respondent selects from is called the list of options and the rows are the elements or items being asked about.
All tables will include the following properties:
- Table ID – An alphanumeric ID that is a unique identifier for each table, and can include underscores; spaces are not allowed. Each table ID will be followed by a period to separate it from the table (question) text. Whereas questions are referenced as QX, when referencing a table in the data or code examples, we use TX; for example, T1.
- Table text – The text displayed to the respondent for a given table. Table text can be multiline/multi-sentence, and even allows for HTML markups to indicate bolding, underlining, or italicizing of text.
-
Table type – A specification of the input type allowed for the table, using the
type
tag. Thetype
tag determines the functionality of the table, whether text input is allowed, whether its single selection or multiple selection, etc. -
Options – These are required for all closed-end tables. Options can be defined inline, as part of the table's code, or in standalone lists via the
setlist
widget. When options are defined inline, they can be listed with theoptions
tag, but it is not required. When options are defined in a setlist, theoptsfrom
listcall is used in the table code to specify which list, spreadsheet, or previous question the options should be pulled from.- All options will have both an option ID and option text. In the image below, the option '1. Attribute A' has an option ID of '1' and 'Attribute A' is the option text.
-
Rows - These are required for all tables except vertical scale tables (which instead use column elements). Rows, also called row-questions and row elements, can be defined inline, as part of the table's code, or in standalone lists via the
setlist
widget. When rows are defined inline, they must be listed with therows
tag. Similar to options, when rows are defined in a setlist, therowsfrom
listcall is used to specify which list, spreadsheet, or previous question the options should be pulled from.
Besides the type
tag, tables may include additional tags to further define the functionality or appearance. They may specify details such as instructions, acceptable answer ranges for open-ended questions, validations, "decline to answer" responses, text field sizes, and more.
Tip! Inline options are best used in situations where the options will only be used once. If a set of options/items will be used multiple times (whether it be for the rows or columns), a setlist should be used instead. In the case of large sets of options, spreadsheets may instead be used.
For additional information on best practices for when to use inline lists, setlists, or spreadsheets, read our Lists overview article.
Common table types
The following table types are most commonly used in IntelliSurvey's SPL.
Closed-ended table types |
|
---|---|
Type | Description |
radio table | A single-select table (a.k.a., single choice per row or per column) that is automatically submitted after each row-question (or column-question for a vertical scale table) is answered. |
pulldown table | A single-select table where the respondent chooses a response from a dropdown menu for each row-question. |
checkbox table | A multi-select table (a.k.a., multi-choice per row or per column) where a respondent can select one or more responses per row-question (or column-question). |
Open-ended table types | |
Type | Description |
text table | A table that provides a text field for respondents to input an alphanumeric response per row. |
textbox table | Similar to a type: text table , but provides a larger text field that can accept longer, "essay" responses. |
number table | A table that requires a numeric input and allows for decimal or integer (whole number) responses, and positive or negative numbers, including 0. |
integer table | A table that allows for positive or negative integer responses, including 0. |
Responses per row or per column?
Typically, tables use the rows as questions. In other words, the respondent selects an answer for each row, from top to bottom. When the table is a closed-end table, the row also needs an answer set to choose from (options). These will normally be the columns presented across the top of the table. As mentioned above, this table format will use the rows
or rowsfrom
tag and will place the options inline or call them in with the optsfrom
tag. This is the suggested table set up when possible.
There are instances, however, when the table's questions and answer set are "flipped" (inverted). Tables that use the columns as questions are known as vertical scale tables, a.k.a., "vscale tables" or "vscales" for short. Typically vscales are used when there is a large number of answer options (columns), and there is concern about how the table will be displayed – especially for mobile devices. Flipping the table vertically often makes the table easier to view, providing a better respondent experience.
With vscale tables, the respondent is asked to select an answer per column instead of per row. Therefore, the table must use the cols
tag for inline column elements (the questions) or the colsfrom
tag when using a setlist and listcall. The columns will also need an answer set to choose from (options), and the options can be inline without a tag or inline with the optsfrom
tag. To create a vscale table, add vscale: y
to the table's code.
Click here to skip to our vscale example at the end of this article.
Closed-ended table examples
Radio tables
Radio tables require respondents to select a single response per row. The row-questions, or row elements, can be as short as single words or as long as full statements. Reminder, the row-questions are made up of a list of elements/items, and the answer set is a list of options.
In the example below, T13 uses inline options and row elements. Inline options can be listed with or without an options
tag, but inline row elements must use the rows
tag to differentiate them from the option set. T13A instead uses setlists to define its options and row elements. The listcall tags optsfrom
and rowsfrom
then specify which lists to use for options and row elements, respectively.
Radio tables with scales and headings
Like their question counterparts, radio tables can be useful for setting up rating scales via the series
function. The headings
tag applies headings to the columns; when including multiple headers, use a comma-separated list as shown below.
For additional information on common table formatting tags, including headings, see Table formatting and headers.
Pulldown tables
Pulldown tables allow the respondent to select a single response per row from a dropdown menu. Often the prompt
tag is included to provide a visual cue to respondents to use the dropdown menu for selections.
Checkbox tables with exclusive option
Checkbox tables allow the respondent to select one or more responses per row-question. If need be, an exclusive option can be created via the exclusive: y
decorator to add a "None of these" option per row.
Though uncommon, an opt-out or "decline to answer (DTA)" option can be added to tables if none of the options apply. See declinetoanswer (dta) for additional information.
Open-ended table examples
Text tables
Text tables allow for the respondent to input any kind of text, including numbers, for each row in the table. Text tables are considered open-ended responses, and they do not require an option set to be provided. The table structure only needs a rows
or rowsfrom
tag to establish the row-questions.
These open-end responses, often called "unaided" questions, can be useful in gathering brand awareness, word associations, and much more. To restrict the size of the text field (what is displayed on screen) or response length (what is typed in), use the size
and maxlen
tags, respectively.
Textbox tables
Textbox tables function similarly to text tables, but the text field is presented as a larger box instead. If need be, the minlen
/maxlen
tags can be applied to set a minimum/maximum length for responses.
Numeric tables
Though a type: text table
can accept numeric responses, we recommend using type: number table
and type: integer table
to ensure the table only accepts specific types of numeric input. Just like questions, number tables accept positive and negative whole numbers, including '0', plus decimals (the equivalent of applying datatype: number
), whereas integer tables do not accept decimals. You can also specify the formatting for numerical responses with the number format
tag. For example, larger numbers can be automatically displayed with comma separators as seen in T18 in the demo below.
For more information on numeric tables, see Number and integer questions.
Total row tables
Frequently, clients will request that numeric input tables include a "Total" row that displays the sum of all the rows. The showcolumntotal
tag (alias sct
) allows you to create a summary row. The sct
tag also allows you to specify the text to show, e.g., "Total employees," and to add decorators to further modify the functionality of the feature. For example, the total
decorator (shown in T19A), specifies the total sum that must be met in order to proceed to the next question.
Additional table examples
Vscale tables (questions as columns)
Vertical scale tables (a.k.a., "vscales") are tables that use the columns as questions, with respondents selecting options for each column instead of for each row. To create a vscale table, add vscale: y
to the table, and use the columns
or colsfrom
tag to specify the questions. Note, the vscale
tag is only for use with single-select (radio) and multiselect (checkbox) tables.
In the below example, respondents are required to select the options they associate with each computer brand (the columns), or select the exclusive option '99' if none of the options match that brand.
Tables with columns and nested options
Multicolumn tables are composed of options, row-elements, and columns. When multicolumn tables use the same question type and options across each column, they can be created with the same question-style syntax shown in previous examples. Unlike previous examples though, both the rows
/rowsfrom
and cols
/colsfrom
tags are required to define the table. For more complex multicolumn tables with varying question types and/or options, or that require more advanced coding, the start table
widget must be used.
In the following example, the options repeat for each column in a radio table. The respondent still answers per row. Notice that T21 and T21A render the same on screen, but one uses inline lists, and the other uses setlists and listcalls.
Comments
0 comments
Please sign in to leave a comment.