Have an idea?

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

Constructed List Based on Check Box Grid Question?

I've got a Grid question in v8 with a Rows question direction. All column options are checkboxes (they must select at least one response per row). One of my column options is an Exclusive option:

Please select each form/product type that you purchased and select who you purchased the products for.

Body Lotion
Shower Gel
Fine Fragrance Mist
Eau de Parfum
Body Cream
Rollerball Fragrance
Shimmer Mist
Golden Sugar Scrub
Mini Eau de Parfum
Other (please specify below)

Did not purchase (EXCLUSIVE)
Gift for Under 16 Year Old
Gift for 16-18 Year Old
Gift for 19-24 Year Old
Gift for 25-39 Year Old
Gift for 40-59 Year Old
Gift for 60+ Year Old

I need to generate a constructed list for a follow-up question that contains ONLY row items that they did NOT select "Did not purchase (c1)."

I've tried switching question direction, etc. I was hoping ANE (Q4, r1_c1, 1) would work as it is a checkbox, but that didn't work.

Any ideas?
asked Nov 6, 2012 by anonymous

1 Answer

0 votes
I believe the list function you are using ANE only works for grid type questions that are radio, numeric, constant sum, ranking.

You could program some Perl in a constructed list as such ...

Begin Unverified Perl

if ((VALUE("Q4_r1_c2")==1) || (VALUE("Q4_r1_c3")==1) || (VALUE("Q4_r1_c4")==1) || (VALUE("Q4_r1_c5")==1) || (VALUE("Q4_r1_c6")==1) || (VALUE("Q4_r1_c7")==1) || (VALUE("Q4_r1_c8")==1))

if ((VALUE("Q4_r2_c2")==1) || (VALUE("Q4_r2_c3")==1) || (VALUE("Q4_r2_c4")==1) || (VALUE("Q4_r2_c5")==1) || (VALUE("Q4_r2_c6")==1) || (VALUE("Q4_r2_c7")==1) || (VALUE("Q4_r2_c8")==1))


if ((VALUE("Q4_r8_c2")==1) || (VALUE("Q4_r8_c3")==1) || (VALUE("Q4_r8_c4")==1) || (VALUE("Q4_r8_c5")==1) || (VALUE("Q4_r8_c6")==1) || (VALUE("Q4_r8_c7")==1) || (VALUE("Q4_r8_c8")==1))

End Unverified

This isn't quite the full code but you can see in the example you are checking the value of row 1 for columns 2-8 (as column 1 is the exclusive code), if any ticked then add product 1. Then you do the same for row 2 and so on until you get to the last row/product.

Sawtooth question - should there be a simple function like AIE for check box grids?
answered Nov 6, 2012 by Paul Moon Platinum (100,020 points)
Paul - This is VERY helpful. I am having a bit of trouble - my understanding of Perl is very poor.

I generated a constructed list for use in my follow-up question (Q5), and carried our your code as such, changing on the list name to pull from (my response options are stored in Q4RowList):

if ((VALUE("Q4, r2_c2")==1) || (VALUE("Q4, r2_c3")==1) || (VALUE("Q4, r2_c4")==1) || (VALUE("Q4, r2_c5")==1) || (VALUE("Q4, r2_c6")==1) || (VALUE("Q4, r2_c7")==1) || (VALUE("Q4, r2_c8")==1))  {
SSI finds no error in my code, but when I run the survey it skips over Q5 because it's not recognizing it as having any list options.

Can you help?

When you write things between unverified perl tags, we don't try to figure out what you are doing (hence the name unverified).  So, even if there are problems, we won't identify them.

In your code you have VALUE("Q4,r2_c2") where the name of the variable should be Q4_r#_c#
Got it to work! Thanks, Brian and Paul. Your help has been invaluable!