Using list formula
'List folding' uses selections from one question to drive later questions that depend on previous answers given. For instance collecting brands aware of, and using that list to ask questions about brands they have seen advertising for. Cxoice provides formulae for managing and manipulating lists to create sophisticated questionnaires.
What is a list in terms of a questionnaire?
A list is a combination of codes with text. For instance a list of cities:
- 1=London
- 2=Paris
- 3=Washington
- 4=Toronto
- 5=Berlin
- 6=Tokyo
Lists are used in different question types to provide options for answers. For instance we can ask a single question Q1: "Which is your favourite city?" and use the list to get a single response.
Where things become more complicated is where there are multiple responses possible. For instance, Q2: "Which of these cities have you visited". Someone might answer London, Paris, Toronto, which would be represented at 1,2,4.
If we then want to ask Q3: "Which of these cities did you visit last?" we would only want to ask the question for the 1,2,4 items since we know Washington wasn't a place that was visited.
Formula to pull list across questions
To allow this type of 'list folding', set %%LIST(Q2) as the first item in the list of option code. The formula means "take the list of answers from Q2 and plug them in as options for Q3".
Codes: 1. %%LIST(Q2)
Catching empty lists
If someone has only visited one city at Q2, or hasn't visited any of them, then Q3 is redundant. So we need to build in a skip into the survey logic using the Page Break question. Our logic would use the COUNT formula which gives the length of the list. So we would have if(COUNT(Q2)<=1) skipto: Q4.
Evaluating which codes have been selected
Lists consist of items with a code=text. Most commonly in formula and survey logic we need to get the codes - for instance when checking what items have been selected to see if item 2 has been selected we can use MULTICHECK(Q2,2) - multicheck is used because we have more than one answer for a multiple question. MULTICHECK gives 'true' if the code was selected. If we want to test for multiple items we can use MULTICHECK(Q2,2,4,5,6), which would check if any of 2, 4, 5 or 6 were selected.
Getting the text for a selected option
Text-piping is feeding an answer as text from one question into another - What did you think of %%[Q2]?
However, in this instance %%[Q2] will return the code number for Q2 - eg 1 or 2 or 5
To get the text describing the items selected,is done with the GETTEXT command.
GETTEXT(code, @question).
The @question tells Cxoice to look up the original question text, at the given code value. For our cities example, it would be
GETTEXT(Q2,@Q2)
Which reads as 'the code from Q2, from the question @ Q2)'
Lists from Grids
With grids and card sorts things go one stage further in that we can build a list from a column of items selected using GETGRIDLIST. Here we would use GETGRIDLIST(question, columnvalues) to get the list of items selected in the columnvalues - for instance if you wanted all the top rated brands (Column values usually use 1|2|3).
Lists from lists - more complex formulae
The formulae can then get sophisticated in that we can also apply GETTEXT. For instance if we want to ask why a set of brands were picked as top we would need GETTEXT to get the text and GETGRIDLIST to get the list in the first place. So we get GETTEXT(GETGRIDLIST(brands,1|2),@brands) giving a somewhat complex, but extremely powerful method of reading and replaying answers through the questionnaire.