Have an idea?

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

Build a Free Format Question Dynamically

I have a free format grid type question (Q2) with five rows and three columns and the response type is multi. So there can be maximum of 15 responses. I want to build another free format question (Q3) with the help of responses of this question. The Q3 question shows only those response which are checked in Q2. How can I do it? Please help.
asked Mar 5, 2013 by anonymous
retagged Mar 5, 2013 by Walter Williams

2 Answers

+3 votes
I would create a predefined list with the 15 possible responses in Q2 that could be used in Q3.  Then create a constructed list for Q3 using Unverified Perl to add each item that was selected in Q2.  Below would be an example of adding 3 of the items from Q2, assuming "Q2_r1_c1" is the name of the variable for the first row, first column and so on.  If selected at Q2 the value of the variable should be stored as a "1".

Begin Unverified Perl
 if(VALUE("Q2_r1_c1") == 1)
 if(VALUE("Q2_r1_c2") == 1)
 if(VALUE("Q2_r1_c3") == 1)
 End Unverified
answered Mar 5, 2013 by Jay Rutherford Gold (36,215 points)
+2 votes

First craete a quesiton with name Q3. You need to define 5 variable Q3_r1 to Q3_r5.

Now comes to List section and create Q3RowList1 with 3 items
Item 1 should be looks like,
<td class="row_label_cell" width="40%"><div class="grid_options">Row 1</div></td><td class="input_cell clickable">[%CheckSelect(Q3_r1, 1)%]</td><td class="input_cell clickable">[%CheckSelect(Q3_r1, 2)%]</td><td class="input_cell clickable">[%CheckSelect(Q3_r1, 3)%]</td>

create another 2 row using Q3_r2 and Q3_r3 here.

Now create one constructed list Q3List, for which Q3RowList1 should be parent list and add member based on previous quesiotn checking. This shuld be somethign like.

Begin Unverified Perl
if((VALUE('Q2_r1_1')==1) or (VALUE('Q2_r1_2')==1) or (VALUE('Q2_r1_3')==1))
End Unverified

Now comes to free format HTML section. and code to showing grid header looks like.

<table class="inner_table" border="1" width="100%"><tr class="column_header_row"><td class="corner_label_cell  alt_color1" width="40%">&nbsp;</td><td class="col_label_cell alt_color1 " width="20%"><div class="grid_options">
<center>Column 1</center></div></td><td class="col_label_cell alt_color1 " width="20%"><div class="grid_options">
<center>Column 2</center></div></td><td class="col_label_cell alt_color1 " width="20%"><div class="grid_options">
<center>Column 3</center></div></td></tr>

Now add all 3 members of the list Q3List, looks like...


so If any member added to Q3List it will show only that member. and you can put one preskip for Quesiton 3. like ListLength(Q3List)<1 goto next.

Let me know if you need more clarification.
answered Mar 5, 2013 by Rajesh Rana Gold (24,770 points)