Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Constructed Lists from Combo Box Grid

I want to construct 2 lists based on the answers of a Combo Box Grid.  One list for the row labels and another list for the column labels.  Is this feasible and how?  Right now I can only make either list to work, but not both because of the row vs column question issue.  Any workaround?

Thanks in advance!
asked Sep 19, 2012 by tamsam0 (125 points)
retagged Sep 19, 2012 by Walter Williams
I didnt understand your question fully? In a grid questions settings you can select a constructed list for the row in rows tab and for the columns in the column tab. How exactly does it not work?
Thank you for your reply.  

Let me try to explain better what I'm struggling with.

I have a grid question with product A, B, C, D on the left as row labels, then I have brands 1, 2, 3, 4, 5 across on top as the column labels.  This is a combo box question with a drop down menu currently use, have used, aware but not used and unaware as the options.  So for each product (A, B, C or D), people have to choose their experience of each brand.

Then, I want to create multiple constructed lists.

1) A list of the products that at least one brand is currently use or have used

2) All the brands that are currenty used or have been used for Product A

3) Same as 2 but for Product B


If I set it as a columnn question, I can only populate the row labels which are the products,  but I cannot populate the brands.

Vice versa, if I set it as a row question, I can only populate the column labels which are the brands, but not the products.

I want to do both but I'm not sure if it is possible with the current set-up.

(converting this to a comment rather than an answer - Bahadir Ozkurt)

1 Answer

0 votes
If your grid question (referred as "grid" in the code below) looks like the following and you want your constructed list to be accessible after hitting submit on this page; you can use Perl to achieve what you want to do:

type this in Constructed list instructions
[% Begin Unverified Perl
if(VALUE("grid_r1_c1")== 1) { ADD("Products",1); }
if(VALUE("grid_r1_c2")== 1) { ADD("Products",1); }
if(VALUE("grid_r1_c3")== 1) { ADD("Products",1); }
if(VALUE("grid_r2_c1")== 1) { ADD("Products",2); }
if(VALUE("grid_r2_c2")== 1) { ADD("Products",2); }
if(VALUE("grid_r2_c3")== 1) { ADD("Products",2); }

End Unverified %]

I haven't tested but it should work, ofc you have to fill out the rest of the conditions :)
answered Sep 19, 2012 by Bahadir Ozkurt Gold (16,980 points)
Excuse my ignorance.  Where exactly do I put these codes? Thanks.
This is the list building logic, which would go into the text entry area when you create a new constructed list.  If you are unfamiliar with list building, it would be helpful to read through this help file first: www.sawtoothsoftware.com/support/issues/ssiweb/online_help/hid_web_listbuilding.htm
Thanks Brian,
When it says [ is an invalid character, what does it mean and what should I do?
That's a typo in Bahadir's code.  When you are building a list, you do not need to start with [%, i.e. just start off with Begin Unverified Perl on the first line, and then the last line should be End Unverified without the %] characters
Thank you!