Setting valid ranges on a question

You can add an expression in the Valid field of a variable so that the respondent can only enter data which matches the expression. For complex expressions it is better to use patterns.

The expression must be a list or range of possible values.

These can be

  • limited range For example, 1 TO 5 or 1~5
  • unlimited range using relational operators >(greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), <> (not equal to). For example >10 would include all values greater than 10
  • ranges defined by variables in the questionnaire. For example <Q9 would include all values less than the response to Q9
  • a list For example f, F, m, M or 1,2, >6

You can set the valid range:

  • by opening the Variable properties dialog from the questionnaire window and editing the value of the Valid field
Entering a valid date range in the Variable Properties dialog
  • by opening the Variable details dialog from the Variables window and editing the Valid field.
Entering a valid date range in the Variable Details window

To use the Valid property for open responses in a Web surveys, you must also check the Validate Open Responses option in the Interview section of the Questionnaire properties.

Note: You can use a variable within a limited range (e.g. Q9 to 15).

If you wish to use a relational operator within a limited range (e.g. >Q9 to 15), you cannot do so directly. Instead you must create a derived variable (e.g. V1) that contains the result of (Q9 + 1), and then set the valid range to be V1 to 15.

Setting a valid range for a number

  1. Open the survey in questionnaire mode.
  2. Select the question that you wish to set a valid range on.
  3. Click VariablePropsIcon.png on the window toolbar to open the variable properties dialog. (You can also press Alt+Enteror right-click the question and select Variable properties from the context menu.)
  4. If the Valid field is not visible, scroll the list of fields to display it.
Setting a valid range using the variable properties dialog
  1. Enter the valid range. For example 1 to 100 or <101. This would set a maximum of 100 for a question using percentages.
  2. Click OK to save the changes.

Setting a valid entry to match a previous entry

If you wish a respondent to type an identical entry twice, such as, to confirm an email address, you can set a Valid response of the previous variable.

QW: confirmation email questions

  1. In the Questionnaire window select the question that you wish to set a valid range on.
  2. Click VariablePropsIcon.png on the window toolbar to open the variable properties dialog. (You can also press Alt+Enter or right-click the question and select Variable properties from the context menu.)
  3. If the Valid field is not visible, scroll the list of fields to display it. Enter the variable name that you wish to match.
Setting a valid range using the variable properties dialog
  1. Click OK to save the changes.
Contents