Have an idea?

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

Show/Hide rows in a grid based on response to a previous question

I am asking a geographic question:
Q3 - "In which of the following states is your business located"
 Texas
 Arkansas
Ohio
Pennsylvania

I have a follow up question (q14) that lists a series of companies. Some companies will be listed for all states, but others will be added if they select a particular state.

How do I show/hide in both a select question and a subsequent grid question based on the response to Q3?
asked Nov 16, 2013 by anonymous

1 Answer

+2 votes
You need to use some Perl programming in a constructed list. The constructed list can be used for select and grid type questions.

In the example below, if Q3=1 get companies 1-10,  if Q3=2 get companies 11-20, if Q3=3 get companies 21-30 and if Q3=4 get all companies 1-30.

Begin Unverified Perl

if (VALUE("Q3")==1)
 {
  ADD("CompanyList",1,10);
 }

if (VALUE("Q3")==2)
 {
  ADD("CompanyList",11,20);
 }

if (VALUE("Q3")==3)
 {
  ADD("CompanyList",21,30);
 }

if (VALUE("Q3")==4)
 {
  ADD("CompanyList",1,30);
 }

End Unverified
answered Nov 17, 2013 by Paul Moon Platinum (61,555 points)
Thank you, this worked great!
Hi,
I am trying to do kind of the same thing, but my "Q3" allows mulitple answers (Check Boxes). In a a later grid question. let's name it Q4 I want to show only the rows checked in Q3. Somehow this is not working... Thank you for your help!
The above example assumes Q3 to be a single response (radio buttons) select type question.

If Q3 was a multiple response question (check boxes) select type question, you would have to refer to Q3 as Q3_1, Q3_2 and so on.

The above example would look something like this ...
Begin Unverified Perl
 
if (VALUE("Q3_1")==1)
 {
  ADD("CompanyList",1,10);
 }
 
if (VALUE("Q3_2")==1)
 {
  ADD("CompanyList",11,20);
 }
 
if (VALUE("Q3_3")==1)
 {
  ADD("CompanyList",21,30);
 }
 
if (VALUE("Q3_4")==1)
 {
  ADD("CompanyList",1,30);
 }
 
End Unverified

Also note that each condition is "==1" which refers to the check box being selected.
...