Professional > Interview scripting > Writing interview scripts > Shared lists > When the same response appears in more than one list
 
When the same response appears in more than one list
Sometimes the same response will appear in more than one list. For example, all brands of yogurt may have raspberry and strawberry flavors. Depending on how you set up and use the lists, you may need to use namespacing to ensure that these 'duplicate' responses are treated as separate responses. This topic provides sufficient information about namespacing such that you can understand when you must use it with shared lists. For more detailed information about namespacing in general see Responses with duplicate response names.
Assume that you have the following lists:
AlpineList define
{
Raspberry, Strawberry, BlackCherry "Black cherry"
};
DairyFreshList define
{
Strawberry, Apricot, Peach
};
Both lists contain a strawberry response. As long as you do not use the two lists with the same question, there is no need to use namespacing because these responses will always be unique within the response list for a single question. For example:
AlpLike "Which flavors of Alpine yogurt do you like?"
categorical [1..]
{
use AlpineList
};
DFLike "Which flavors of Dairy Fresh yogurt do you like?"
categorical [1..]
{
use DairyFreshList
};
Here you have one question for Alpine brand and another for Dairy Fresh brand so there is no overlap between the responses within each question.
If you rewrite this example so that there is one question for all brands, the response list for that question contains two occurrences of strawberry. For this to be accepted, you must follow each list name in the question definition with the namespace keyword as shown below.
Like "Which flavors of yogurt do you like?" categorical [1..]
{
Alpine
{
use AlpineList namespace
},
DairyFresh "Dairy Fresh"
{
use DairyFreshList namespace
}
};
This forces each response name to include the name of its parent list, so the names of the responses become AlpineList.Raspberry, AlpineList.Strawberry, DairyFreshList.Strawberry, and so on.
The interview page for this example is as follows:
The same rule applies if you create a shared list that uses lists that have common responses. In this case you place the namespace keyword inside the main list as follows:
OrganicFlavors define
{
use HelenBradleyList namespace,
use KentishList namespace
};
HelenBradleyList define
{
Raspberry, Pineapple, Apricot, Blackcurrant
};
KentishList define
{
Blackcurrant, Mango, Peach, Apricot
};
Prefer "Which of the following ice cream flavors do you
like best?" categorical [1..1]
{
use OrganicFlavors
};
Note The interview page for this example is similar to the one shown earlier except that there are no subheadings to show the respondent why there are two identical responses in the list.
See also
Shared lists