Have an idea?

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

Only show certain responses in select question

I have a select question 'C6' which has a total of 6 responses.

I want to show response 1 only if the question c3=1 or c3=3
And show response 3 only  if c3=2 or c3=3

How do I do this?
asked Nov 20, 2018 by kaitlan

1 Answer

0 votes
You need to create a constructed list and use some Perl script.

Let's make some assumptions first. Assume the parent list which is used at C3 and C6 is the same and let's call it C3List. I have also assumed C3 is a single response select question. I have also placed a randomise instruction at the bottom of the constructed list which will randomise all codes at C6. Remove it if you don't need it.

Create this constructed list and use it at C6 ...
Begin Unverified Perl 
  
 if ((VALUE("C3")==1) || (VALUE("C3")==3))
  {  
   ADD("C6List",1);
  }  

 ADD("C6List",2);

 if ((VALUE("C3")==2) || (VALUE("C3")==3))
  {  
   ADD("C6List",3);
  }

 ADD("C6List",4,6);
 RANDOMIZE();

End Unverified

If C3 is a multiple response select question, change ...

(VALUE("C3")==2) to (VALUE("C3_2")==1)

Do the same for all C3 conditions within the Perl script.
answered Nov 20, 2018 by Paul Moon Platinum (77,000 points)
edited Nov 21, 2018 by Paul Moon
The C3list is different than the c6 list

C3 has three choices
Choice A, Choice B, Both

C6 has 6 different options
Option 1 (only to be displayed if C3=1 or C3=3)
Option 2
Option 3 (only to be displayed of C3=2 or C3=3)
Option 4
Option 5
Option 6

When I use C3List as  a parent list, those items show up in question C6

Does this make sense? Is there a way I can program this?
OK, that's fine.

I have modified the Perl script above. It now uses a parent list called C6List which will contains the 6 items at C6 you mentioned.

Given C3 is a single response question, those conditions within the Perl script are correct.

Let me know how you go.
...