Website accessibility
Show or hide the menu bar

Using list formula

Advanced users often want to use selections from one question to drive subsequent questions for things like list folding where a list depends on previous answers given. For instance where someone selects the brands they are aware of, and then this list is used to ask questions about brands they have seen advertising for. Cxoice provides formulae for managing and manipulating lists to create sophisticated questionnaires.

A list is a combination of codes with text. For instance a list of cities: 1=London, 2=Paris, 3=Washington, 4=Toronto.

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.

To do this Cxoice allows you to use a command %%LIST(Q2) as the first item in the option list, which will take the list of answers from Q2 and plug them in as options for Q3.

However, 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.

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. 

However. we might also need to get the text to prompt with the words describing the items selected, and to do this we use the GETTEXT command. GETTEXT(values, @question). The @question tells Cxoice to get the original question text, not the question value.

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).

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.


Previous article: Linking with panels Next article: Frequently Asked Questions (FAQ)
More details

Go to Notanant menuWebsite accessibility

Access level: public

Page feedback

This site uses essential cookies only. By continuing to use this site you accept our use of cookies: OK