Q & A : Filtering Responses.

A few days ago we where asked to provide an example of how you can filter the responses of a question based on the responses to a previous question. This is a common thing to do and in this short article we will give you all the information that you need to achieve this.

First off we need some metadata,

Products "" define 
    {
    	Product_A,Product_B,Product_C,Product_D,Product_E,Product_F
    };

UseProducts "Which of these products do you use?" categorical [1..]
    {
    	Use Products
    };

MostOften "Which of these products do you use the most?" categorical [1..1]
    {
    	Use Products
    };

WouldUse "Which of these products would you use if paid to?" categorical [1..]
    {
    	Use Products
    };

In this example we have a define or shared list of products that we can use on multiple questions. Next we have a question that asks which of the products do you use, followed by a question asking which of them do you use the most. Then we ask which of the remaining products might you use. So what is the routing we need to put all this together,

UseProducts.Ask()

MostOften.Categories = UseProducts.Response.Value
MostOften.Ask()

WouldUse.Categories = WouldUse.Categories - UseProducts.Response.Value
WouldUse.ask()

You will see that we ask the first question and then take the answers selected and make them the Categories of the second question. The trick here is that your questions must have the same categories defined in the metadata. If they do not then this will not work. Next we ask the WouldUse question , but this time just before we do the ask we take the responses chosen in the first question and take them away from the categories already defined.

What we can also do , although it does not make sense in this question setup is to add categories together. For example if we have the following metadata

All "These are all the products selected." categorical [1..]
    {
    	Use Products
    };

and then the following routing


All.Categories = WouldUse.Response.Value + UseProducts.Response.Value
All.ask()

You will see that by using the + sign we can add the categories together from previous questions and show them in another. So although a short article it should give you enough information to do all the sorts of things that you require, but as always if you need some help then just drop us a line.

Leave a Comment

%d bloggers like this: