Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Questions and responses > Questions with text responses
 
Questions with text responses
Questions that allow text responses are sometimes referred to as open ends or verbatims, and they allow respondents to type any text in response to the current question. This text is saved in the case data exactly as typed and is often manually coded once interviewing has finished so that the information in the responses can be analyzed with the precoded data.
Syntax for question with a text response
Qname "Qtext" text [[Length]];
Parameters
Qname
The question name.
Qtext
The question text.
Length
The number of characters you will allow in the response text.
Specifying the length
Text questions are often used when you want to obtain respondents' opinions on a particular subject in their own words. Since you'll want responses to be as detailed as possible, you should usually specify a length of 4000 characters for the response text. This is the maximum number of characters that can be stored in a column in a relational MR database. This limit is set in the MR UNICOM Intelligence Data Model that UNICOM Intelligence Interviewer - Server uses for storing case data. You cannot change it by changing the row limit in SQL.
Setting the length for the question to a maximum value of 40, or less, results in the text question being rendered with a single line edit box. Setting the maximum value to 41, or higher, results in the text question being rendered with a multiple line edit box.
If you use text questions to obtain information such as name and address, telephone, or membership numbers, you might have some idea of how many characters you expect respondents to type, or how many characters you want to record. In these cases you can either enter the text length as a fixed number (for example, when all membership numbers consist of eight characters), or as a fixed or open-ended range. Here are some examples. In the first one, the respondent must enter either seven or eight characters:
UserNumber "What is your user number?" text [7..8];
The next example allows respondents to enter up to 50 characters for the first line of their address:
Address "What is the first line of your address?" text [..50];
Since the range does not specify a minimum number of characters, you would expect the interviewing program to accept blank responses, so that respondents who do not want to give their names might just click Next to skip the question. This is not what happens.
Every question has a MustAnswer property that is normally set to True so that respondents must answer the question with a response that satisfies the specification in the question. With text questions, MustAnswer overrides the MinValue property that stores the minimum number of characters required, so respondents must enter at least one character to continue. If you want to allow respondents to skip the question you should set its MustAnswer property to False. For more information, see Allowing respondents not to answer questions.
Specifying the required text format
Texts such as telephone numbers, membership numbers, or national insurance numbers all have fixed formats, so you can check the respondent’s answer and reject it if it does not match the required format. This saves time and problems when you come to use or analyze the data because you will not have to make arbitrary decisions about what to do with invalid data.
To have the interviewing program validate a respondent’s answer, you need to specify the required text format as part of the question definition. You do this by appending the validation keyword and a regular expression to the question definition:
Qname "Qtext" text [[Length]] validation ("Expression");
For example, suppose that membership numbers must consist of two letters, six digits, and then a single letter (for example, AB123456Z). You could test that all texts match this pattern by defining the question as:
CardNumber "What is your security card number?"
text [9..9] validation ("\u{2}\d{6}\u{1}");
In the example, the validation expression tells the interviewing program that membership numbers must consist of two upper-case letters, six digits, and one upper-case letter, in that order.
The interviewing program uses the Validate function in the UNICOM Intelligence Function Library to validate text responses. For details about this function and the facilities it provides for text validation, see the “Regular expression syntax” subsection of Validate, but here are a couple more examples to give you an idea of what is possible.
JP 99 88 77 L is a typical British National Insurance number. To test that respondents enter their National Insurance numbers in this format you would type:
NINumber "What is your National Insurance number?"
text [13] validation ("\u{2}(\s{1}\d{2}){3}\s{1}\u{1}");
The regular expression specifies two upper-case letters, then three repetitions of a space followed by two digits, then a space and an upper-case letter.
E3 9JP, TN8 5AB, S16 0XX, and WC1H 3ZZ are all valid formats for British postcodes (zip codes). To accept text responses in any of these formats but no others you would type:
Postcode "And what is your postcode"
text [6..8] validation ("\u{1,2}\d{1,2}\u?\s{1}\d{1}\u{2}");
This regular expression accepts one or two upper-case letters followed by one or two digits, followed by zero or one upper-case letters. All texts must end with a space, one digit, and two upper-case letters.
See also
Questions with categorical responses