Have an idea?

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

Multiple response questions in a loop

Hi all - this is a Version 8 question.

I have a bunch of statements in a loop.  Folk choose from a list of brands which they feel the statement applies to.  Mulitple response.

If someone chooses the same brand for all (quite diverse) statements, we want to flag them as dodgy.

What's the most elegant way of doing this?  I thought of one of the new loop functions, but that looks at the "brand" question itself rather than the top of the loop (the statements being asked).
asked Mar 11, 2013 by Marion Silver (5,240 points)
retagged Mar 11, 2013 by Walter Williams
It also refers to the questions within the loop as if they are always grid-style questions.  In the above example, the loop is called A4loop, the list name it runs off is A4Statements, the brand list is A4Ask, and the (one only) question itself is A4.

1 Answer

0 votes
I think I've answered my own question!  This sets the list A4Screen to hold "yes" if  the count for that brand equals the number of statements in the list.

Begin Unverified Perl

my $stmt = 0;
my $brand = 0;
my $check = LISTLENGTH("A4StatementsShow");
my $count = 0;

for ($brand = 1; $brand <= 21; $brand++)
{
  $count = 0;
  
  for ($stmt = 1; $stmt <= 15; $stmt++)
  {
      if(VALUE("A4_".$brand.".".$stmt) == 1)
    {
        $count = $count + 1;
    }
    
    if($count == $check)
    {
        ADD("YesNo",1)
    }
  }
}

End Unverified
answered Mar 11, 2013 by Marion Silver (5,240 points)
...