top of page

64. Which "Select All That Apply" Answers Were Selected?

Description

How to determine which of the "Select All That Apply" multiple choice answers were selected (when "Select All That Apply" is activated.

Code

"«MCVar»"

"«MCVar::a, b, and c»"

SET NumVar TO COUNT( MCVar )

IF MCVar = "Blue"
AND MCVar = "Red"
// both Blue and Red were chosen
END IF

Explanation

When a multiple choice variable is set to allow more than one answer to be selected ("Select all that apply"), its results are returned as a list. By default, this is a multi-line list. The first line of code above returns this list. The second line returns the same list, but in a single-line format. The third line shows how to determine the number of answers that were selected using the COUNT model. The last section of code demonstrates how to test for more than one answer. This particular example will check to see if the person selected both Blue and Red.

If you want to parse out the individual answers, or in other words, have access to each answer in its own variable, place the answers in a REPEATed variable as described in Computation 65: Parse 'Select All That Apply' Answers.

bottom of page