Have an idea?

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

Counting Columns Selected in Grid Question (and setting variable)

I have a Row type grid question. Single Response
24 rows, 4 columns

I need to count how many times column 3 or 4 is selected and then assign that number to a variable.  

This needs to happen on the same page as the question because the very next question is set to skip/display based on the sum.
asked Mar 5 by Nwiggin Bronze (1,310 points)

1 Answer

0 votes
Best answer
Seems like you could actually do it a little easier and build a constructed list that adds if greater than 2.  Then you can base the skip on the next page if ListLength(ConstructedList)<N, no need to make a variable in real time with JavaScript, etc.
answered Mar 5 by Brian McEwan Platinum Sawtooth Software, Inc. (52,530 points)
selected Mar 5 by Nwiggin
I'm familiar with making constructed lists, but I'm not following what you are saying.  Can you give an example?
You want the question to skip based on how many rows get a 3 or a 4, right?  So build a constructed list to does that work for you with AIG(QuestionName,2). Then, if you want the next question to skip if less than 5 rows got a 3 or a 4, you can write ListLength(NameOfConstructedList) < 5.  This could be a preskip on the next question that says "Skip to Next Question" as the destination point.
Thank you. I figured it out!