Have an idea?

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

Conditionally display a question

Hi,

I would like to display the next question only if the preceding question (which is multi select) has more than 1 item selected. Both questions are on separate pages.
asked May 18, 2016 by anonymous

3 Answers

+2 votes
Just a further slice of information.

When Sawtooth Software encounters a question where only one code is to be displayed from a constructed list, the question will be auto-skipped and the question will be populated with the value of the only list member in the constructed list.

Nice feature.

So if your 2nd page question is using a constructed list from your 1st page question, you won't need a skip at all. It will auto-skip.

If you are using a parent list in the page 2 question, it will always be displayed and a skip is necessary.
answered May 18, 2016 by Paul Moon Platinum (65,230 points)
+1 vote
Give the first page a skip that skips to the page users should go to if they don't see the second page.  Then just set the skip logic to this:

Begin Unverified Perl
my $count = 0;
my $i;
for ($i = 1; $i <= 4; $i++) {
    if (VALUE('SelectQ_'.$i)) {
        $count++;
    }
}
return $count < 2;
End Unverified


"SelectQ" should be replaced with the multiselect's name.  The "4" in line 4 should be replaced with the number of response options in the multiselect.
answered May 18, 2016 by Zachary Platinum Sawtooth Software, Inc. (91,200 points)
+1 vote
Hi, you can use predefined function "Numchecked" in this skip logic section

Numchecked(qname)<2 skip to next question
answered May 18, 2016 by Saurabh Aggarwal Gold (29,615 points)
Whoops, seems I forgot all about NumChecked.  I really need to learn all the built-in JS/Perl functions one of these days.
...