Have an idea?

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

Pre-skip a question if an unique response is selected more than once

Hi,

I have 5 checkbox questions with the same 11 response options.
How can I pre-skip a question if one of the 11 responses from all of 5(VIZ21, VIZ22, VIZ23, VIZ24 and VIZ25) questions is selected more than once?

I'm thinking something like
(VIZ22_1=1 AND (VIZ21_1=1 OR VIZ23_1=1 OR VIZ24_1=1 OR VIZ25_1=1)) AND (VIZ22_2=1 AND (VIZ21_2=1 OR VIZ23_2=1 OR VIZ24_2=1 OR VIZ25_2=1))..x11 
, but doesnt work quite well.
Can you help please?
asked Oct 14, 2022 by Liviu
edited Oct 14, 2022
Because they are check boxes they are ultimately 1s and 0s, so you could try summing them for the skip logic like the below

VIZ22_1+VIZ21_1+VIZ23_1+VIZ24_1+VIZ25_1>1
The only problem I've got is when I put "and" between this 11 conditions, the one which is selected more than once still appears
could you just have 11 different skip logic steps rather than adding them all into the same one?
I dont think I can, I need all on the same question

1 Answer

0 votes
 
Best answer
Please try this skip logic:

Begin Unverified Perl
# Settings
my $numberOfItems = 11;

# Run
for (my $item = 1; $item <= $numberOfItems; $item++) {
    my $found = 0;
    for (my $question = 21; $question <= 25; $question++) {
        if (VALUE('VIZ' . $question . '_' . $item)) {
            if ($found) {
                return 1;
            }
            $found = 1;
        }
    }
}
return 0;
End Unverified
answered Oct 14, 2022 by Zachary Platinum Sawtooth Software, Inc. (214,575 points)
selected Oct 14, 2022 by Dean Tindall
Server Error: Undefined subroutine &authlib7_0_30::GETVALUE called at (eval 25) line 3.
Do you know how to fix this?
Ah, you're using an older version of the software.  Try replacing "GETVALUE" with just "VALUE".
Thanks for help, but I need something in relationship with the other "VIZ", for example when VIZ21_1=1 AND VIZ21_3=1, Pre-skip, but if only VIZ21_1=1 and VIZ22_1=0 AND VIZ23_1=0 .. VIZ25_1=0, show the question and this for all 11 answers for all 5 questions
Sorry, I've edited my response.  Please try that.
...