Questions Section
Table of contents
- Introduction
- Question name
- Dimension
- Question text
- Response type
- Options
- Question Attributes
- Parameters
- Additional features
Introduction
A questionnaire is made up of a number of questions.
A question is made up of several elements which are defined in the QUESTIONS section of the dsc script file.
Q1 [dimension] "Question text?" : response_type attribute_keyword(s) : parameter(s) @[question_attribute=value,...]
Question Name
Each question must have a unique name. The name must start with a letter and can only contain letters (without accents), numeric characters and the underline character "_". The CAWI language is case sensitive so that, for example, question Q10 is different to question q10. Example names :
q1
Q13b
QuestProfession
Department_01
Dimension
Multidimensional (or array) questions make it possible to display multiple questions in a single table. The most frequent use is to cross a list of elements (or items) with a list of responses (or values) : the responses can be single ("single choice") or multiple ("multiple choice").
Such questions are usually presented in the form of a grid (or table) : the items appear vertically down the side of the table and the possible response values are displayed across the top of the table. The items can also be crossed with text fields, integer(whole) numbers, decimal numbers, etc according to the type of question.
For multidimensional questions the dimensions are placed in brackets [ ] or { }. A dimension can be a single number or a list of elements between double quotes ("), separated by commas.
Example 1:
Q1[3] "Name 3 brands that you know" : TEXT
Example 2:
Q1 {
1 "Brand 1",
2 "Brand 2",
3 "Brand 3"
} "Do you know the following brands?" : {
Y (1) "Yes",
N (2) "No"
}
Yes | No | |
Brand 1 | ||
Brand 2 | ||
Brand 3 |
Respondent to select Yes or No for each brand.
Example 3:
Q1 {
1 "Statement 1",
2 "Statement 2",
3 "Statement 3",
4 "Statement 4",
5 "Statement 5"
}{
1 "Brand 1",
2 "Brand 2",
3 "Brand 3"
} "For each statement, give a mark from 1 to 10 to indicate how far it applies to the brands shown." : 1..10
Brand 1 | Brand 2 | Brand 3 | |
Statement 1 | |||
Statement 2 | |||
Statement 3 | |||
Statement 4 | |||
Statement 5 |
Respondent to enter 1 to 10 in each cell of the table.
Notes
In the 2 examples above { } have to be used to bracket the lists of array elements. This is because numeric values have been used as the names of the array elements and the current version of SCROLL would not accept the syntax if [ ] were used.
When creating questions where the dimension is defined as a list it is good practice to use the DEFINITIONS section to define the list and then use the list name when defining the questions. So Example 2 above would be defined as below:
DEFINITIONS
lst_brands = {
1 "Brand 1",
2 "Brand 2",
3 "Brand 3"
}
QUESTIONS
Q1 { lst_brands } "Do you know the following brands?" : {
Y (1) "Yes",
N (2) "No"
}
This method is better for using list operations involving different questions based on the same list.
Question text
The question text is a character string between double quotes.
Examples :
How old are you ?
Have you seen the film \”Breakfast at Tiffanys\” ?
How often have you been to your GP this year?
The display of the text may be changed using the mark up conventions described below. As certain characters are used for these mark ups (principally " and @ and $), they must be preceded by the backslash character ("\") to be keep their genuine representation as in the second example above.
The response from a previous question can be substituted in the question or label text or a message by using @ANS:question_name$ as in the example below:
Q2 "How many copies of @ANS:Q1$ did you buy?" : 1..10
Response Type
Define the types of response that can be given to the question.
List of choices
May be:
- single : one choice from a list
- multiple : multiple choice - more than one response can be given
Example of a list of choices question where up to 3 responses can be selected:
A1 "Question text" : {
1 "choice 1",
2 "choice 2",
3 "choice 3"
}{3}
Without the {3} then only a single response may be selected. Note that the maximum number of choices allowed can be reduced dynamically in the ROUTE section using the SETQMAXSEL function.
Use square brackets, e.g. [3], to preserve the order in which choices are selected. For example when the choices have to be ranked.
See Components of a choice definition for a description of the 3 components that can be defined for a choice.
See Choice attributes for a description how extra attributes (e.g. exclusive choice) can be used for a choice element.
TEXT: enter a single row of text
Q5 "What is your forename?" : TEXT [20] : 'size=30'
OPENTEXT : for longer text responses - more than one row.
Q6 "What do you think of Liverpool ?" : OPENTEXT [6000] : 'cols=40, rows=8'
INTEGER: Whole number
Q1 "How many bananas?" : INTEGER
Q2 "On how many days per week do you usually eat fruit?" : INTEGER [1,7]
See INTEGER for a full description of rules for defining integer ranges.
The example below shows an older way of specifying whole number ranges that is still accepted.
Q2 "On how many days per week do you usually eat fruit?" : 1..7
DECIMAL: Numbers that can contain decimal points
Q1 "What is the value of pi?" : DECIMAL
Q2 "What is your weight in kilograms to 2 decimal places?": DECIMAL (5,2)
See DECIMAL for a full description of rules for describing decimal numbers.
The example below shows an older way of specifying decimal number ranges that is still accepted.
Q3 "How much did it cost?" : 10.0:300.0
DATE
Qdate "On what date were you born?" : DATE
Question options
Questions options are used define some characteristics of a question, such as whether it must be answered for the respondent to continue or the maximum number of answers. Several options can be used for the same question in which case they are separated by spaces.
Examples :
REQUIRED // response must be given for respondent to continue
{2} // 2 responses possible
Question Attributes
Question attributes can be used to define text associated with the question. For example to add a question note or alter the message displayed when a respondent does not answer a required question.
Examples
@[qnotes="Code all the apply",qrequired="Please answer this question"]
@[txtl="I am@NS$",txtr="@NS$years old"]
The following attributes are predefined in the CAWI language which provides options to control how these attributes are used:
- qnotes="Some text to be displayed under the question text": Text displayed under the question text. Commonly used to give instructions to the respondent. See example above.
- qendnotes="Some text to be displayed after the question": Text displayed after the question body.
- qrequired="Answer required.": Alter the message displayed when a respondent does not answer a required question. See example above.
- txtl="I have@NS$": Adds text to the left of the response box. See example above.
- txtr="@NS$patients": Adds text to the right of the response box. See example above.
Note: @NS$ in the above examples inserts a space to improve the display.
Parameters
Parameters can be added to specify how the question is to be displayed. Parameters are set using pairs of the form parameter_name=value, with each pair separated by commas. The list of pairs is then enclosed in double quotes.
Examples :
'dropdown=yes' // display the possible responses in a drop down list
'maxlength=2,size=3' // text or number box of size 3, in which a maximum of 2 characters can be entered.
'size=30' // set the size of a text field
'jscript=totq1(this)' // call the "totq1" javascript function defined in file cawi.js, to calculate the sum of some values
Parameters are specified following a ":" after the question definition. Example:
Month "Which month:" : {Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec} : 'dropdown=yes'
To see list of parameters select List of dsc parameters from menu or click here
Additional features
Mark up features to change the way text displayed
The mark ups below can be used to alter the display of the question and label text.
- New line: "@|" e.g. "First line@|Second line"
- Underline: @U$text to be underlined@$
- Bold: @B$text in bold@$
- Italic: @I$text in italics@$
- Quotation marks: \"
- Superscript: @SUP$text to be displayed as superscript@$
- Subscript: @SUB$text to be displayed as subscript@$
- Link: @LNK:http://www.sda-ltd.com$SDA Ltd (optional)@$
Text can be given classes or IDs which can be used to set styles in the project css:
- $class: class_name $ text @$
- $id: id_name $ text @$
Example 1:
Have you seen "Spartacus" ?
"Have you @U$seen@$ \"Spartacus\"?"
Example 2:
Which daily newspapers do you read ?
Please select all the apply.
"Which @B$daily newspapers@$ do you read ?@|Please select all the apply."
Example 3:
1st question: What is H2O?
"1@SUP$st@$ question: What is H@SUB$2@$O?"
Example 4:
Q1 "How much do you like @class:yellowbg$italic text with a yellow background@$?"
With the class defined in the project css:
.yellowbg {background-color:#ffff00; font-style:italic;}
Collecting 'Other' answer text
Respondents can be offered a text box in which to record more details when selecting an 'Other' answer.
Example:
QUESTIONS
Q1 "Why did you choose that?" : {
1 "Convenience",
2 "Cost",
3 "Quality",
4 "Other. Please specify" + OTH : TEXT REQUIRED
}
Note that more than one 'Other' answer choice can be used in a question.
Extended response types
Additional lists of possible responses can be added after the response type in the question definition. This is most commonly used for adding Don't Know or Refusal Codes to text or numeric response types.
Examples:
DEFINITIONS
dkrf = {
DK "Dont Know",
RF "Prefer not to answer"
}
QUESTIONS
Q1 "How many?" : INTEGER + dkrf
Q2 "Where was that?" : TEXT + dkrf
Q3 "Did you?" : {yes,no} + {1 "Not sure but probably Yes",2 "Not sure but probably No"}
By default items in the extended response list will be displayed underneath the main question response(s).
Components of a choice definition in a list of choices question:
There are 3 components to each choice in a list of choices: Name, Tag and Label. Choices can optionally be given choice attributes described below. The name/tag/label combinations for each choice are separated by commas and usually written on different lines to make the specification more readable.
{
name1 (tag1) "label1",
name2 (tag2) "label2",
name3 (tag3) "label3"
} {Nb}
label1, label2 and label3 are the texts associated with each response to be displayed on screen to respondents.
tag1, tag2 and tag3, in brackets, are the tags associated with each response. The tags will be the values used in the data set produced from the survey responses although there are options to change this when exporting the data.
name1, name2, and name3 are the names used for the possible responses to a question. Names provide a convenient way to refer to a response in the scripting language. They can make the script more concise and readable.
Not all of Name, Tag and Label are required. If not all are specified then SCROLL will generate values/text for the others according to the following rules.
Only Name & Tag specified: Name also used as the Label
Only Name & Label specified: Name also used as the Tag
Only Name specified: Name also used as the Tag and Label
Only Label specified: Label also used as the Name and Tag
Other combinations: Not allowed
The number Nb indicates the maximum number of choices that can be made from the list of responses. The absence of {Nb} means that only a single response may be entered. Use square brackets [Nb] rather than curly brackets to record selection order.
Choice attributes
The choices in a list of choices question can optionally be assigned additional attributes called choice attributes defined after the question label with the syntax below:
1 "choice 1" #[choice_attribute1="attribute 1 txt",choice_attribute2="attribute 2 txt"...]
Example: xchoice attribute to make a choice exclusive.
Q1 "Why did you choose that?" : {
1 "Convenience",
2 "Cost",
3 "Quality",
4 "Other. Please specify" + OTH : TEXT REQUIRED,
5 "None of these" @[xchoice='yes']
} {4} REQUIRED
If 'None of these' is selected then any other choices already selected will be automatically deselected.
The following attributes are predefined in the CAWI language which provides options to control how these attributes are used:
- xchoice='yes' - make choice exclusive. See example above.
- image='@image.png' choice made by selecting an image.
- cnotes="additional text associated with the category" - see full example program below
Examples:
Which_fruit "Select a fruit" : {
1 "Apple" @[image='apple.png'],
2 "Banana" @[image='banana.png']
}
1 "Academic Support Office" @[cnotes="Co-ordinating processes for assuring the quality of educational provision"],
2 "Student Support Services" @[cnotes="Providing a range of professional support services for students"],
As well as the attributes recognised by the CAWI system new attributes can be defined. division is a user defined attribute in the example below.
1 "Academic Support Office" @[cnotes="Co-ordinating processes for assuring the quality of educational provisional,division="Academic Registry"]
DEFINITIONS
lst_services = {
1 "Academic Support Office" @[cnotes="Co-ordinating processes for assuring the quality of educational provision",division="Academic Support"],
2 "HR Services" @[cnotes="Central HR processing and administration",division="Human Resources"]
}
QUESTIONS
Q1 "Which service" : services REQUIRED
Q2 "Why did you select @ANS:Q1$" : OPENTEXT
ROUTE
NEWPAGE()
ASK(Q1,'cnotes=yes')
ENDPAGE()
NEWPAGE()
MESSAGE("You have selected the @ANS:Q1$ in the " + GETCATTR(Q1,Q1,'division','') + " division: " + GETCATTR(Q1,Q1,'cnotes',''))
ASK(Q2)
ENDPAGE()
If HR Services is chosen at Q1 the MESSAGE statement will display:
You have selected the HR Services in the Human Resources division: Central HR processing and administration
If cnotes is set to "yes" in the ASK then the the cnotes text is displayed next to the main choice labels. Otherwise only the main choice labels are displayed.
Go to GETCATTR for a description of the GETCATTR function.
Question Groups
Groups of questions can be defined to combine several fields of answers, or several questions.
Examples:
Q10 "When did you catch the train ?" : (
hour "Hour" : 0..23 REQUIRED,
minute "Minutes" : 0..59 REQUIRED
)
The next example displays a grid with Child1, Child2, Child 3 as the rows and the questions in the group as columns.
Q11 {
1 "Child 1",
2 "Child 2",
3 "Child 3"
} "Can you provide a few details about your children." : (
Name "Name" : TEXT[64] REQUIRED,
age "Age" : 0..18 REQUIRED,
sex "Sex" : {
M (1) "Male",
F (2) "Female"
} REQUIRED
)
The question definitions in the group are separated with commas and parentheses () are used to enclose the list of questions.