Drawing answer categories from an external source

Problem

You want to ask for a selection among choices that are not predetermined but rather extracted from an external source.

Solution

Use the CATEGORIES keywork on the question name line.

Discussion

Sometimes, the categories that you want the respondent to choose from are not predetermined. For example, you could want a schoolboard to select from a list of schools that is extracted from a data base maintained outside of CallWeb. While there are other strategies available if the external list is short, a long external list is best handled with the CATEGORIES question type.

The CATEGORIES question type identifies the name of an open-end part which contains the categories to be displayed. That open-end part must contain a string of pairs of codes and labels all delimited with a mu character (\$dlm_niveau1 if used in a calculation). Here is an example of such a pair of variables.

SCHOOL_LIST CALCUL
% question
\$ASCHOOL_LIST =
"CODE1\$dlm_niveau1Label 1\$dlm_niveau1"
. "CODE2\$dlm_niveau1Label 2\$dlm_niveau1"
. "CODE3\$dlm_niveau1Label 3\$dlm_niveau1"
. "CODE4\$dlm_niveau1Label 4\$dlm_niveau1"
. "CODE5\$dlm_niveau1Label 5\$dlm_niveau1"
. "CODE6\$dlm_niveau1Label 6\$dlm_niveau1"
. "CODE7\$dlm_niveau1Label 7\$dlm_niveau1"
. "CODE8\$dlm_niveau1Label 8\$dlm_niveau1"
. "CODE9\$dlm_niveau1Label 9\$dlm_niveau1"
. "CODE10\$dlm_niveau1Label 10"
% note
% categories

% simple skips
% condition
% open
1 = C10 1 10
! ==================================================

DELEGATIONS MIN=0 MAX=1 CATEGORIES=ASCHOOL_LIST
% question
% note
% categories
*9999*I*[EN]Open-end answer to support the open-end part. Made invisible to the respondent with the I behaviour code.
% simple skips
% condition
% open
9999 = C10 1 10
! ==================================================

ASCHOOL_LIST contains a mu-delimited list of school codes and school labels. In this example, the list is created by a direct CALCULation but it could be created from an extraction from another data base that is post-formatted as a mu-delimited list. ASCHOOL_LIST is then used as the argument to the CATEGORIES options of DELEGATIONS.

DELEGATIONS is a CATEGORIES question using ASCHOOL_LIST as input. This means that the options "Label 1" to "Label 10" are displayed in DELEGATIONS (as implicit answer codes 1 to 10 because the numbering of answers starts at 1 and goes up to the number of external categories). By default, each category label is displayed with its category code appended, in parentheses; it is possible to avoid appending the category code by adding a tiles (~) immediately after the equal sign (as in CATEGORIES=~ASCHOOL_LIST). A CATEGORIES question needs an open-ended part to store the selected codes (9999 in the example); the open-ended part code should have a behaviour code of "I" to make it invisible to the respondent. The selected of external codes are stored in the open-ended part of the CATEGORIES question, delimited by mu characters.

e-mail technical support!