In this article
1: Question Attributes
All question elements have access to the following attributes:
| Attribute | Purpose | Description |
|---|---|---|
adim |
The primary report dimension (rows, cols, choices or auto). |
The adim attribute controls the primary dimension displayed in the report. Usually, if a report is two-dimensional, then one table is created for each item in the shortest dimension showing all items in the second dimension. The adim attribute enables you to override this primary dimension.
<radio label="Q1" adim="rows"> Type: enum Default: auto |
aggregate |
Bases the question on data from other questions | The aggregate attribute is for virtual questions. It allows you to perform calculations on the data derived from other questions.
<radio label="Q1_Q2_Q3_Aggregated">
<row label="r1">I like it</row>
<row label="r2">I'm neutral about it</row>
<row label="r3">I hate it</row>
<aggregate>
this.r1 = Q1.r1 + Q2.r1 + Q3.r1
this.r2 = Q1.r2 + Q2.r2 + Q3.r2
this.r3 = Q1.r3 + Q2.r3 + Q3.r3
this.shown = Q1.shown + Q2.shown + Q3.shown
this.answered = Q1.answered + Q2.answered + Q3.answered
</aggregate>
</radio>
Type: string Learn more: Data Aggregation |
alt |
Alternative <title> text displayed in the report |
The alt attribute allows you to specify an alternative short text for the element. If the element contains a <title> attribute, the alt attribute will override this text in the report and data downloads.
Type: string |
altlabel |
Alternative label to be used everywhere except within the survey XML | The altlabel attribute is an alternative label that is displayed in all other areas except within the survey. This can be used for re-coding or relabeling data. |
averages |
Shows the average (mean) calculation for (none, rows, cols, choices or nosummary, summary) |
The <radio label="Q1" averages="rows,nosummary"> Type: set Default: none |
below |
Defines the label of the question below which the curren question is to be placed. | The below attribute allows you to group questions together vertically. The number of columns must be the same to use the below attribute.
<text label="Q1" title="Please specify a few of your favorite car brands.">
<row label="r1">Car brands</row>
<col label="c1">Brand #1</col>
<col label="c2">Brand #2</col>
<col label="c3">Brand #3</col>
</text>
<checkbox label="Q1_Ownership" title="Favorite car brand ownership" below="Q1" optional="1">
<row label="r1">Do you own a car of this make?</row>
<col label="c1"></col>
<col label="c2"></col>
<col label="c3"></col>
</checkbox>
Type: string |
blankIfZero |
Outputs blank data if the value is zero | The blankIfZero attribute is only applicable to <checkbox> elements and will change 0 data to blanks.
<checkbox label="Q1" atleast="1" blankIfZero="1"> Type: bool Default: zero |
blankValue |
Sets the value for blank responses in the data file | The blankValue attribute allows you to set the value for blank data. If blankValue="No Data" is set, then the data will show the string "No Data" for blank values. This can be applied globally from within the <survey> element, or for each question type.
<checkbox label="Q1" atleast="1" blankValue="No Data"> Type: string Default: zero |
choiceCond |
Shows each choice if this condition is true | The choiceCond attribute allows you to specify condition logic that will show or hide each <choice> element.
<select label="Q2" title="Which pizza is your favorite?" choiceCond="Q1.rows[choice.index]">
<choice label="ch1">Cheese</choice>
<choice label="ch2">Pepperoni</choice>
<choice label="ch3">Meat-Lovers</choice>
<choice label="ch4">Combination</choice>
<choice label="ch5">Sausage</choice>
</select>
Type: string |
choiceGroups |
To specify where to show the choice groups (report, survey, restrict) |
The choiceGroups attribute allows you to specify where the <group> element associated with each choice will appear. By default, the groups will appear in the survey and report. If choiceGroups="restrict" is set, then the groups will only appear when creating a custom report.
Type: set Default: |
choiceShuffle |
Allows you to specify the permutations of the <choice> randomization (flip, rflip, rotate, rrotate) |
The choiceShuffle attribute allows you to specify the randomization order of <choice> elements. For example, if there are three choices in total, specifying choiceShuffle="ch1,ch2,ch3;ch3,ch2,ch1" will show in ascending order for the first participant and in descending order for the second.
Note: The order used depends on the participant's record number. The randomization order will not be balanced for qualified completes. In addition to specifying the order using the choice labels, you may also use the keywords
Type: string |
colCond |
Shows each column if this condition is true | The colCond attribute allows you to specify condition logic that will show or hide each <col> element.
<radio label="Q2" title="Which pizza is your favorite?" colCond="Q1[col]">
<col label="c1">Cheese</col>
<col label="c2">Pepperoni</col>
<col label="c3">Meat-Lovers</col>
<col label="c4">Combination</col>
<col label="c5">Sausage</col>
</radio>
Type: string |
colGroups |
Allows you to specify where the col groups should show up (report, survey, restrict) |
The colGroups attribute allows you to specify where the <group> element associated with each column appears. By default, the groups appear in the survey and report. If colGroups="restrict" is set, then the groups will only appear when creating a custom report.
Type: set Default: |
colLegend |
Placement of the legend for columns (none, both, top, bottom, group and beforeGroup) |
The Type:enum |
colLegendRows |
Additional rows to have column legend |
The Type: list |
colShuffle |
Allows you to specify the permutations of the <col> randomization (flip, rflip, rotate and rrotate). |
The Note: The order used depends on the participant's record number. The randomization order will not be balanced for qualified completes. In addition to specifying the order using the
Type: string |
cond |
Displays the question if this condition is "True". |
The <radio label="Q1" cond="list == '1'"> Type: string |
comment |
Additional information displayed in the participant view beneath the title. |
The <comment>Please select one.</comment> Type: string |
dataSource |
Label of the <dataSource> element to get data from |
The Learn more: Datasource Tag: Pull Data From a Tab-Delimited File Type: string |
dataRef |
Allows you to specify Which <dataSource> column to get data from. |
The Learn more: Datasource Tag: Pull Data From a Tab-Delimited File Type: string |
exec |
Executes the Python code before displaying the question. |
The Type: string |
groupDepth |
When rows are grouped, displays nested group titles to participants |
The Learn More: Group Tag: Group Response Options Type: int |
grouping |
Grouping of the question's components (auto, rows, columns). |
The Type: enum Default: auto |
horizontalPercentages |
Calculates percentages across. |
The Type: bool Deafult: zero |
id |
Uniquely identifies each element |
The Type: string |
keepWith |
Displays these other questions on the same page even after an error. |
The attribute <checkbox label="Q1" atleast="1" title="Do you?">
<row label="r1">Yes</row>
<row label="r2">No</row>
</checkbox>
<checkbox label="Q2" atleast="1" title="Do you, really?" keepWith="Q1">
<row label="r1">Yes</row>
<row label="r2">No</row>
</checkbox>
Type: string |
label |
Symbolic name for the question. | The label attribute is the symbolic name for the element. The system uses the label as the target when performing various Python-related functions. A label must be a valid Python identifier.
Type: string |
noTranslate |
Disables translations for the values specified. | The noTranslate attribute allows you to disable translations for specific values. This can be helpful when you only need to translate certain parts of a virtual or hidden question (e.g., when piping only row content to the survey from a virtual question).
Type: set Default: title, comment |
open |
Placement of the open-ended input field (default, left, right). |
The Type: enum |
optional |
Allows the user to skip this question. |
The Type: bool Default: zero |
pii |
Allows you to specify an integer between 0 and 9999, inclusive, to set the personally identifiable information protection level. |
The Type: integer Default: zero |
ratingDirection |
To specify which end of the rating scale is the high end (default, reverse). |
The <radio label="Q1" type="rating" values="order" ratingDirection="reverse"> <title>Please rate this question.</title> <row label="r5">5</row> <row label="r2">4</row> <row label="r3">3</row> <row label="r2">2</row> <row label="r1">1</row> </radio> Type: enum |
rightOf |
The label of the question to place this question to the right of. | The attribute rightOf allows you to group questions together horizontally. The number of rows must be the same to use the rightOf attribute.
<text label="Q1" title="Please specify a few of your favorite car brands.">
<row label="r1">Car brands</row>
<col label="c1">Brand #1</col>
<col label="c2">Brand #2</col>
<col label="c3">Brand #3</col>
</text>
<checkbox label="Q1_Ownership" title="Car brand ownership" rightOf="Q1" optional="1">
<row label="r1">Do you own any of these types of cars?</row>
</checkbox>
Type: string |
rowCond |
Show each row if this condition is "True". | The rowCond attribute allows you to specify condition logic that will show or hide each <row> element.
<radio label="Q2" title="Which pizza is your favorite?" rowCond="Q1[row]">
<row label="r1">Cheese</row>
<row label="r2">Pepperoni</row>
<row label="r3">Meat-Lovers</row>
<row label="r4">Combination</row>
<row label="r5">Sausage</row>
</radio>
Type: string |
rowGroups |
Allows specifying where the row groups should show up (report, survey, restrict) |
The Type: set Default: |
rowLegend |
Placement of the legend for rows (default, both, right, left) |
The <radio label="Q1" rowLegend="both">
<title>
Test
</title>
<comment>Please select one</comment>
<row label="r1" rightLegend="4">1</row>
<row label="r2" rightLegend="5">2</row>
<row label="r3" rightLegend="6">3</row>
</radio>
Type: enum |
rowShuffle |
Allows you to specify the permutations of the <row> randomization (flip, rflip, rotate , rrotate) |
The Note: The order used depends on the participant's record number. The randomization order will not be balanced for qualified completes. In addition to specifying the order using the row labels, you may also use the keywords
Type: enum |
showSource |
Display the source code of the question for logged-in users |
The Type: bool Default: 0 |
shuffle |
Elements to randomize (none, row, cols, choices) |
The Type: set Default: none |
shuffleBy |
The label of the question to randomize the elements by | The shuffleBy attribute allows you to specify another question's label to randomize the current question's elements by. The shuffleBy attribute uses the element's index value to match the randomization order, so the number and meaning of the elements should be the same.
<radio label="Q1" shuffle="rows" title="First question.">
<row label="r1">Item 1</row>
<row label="r2">Item 2</row>
<row label="r3">Item 3</row>
</radio>
<radio label="Q2" shuffle="rows" shuffleBy="Q1" title="Second question.">
<row label="r1">Similar Item 1</row>
<row label="r2">Similar Item 2</row>
<row label="r3">Similar Item 3</row>
</radio>
Type: string |
sort |
Sort the results in the report (none, row, cols, choices, desc, asc, percentages) |
The sort attribute allows you to specify the sort order of the results in the report. If sort="rows,percentages,desc" is specified, the order of the results will be sorted based on the row's percentage values instead of the count values and in descending order. If sort="choices,asc" is specified, the question's choices will be sorted based on the count values in ascending order.
Type: set Default: none |
sortChoices |
Sort choices alphabetically (none, asc, desc, survey, report) |
The <select label="Q1" sortChoices="desc,survey">
<choice label="ch1">c</choice>
<choice label="ch2">b</choice>
<choice label="ch3">a</choice>
<choice label="ch4">d</choice>
</select>
Type: set Default: none |
sortCols |
Sort columns alphabetically (none, asc, desc, survey, report) |
The <checkbox label="Q1" sortCols="asc,report">
<col label="c1">c</col>
<col label="c2">b</col>
<col label="c3">a</col>
<col label="c4">d</col>
</checkbox>
Type: set Default: none |
sortRows |
Sort rows alphabetically (none, asc, desc, survey, report) |
The <radio label="Q1" sortRows="asc,survey">
<row label="r1">c</row>
<row label="r2">b</row>
<row label="r3">a</row>
<row label="r4">d</row>
</radio>
Type: set Default: none |
sst |
Determines whether simulated data should try to understand and/or populate the element |
The Type: bool Default: 1 |
title
|
The displayed title of the question (required). |
The <radio label="Q1" title="Please choose your favorite color:">
<row label="r1">Red</row>
<row label="r2">Green</row>
<row label="r3">Blue</row>
<row label="r4" open="1">Other:</row>
</radio>
<suspend/>
<text label="Q2">
<title>Why is [pipe: Q1] your favorite color?</title>
</text>
Type: string |
translateable |
Excludes text from translation file |
The Type: bool Default: 1 |
type |
The type of question (none, rating). |
The Type: enum Default: none |
uses |
The dynamic question (DQ) style to use. |
The <radio label="Q1" title="Please select a bucket for each item below." uses="cardsort.3">
<row label="r1">Item 1</row>
<row label="r2">Item 2</row>
<row label="r3">Item 3</row>
<col label="c1">Bucket 1</col>
<col label="c2">Bucket 2</col>
<col label="c3">Bucket 3</col>
</radio>
Type: string |
values |
Sets the values for the question (none, order). |
The <checkbox label="Q1" title="Please select all that apply." values="order"> This attribute also accepts the reverse option, which excludes explicit value answers first. This means you can have an input like: Type: string Default: none |
virtual |
Python code to compute the data values. |
The Note: Set <text label="vQ1">
<virtual>
this.r1.val = "$" + Q1.r1.val
this.r2.val = S5.r1.val + ", " + Q1.r2.val
</virtual>
<row label="r1">Income</row>
<row label="r2">City, State</row>
</text>
Type: string |
where |
Specify where the variable should be available (survey, report, summary, none, notdp). |
The where attribute controls where a variable should be available. It can be set to any of the following:
By default, most elements are set to For example: <text label="Q1" optional="0">
<title>
(Default) Shown in survey and report.
</title>
</text>
<text label="Q2" optional="0" where="execute">
<exec>
# do something here
</exec>
<title>
Shown as hidden question in survey.
</title>
</text>
<text label="Q3" optional="0" where="none">
<title>
Not shown at all.
</title>
</text>
<text label="Q4" optional="0" where="report">
<title>
Only shown in report.
</title>
</text>
<text label="Q5" optional="0" where="notdp">
<title>
Shown in survey and report, but not in data downloads.
</title>
</text>
The code above produces the following result: Note: Click image to enlarge. Learn more: Control where an Element Appears with the Where Attribute Type: set Default: |
tv
|
Change trackVars settings at the question level for surveys with trackVars="checkbox" specified (auto, off, force, record) |
The By default, When When If you want to use trackVars on a question with Learn more: Setting an Answer Option Base to Total Shown Type: enum Default: auto |