Variable Length Question Type

Variable Length questions are for controlled-length, open-ended responses up to 5000 characters or as placeholders in the data. In terminal mode only 76 characters of data can be entered. With a Variable Length question you can specify the minimum and maximum number of characters that will be allowed. The response will be stored in the data exactly as typed. However, the program checks that the response meets the criteria of the entry after stripping out any leading blanks before storing the response.

The syntax for a Variable Length question type is:

!VARIABLE,subtype,maximum # of characters allowed,minimum # of characters required

Specifying a subtype, or minimum or maximum number of characters is optional.  The default minimum is 0 characters (blank is allowed), the default maximum is 1 and the default subtype is no subtype (i.e., allow any type of character).

Specifying a minimum and/or maximum length is one way of ensuring that interviewers enter an appropriate response.  The program will not accept a response that is shorter than the minimum or longer than the maximum.

By specifying the same length for the minimum and maximum, you can ensure that an exact number of characters will be entered. This can be useful for same length data, such as telephone numbers or zipcodes.

Advanced Users Note: The 76-column limit is on data input in terminal mode for the VARIABLE length question. You can GENERATE,COPY_DATA to a VARIABLE length question or back-reference a VARIABLE,USE_PREVIOUS_ANSWER question with up to 5000 columns.

Valid Subtypes

  • Alphabetic_Only
  • Blank_Ok
  • Blank=
  • Date_Format
  • Email_Check
  • Get_From_HTML_Variable
  • No_Echo_For_Password
  • Numeric_Only
  • Phone_Number_Format
  • Use_Previous_Answer

ALPHABETIC_ONLY

Shortform: VAR,ALPHAONLY

Allows alphabetic character responses (A-Z), periods (“.”), dashes (“-“), and blanks only. No numbers or other special characters are allowed. This is useful with data such as collecting names.

BLANK_OK

Shortform: VAR,BLKOK

Allows the question to be unanswered (and blank in the data). Use this with caution because it is difficult to track the interviewers’ movements if some questions are blank.

BLANK=”string”

This keyword puts data into a question that is left unanswered if presented.  The question subtype must be BLANK_OK (see above) or the question must be inside of a !GRID,BLANK_OK statement (allow blank in grid of questions).  The “string” must fit into the width of the question.

EXAMPLE:

{ QVARIABLE:
Enter a name:
!VARIABLE,BLANK_OK,25,5,blank="NAME NOT SPECIFIED" }

This will save the string NAME NOT SPECIFIED into the data and answer array.

DATE_FORMAT

Shortform: VAR,DATE

Accepts a date/time string and returns “yyyymmddhhmmss”.

You can enter a date/time as if you were at the “Enter time to call” prompt (See Interviewing with Phone System for valid formats of the date/time to enter) and Survent will return the julian date/time in the data. You can then use this date/time to control the PHONE,SET_CALL_STATUS,104 (or 160-179) statement’s time to call. This means you can format your own screens to get the time to call as well as control the input to be within certain parameters, etc.

The width must be at least a length of 14 to accommodate the returning Date/Time.

EXAMPLE:

{ QDATETIME: .14
Enter the date and time to call the respondent in respondent's time:
!VARIABLE,DATE_FORMAT }

{ XDATETIME:
!PHONE,SET_CALL_STATUS,104,QDATETIME }

NOTE 1: To specify more characters as input, set the length longer. The date/time returned will be left-justified in the data location field.

NOTE 2: You can only enter a specific date/time. That is, you cannot use “+# days” or “+# mins” for instance, or any of the approximate time keywords like “tomorrow” or “next week”.  You can, however, use “Monday”, “Tuesday”, etc and it will return the current time on that date. Also, if you enter nothing, you get the current date/time returned. This can also be used in conjunction with PHONE,SET_CALL_STATUS,104 or the other call back status codes (160-179,601-628).

EMAIL_CHECK

Shortform: VAR,EMAIL

Checks the input for a valid email address format within the minimum and maximum characters specified. The requirement is that an “@” must be present followed by letters and at least one period (“.”).

GET_FROM_HTML_VARIABLE

Shortform: VAR,HTML

Used to create a hidden input tag onscreen. This question subtype can be used to gather data filled in by some other program such as JavaScript, Shockwave, Flash or another browser-based programming language. This can be anything that will allow a respondent to give an answer.

EXAMPLE:

{ QHIDDEN:
!VARIABLE,GET_FROM_HTML_VARIABLE,2,0 }

Would create a hidden input tag on the screen:
<input type="hidden" name="qhidden" value"">

NOTE: Because these questions are hidden onscreen, there is no way for webSurvent to present an understandable error message to the respondent. All error checking must be done by the program that is filling in the question.

NO_ECHO_FOR_PASSWORD

Shortform: VAR,NOECHO

Does not echo the typed response (is quiet). This is useful for passwords. Asterisks are displayed on the screen instead of the actual typed response.

NUMERIC_ONLY

Shortform: VAR,NUM

Allows the entry of numeric responses only. This is useful with data such as telephone numbers or zipcodes.

PHONE_NUMBER_FORMAT

Shortform: VAR,PHONE

Allows the entry of phone numbers only.  Any parentheses, dashes, spaces, or leading “1’s” will not be recorded in the data. The number of digits remaining must match the phone number size as specified in the phone file. If you back-reference the VARIABLE,PHONE_NUMBER_FORMAT question, you will see the number as originally entered.

You can allow an interviewer to type more characters than are stored in the data when using VARIABLE,PHONE_NUMBER_FORMAT. This is because VARIABLE,PHONE_NUMBER_FORMAT strips miscellaneous non-numeric characters from the input and only saves the number.

The syntax is:

!VARIABLE,PHONE_NUMBER_FORMAT,width saved,minimum width saved,max # characters typed

EXAMPLE:

{ QPHONE:
!VARIABLE, PHONE_NUMBER_FORMAT,10,10,20 }

The above example would allow interviewers to type up to 20 characters, but require that the numeric characters be exactly 10.

When data is entered as (415) 777-0470

If you back-reference the question, you see exactly “(415) 777- 0470”.  But, if you look at the data, you see “4157770470”.  You can later use this phone number to feed it into a !PHONE,GET_SPECIFIC_NUMBER statement and call the number.

USE_PREVIOUS_ANSWER

Shortform: VAR,USEPREVIOUS

Used to create a marker for text that will be used in other questions and is hidden from the interviewer.   VARIABLE,USE_PREVIOUS_ANSWER gets its response from a previous GENERATE, SPECIAL, or PHONE statement or by placing it on a previous question’s data. The response from the VARIABLE,USE_PREVIOUS_ANSWER can then be displayed in the text of a subsequent question.

NOTE 1: Having a VARIABLE,USE_PREVIOUS_ANSWER with a minimum greater than zero will cause Survent to blow with error message #109 if the data is blank.

NOTE 2: \| performs a similar function but there is the drawback where the \| will include the trailing spaces while the \: to the VARIABLE_USE_PREVIOUS_ANSWER will not. (See Displaying Prior Responses and Data, Displaying Contents of A Data Location for more information.)