Count multiple choice field selections

Count the number of selections in a multiple choice field.

The following expression returns the number of selections in a multiple choice field.

// the `|| []` at the end accounts for CHOICEVALUES() returning null when the field is blank
var selections = CHOICEVALUES($multiple_choice_field) || [];

// selections is an Array of the values
// selections.length is the number of selections

if (selections.length >= 3) {
  SETRESULT('There are at least 3 selections');
} else {
  SETRESULT('There are less than 3 selections');
}