Have an idea?

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

Using NumChecked for skip logic on free format questions

Hi Support forum,

I have a series of 70 free format select questions. Each question has 1-3 items that need to be ranked on 2 separate 5 point scales.
So, for example, the first question has 2 items, in the variable name called OP1 and OP2, and the scales, called c1 and c2.

In the question, the variable are setup as radio type, and called:
Q1Q2_OP1c1
Q1Q2_OP1c2
Q1Q2_OP2c1
Q1Q2_OP2c2

The value of each will be 1-5, or blank, as the client does not want to require respondents to answer all of the questions.

My issue is that the client wants to term anyone that answers less than 70% of these questions. For skip logic, I had hoped I could use NumChecked  to return the number of radio buttons selected. But this doesn't seem to work, as these are not check boxes.

I also though GetValue might help me, but since the above variables can each have a value of nothing to 5, there is no value that would accurately represent 70% of all the questions.

Is there some way to do this without changing the variables to check boxes?

This was a last minute request by the client and they want to know if we can do it.

Thanks for any help you can provide.


Daniel
asked Sep 17 by Daniel F. (205 points)
One way around this is via a constructed list using Perl.

Create a parent list with each list member representing your 70 questions. Call it QuestionList.

e.g.
1: Q1Q2_OP1c1
2: Q1Q2_OP1c2
3: Q1Q2_OP2c1
4: Q1Q2_OP2c2
etc.

Create a constructed list which will use QuestionList as the parent list. Call this constructed list QuestionConList.

Your constructed list will look something like this ...
Begin Unverified Perl

 if (VALUE("Q1Q2_OP1c1")>=1 && VALUE("Q1Q2_OP1c1")<=5)
  {  
   ADD("QuestionList",1);
  }  
 if (VALUE("Q1Q2_OP1c2")>=1 && VALUE("Q1Q2_OP1c2")<=5)
  {  
   ADD("QuestionList",2);
  }  
 if (VALUE("Q1Q2_OP2c1")>=1 && VALUE("Q1Q2_OP2c1")<=5)
  {  
   ADD("QuestionList",3);
  }  
 if (VALUE("Q1Q2_OP2c2")>=1 && VALUE("Q1Q2_OP2c2")<=5)
  {  
   ADD("QuestionList",4);
  }  

End Unverified

You can now use ListLength(QuestionConList)<50 in your skip logic to judge whether a respondent needs to be terminated or not.

I'm not sure of all your question names, but if you have a naming convention that allows you to use "for loops" in the Perl script, that will cut back all the "if statements".
This solution and the one below from Zachary both do exactly what I needed. Thank you much.
Glad to hear Daniel!

1 Answer

+1 vote
 
Best answer
This skip logic will count the total number of answered fields and trigger if it's under a certain amount:

Begin Unverified Perl
my $answered = 0;
if (ANSWERED('Q1Q2_OP1c1')) {
    $answered++;
}
if (ANSWERED('Q1Q2_OP1c2')) {
    $answered++;
}
if (ANSWERED('Q1Q2_OP2c1')) {
    $answered++;
}
if (ANSWERED('Q1Q2_OP2c2')) {
    $answered++;
}
return $answered < 3;
End Unverified


You can repeat the collection of "if" statements to handle more questions.  If there's a nice pattern between your question names and variables, it could also be neatly written with a "for" loop.

Naturally, the "3" can be replaced with the number of fields to serve as a cutoff for the skip.
answered Sep 17 by Zachary Platinum Sawtooth Software, Inc. (123,825 points)
selected Sep 17 by Paul Moon
...