Have an idea?

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

Constructed List Question

I am trying to construct a list that will be used for the Rows in a Grid Question. I have a parent list with three members (Q15oneRowList) and I want the third member to only appear if the respondent selects more than one item in a previous multiple select question (Q7) with 11 items.

Currently, what I have is:

ADD(Q15oneRowList)
Begin Unverified Perl

if(
(GETVALUE("Q7_1")+GETVALUE("Q7_2")+GETVALUE("Q7_3")+GETVALUE("Q7_4")+GETVALUE("Q7_5")+GETVALUE("Q7_6")+GETVALUE("Q7_7")+GETVALUE("Q7_8")+GETVALUE("Q7_9")+GETVALUE("Q7_10")+GETVALUE("Q7_11"))> 1){
    REMOVE("Q15oneRowList",3);
}
End Unverified



However, the third member of the list still shows up regardless. How can I correct this?
closed with the note: Thanks Jay! What a silly mistake
asked Nov 8 by jzu633 (190 points)
closed Nov 9 by jzu633
Your code appears to be correct.  Can you check that your grid question is using the constructed list instead of the predefined list?
Happens to us all, just glad it was an easy fix for you.  As a side note, many times when dealing with similar things I'll simplify by creating a constructed list of the selected answers from (Q7 in this case) and then I can just call on the list length of the constructed list if I need logic based on the number of items selected.

1 Answer

0 votes
 
Best answer
From your code it would appear you are telling it to REMOVE the 3rd item if more than one item as been selected (>1).  If you want to show only if they selected more than one item at Q7, then you would want to remove it if the sum of the Q7 checks is <2 not >1.
answered Nov 9 by Jay Rutherford Gold (21,685 points)
selected Nov 9 by jzu633
...