Headers are non-user-selectable list items which can optionally display to respondents when the list is used in a question or table. Headers also break sets of list options into collections, and so allow for syntax which lets Survey Programmers (SPs) control overall collection ordering, as well as the sub-ordering of options within a collection. The primary use cases for headers are long lists with verticals/categories which the survey-taker will recognize.
Syntax
Define
To create a collection header, create a list item preceded by an underscore and letter instead of a number. In the example below, the options will be broken into two collections, one under List Header 1 and the other under List Header 2.
setlist: LIST_NAME_HERE _A. List Header 1 1. Option 2. Option #. etc _B. List Header 2 3. Option 4. Option #. etc
Reference
Hide headers
In the event that a header's option collection is empty after square bracket and condition filters are applied, they automatically hide. Headers also are ignored when used as the data source for a block. To manually control the display of headers, use [header: n]
in a listcall.
*from: LIST_WITH_HEADERS [header: n] {if condition}
Show headers in columns
If a list with headers is used as columns, they do not display by default. To override, use columngroupheader
. This is a tag that defaults to 'n'.
... colsfrom: LIST_WITH_HEADERS columngroupheader: y ...
Include or exclude a header and its child elements
To include/exclude a given header and the options within its collection, reference the header ID at a listcall.
# Include *from: LIST_WITH_HEADERS [Header ID] # Exclude *from: LIST_WITH_HEADERS -[Header ID]
Ordering
Adding multiple headers to a list groups the options under each header into collections. These collections have special ordering properties. For more information, see Collections and order theory.
Examples
Basic
The following example uses two inline collections, the Header collection for options 1 and 2, and the Header 2 collection for options 3 and 4. The options are displayed under their respective headers.
Condition
Frequently follow up questions will reuse a set of options from a previous question, but with the intent of only displaying previously selected answers. In the example below, the anyChecked
condition in Q3's listcall dictates that only answers selected in Q2 should be shown. Since the COLORS list uses two collections, the headers from these questions are also displayed in Q3. Note that if the respondent were to only make selections from one of the collections (e.g., only likes blue colors), then only the "Blues" header would be shown in Q3.
Remove collection
Exclusion syntax can be applied to lists that use collection headers as well. In Q4's listcall, the '-[B]' syntax lets the system know to exclude all options from the B collection, Metal.
Hiding headers - questions
To suppress the displaying of lists' collection headers, add the [header: n]
decorator after the listcall. This decorator can be used in questions or in tables.
Hiding headers - tables
The following pair of examples demonstrates how lists using collection headers are displayed in tables, with and without their headers. Note that when applied to a list of row elements, the table is sectioned by the headers. T6's rows are grouped into two sections as a result, whereas T6A's rows are all lumped together.
Column headers via colsfrom
By default, collection headers in a list used in colsfrom
will not be shown. The options themselves are used as headers.
Including colsfrom headers
Using the columngroupheader
tag will render an additional row of headers from the colsfrom
list's collection headers. These are rendered above the colsfrom
list's options.
Comments
0 comments
Please sign in to leave a comment.