Professional > Interview scripting > Writing interview scripts > Filtering questions and response lists > Filtering categorical response lists > Response lists that combine answers to previous questions > Answers chosen at both (all) questions
 
Answers chosen at both (all) questions
This topic shows how to generate a response list that displays only responses chosen at both the previous questions. The questions in the metadata section are:
BrandList define
{
Alpine, Finborough, Alsace,
DairyFresh "Dairy Fresh",
CountryFayre "Country Fayre"
};
OrganicBrandList define
{
HelenBradley "Helen Bradley's",
KentishFarm "Kentish Farm",
NaturesWay "Nature's Way Organic",
SimpleOrganix "Simple Organix"
};
SawAdvert "Which of the following brands have you seen advertised
during the last four weeks?" categorical [1..]
{
use BrandList,
use OrganicBrandList,
SawNone "Did not see any brands advertised" excl fix
} asc;
HeardAdvert "Which of the following brands have you heard advertised
during the last four weeks?" categorical [1..]
{
use BrandList,
use OrganicBrandList,
HeardNone "Did not hear any brands advertised" excl fix
} asc;
CompareAds "For the brands for which you both saw and heard
advertising, which brand had better visual than audio
advertising?" categorical [1..]
{
use BrandList,
use OrganicBrandList
} asc;
The routing statements that produce a list of answers that were given at both SawAdvert and HeardAdvert are as follows:
CompareAds.Categories.Filter = SawAdvert.Response.Value *
    HeardAdvert.Response.Value
CompareAds.Ask()
This script uses the intersection (*) operator to collect answers that were chosen at both questions. Answers chosen at only one question or not chosen at all are ignored. If the filter for CompareAds generates a blank list, the question is not asked.
Here’s a prompted and unprompted awareness example that results in a final rating question about a brand selected at random from those that the respondent knows. The metadata section defines all the questions that are used (they are not all asked):
BrandList define
{
Alpine, Finborough, Alsace,
DairyFresh "Dairy Fresh",
CountryFayre "Country Fayre"
};
OrganicBrandList define
{
HelenBradley "Helen Bradley's",
KentishFarm "Kentish Farm",
NaturesWay "Nature's Way Organic",
SimpleOrganix "Simple Organix"
};
FirstKnown "When you think of frozen desserts, which is the first
brand that comes to mind?" categorical [1..1]
{
use BrandList,
use OrganicBrandList
} asc;
OtherKnown "Which other brands can you think of?" categorical [0..]
{
use BrandList,
use OrganicBrandList
} asc;
Prompted "Which of the following brands do you recognize?" categorical [0..]
{
use BrandList,
use OrganicBrandList
} asc;
RateThis "Randomly selected brand for rating" categorical [1..1]
{
use BrandList,
use OrganicBrandList
} asc;
Rating "How would you rate {#RateThis} overall?" categorical [1..1]
{Excellent, VGood "Very Good", Good, Poor, VPoor "Very poor"};
The routing section is as follows. Notice the use of the temporary AllKnown variable that keeps track of which brands have been mentioned.
Dim AllKnown
FirstKnown.Ask()
AllKnown = FirstKnown.Response.Value
' Use all except first known brand
OtherKnown.Categories.Filter = OtherKnown.DefinedCategories() - FirstKnown.Response.Value
OtherKnown.Ask()
AllKnown = AllKnown + OtherKnown.Response.Value
' Use all not known
Prompted.Categories.Filter = Prompted.DefinedCategories() - AllKnown
Prompted.Ask()
AllKnown = AllKnown + Prompted.Response.Value
' Select one answer at random from all brands known
' An alternative is Ran(AllKnown,1)
RateThis = AllKnown.Ran(1)
Rating.Ask()
See also
Response lists that combine answers to previous questions