Have an idea?

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

How do I create a constructed list from responses based on another constructed list?

I have three consecutive questions, each of which builds upon the other:

1)  What types of surgeries do your patients receive?
2) [For the types of  surgeries that your patients receive], which do you perform and which do you refer?
3) [For the types of surgeries from #2 that you refer], to what type of physician do you refer?

I understand that #2 is based on the parent list from #1 (that code works).  However, for question #3, I cannot figure out how to populate the rows of a grid question with the responses from #2.  Do I need to create a sub parent list?  

This feels like it should be straightforward but I cannot figure it out.  Any suggestions?
asked Sep 11 by Adam Crowther

1 Answer

0 votes
If you explain the structure of each of the questions, that will assist in providing you with a solution.

I'm assuming #1 is multiple response select question.

At #2, you are using something like AIC(Q1) as your constructed list. Is #2 a multiple response grid with Perform and Refer rows / columns? If so, which direction is the grid: rows or columns.

If you explain the details of #2 a little more, I'm sure we can come up with a solution.

I'm thinking you will need some Perl at this stage.
answered Sep 11 by Paul Moon Platinum (55,975 points)
Thanks for the response!  

-- Q1 is actually a numeric grid question that asks what percent of patients receive a given surgery.  If the response is >0%, then that kicks the respondent to Q2.

--Q2 is another numeric grid question, with a "perform" column and a "refer" column, with the rows populated with the surgeries that are >0 in Q1.

--Q3 is currently set up as a select grid (radio buttons), where rows are populated the rows where by Q3 "refer >0" and the columns are different physician types.

I should mention: one of the rows in Q1 is a "respondent specify" row.
 I'd like to carry through the text that is entered there to populate rows in subsequent questions, where appropriate.

Here is the perl I'm using for the constructed list for Q2:

Begin Unverified Perl

if(VALUE("Q17_r1_c1")>0){ADD("SurgInterv",1);}
if(VALUE("Q17_r2_c1")>0){ADD("SurgInterv",2);}
if(VALUE("Q17_r3_c1")>0){ADD("SurgInterv",3);}
if(VALUE("Q17_r4_c1")>0){ADD("SurgInterv",4);}
if(VALUE("Q17_r5_c1")>0){ADD("SurgInterv",5);}

End Unverified



"SurgInterv" is identical to the list that populates the rows of Q1.
For your Q3 row parent list, you could create something like the following ...

1-Surgery 1
2-Surgery 2
3-Surgery 3
4-Surgery 4
5-[%Q1_5_other%]

That takes care of the other specify comment being piped into Q3.

I can't see any syntax issues with your Perl. Are you referencing the correct column? Is "Refer" column 2? Make sure you have your question referencing correct. Also, Perl is case sensitive so however you have defined your list names and variable names is crucial to it working correctly.

Get back to me.
In Q2, "Refer" is column 2.

I think I'm still struggling to pull through a "respondent specify"  row from Q1 to Q2 and then from Q2 to Q3.

Currently, the perl (which works, save for pulling through the label for the "other" category) I have for the constructed list for Q2 is:


Begin Unverified Perl

if(VALUE("Q1_r1_c1")>0){ADD("SurgInterv",1);}
if(VALUE("Q1_r2_c1")>0){ADD("SurgInterv",2);}
if(VALUE("Q1_r3_c1")>0){ADD("SurgInterv",3);}
if(VALUE("Q1_r4_c1")>0){ADD("SurgInterv",4);}
if(VALUE("Q1_r5_c1")>0){ADD("SurgInterv",5);}

End Unverified



To pull through the label from Q1, should I change it to:


Begin Unverified Perl

if(VALUE("Q1_r1_c1")>0){ADD("SurgInterv",1);}
if(VALUE("Q1_r2_c1")>0){ADD("SurgInterv",2);}
if(VALUE("Q1_r3_c1")>0){ADD("SurgInterv",3);}
if(VALUE("Q1_r4_c1")>0){ADD("SurgInterv",4);}
if(VALUE("[%Q1_r5_other%]")>0){ADD("SurgInterv",5);}

End Unverified



Similarly, for Q3, the perl for the constructed list reads:


Begin Unverified Perl

if(VALUE("Q2_r1_c2")>0){ADD("SurgReferral",1);}
if(VALUE("Q2_r2_c2")>0){ADD("SurgReferral",2);}
if(VALUE("Q2_r3_c2")>0){ADD("SurgReferral",3);}
if(VALUE("Q2_r4_c2")>0){ADD("SurgReferral",4);}
if(VALUE("Q2_r5_c2")>0){ADD("SurgReferral",5);}

End Unverified



It feels like I should adjust the perl for Q3 similarly to how it reads for Q2:


Begin Unverified Perl

if(VALUE("Q2_r1_c2")>0){ADD("SurgReferral",1);}
if(VALUE("Q2_r2_c2")>0){ADD("SurgReferral",2);}
if(VALUE("Q2_r3_c2")>0){ADD("SurgReferral",3);}
if(VALUE("Q2_r4_c2")>0){ADD("SurgReferral",4);}
if(VALUE("[%Q2_r5_c2_other%]")>0){ADD("SurgReferral",5);}

End Unverified
h


Currently, both constructed lists have the same parent list, which is:

1. Surg 1
2. Surg 2
3. Surg 3
4. Surg 4
5. Other Surg (specify)

Currently, "SurgInterv," "SurgReferral," and the parent list above are all identical.

Sorry if this is confusing - trying to provide as much context as possible.
Make the parent list like this at Q2 and Q3 ...

1-Surgery 1
2-Surgery 2
3-Surgery 3
4-Surgery 4
5-[%Q1_5_other%]

This will pipe the comment at Q1 into Q2 and Q3. I assume that is what you want?

Your Perl at Q3 should be looking at the column 2 at Q2 if "Refer" is column 2".

Your Perl script syntax looks fine.

Send me your email and I will whip up an ssi file for you and send on to you.
...