when we ran our article on question types we did not touch on one of the more complex types. In this article we will look at Compound Questions. You see this type of question more in Web and paper surveys as they offer a unique way at representing the allowable choices.
First off the best way to explain what a compound question is , is to show you one , so here it is ,
![Compound](https://i0.wp.com/www.smarterdatacollection.com/Blog/wp-content/uploads/2011/06/Compound4.gif?resize=300%2C187)
As you can see a compound question is a mash up of a few question types all with the same subjects. So how do we create this , well first off lets create the base template for the question,
ListA "" define { A,B,C,D,E }; CompoundName "Compound Text Question" compound { Use ListA } fields ( ' Questions Go Here );
In this example for the subjects we have used a shared list. We have used this just so that it is easier to create the addition questions that we want to add. So what shall we add first , let’s just do a simple MP question. So replace the words “‘ Questions Go Here” with the following,
MP "MP Question" categorical [1..];
What we end up with is the following,
![Compound1](https://i0.wp.com/www.smarterdatacollection.com/Blog/wp-content/uploads/2011/06/Compound11.gif?resize=183%2C187)
As you can see at this stage it looks like a normal grid question, but we don’t stop here. Next we will add a long question to it. Now because a long question does not have any subjects we have to add the long to a loop and then add it into the compound, so what we need is this metadata added after our multiple response question.
CL "Long Question" loop { Use ListA } fields ( LQ "" long [1 .. 16]; ) expand;
and then we will end up with our question looking like this,
Next lets add the remaining metadata,
CL1 "List Question" loop { Use ListA } fields ( SP "" style( Control( Type = "DropList",, Accelerator = "CTRL+T" ) ) categorical [1] { cats,Dogs,Monkeys }; ) expand; CL2 "Text Question" loop { Use ListA } fields ( qtext "" style ( rows=1, Control( Type = "SingleLineEdit" ) )text; );
as you will see the first question is a single response but it is using a Dropdown list to show the responses. The second is a text question with some styles added to it so that we don’t have a massive box in our question. This is what the final output looks like,
![Compound3](https://i0.wp.com/www.smarterdatacollection.com/Blog/wp-content/uploads/2011/06/Compound311.gif?resize=300%2C118)
So hopefully that has told you all you need to know about how to setup compound questions, but as always if you need a little more just leave a comment and I will try and help.
I need to figure out how to add date pickers to a compound question. I tried the date picker in a loop, but couldn’t get it to work.