Add error message to prevent choosing "none" and other options in multiselect Q using "!ContainsAny"

Hello,

In every data collection surveyors often make the mistake of choosing “none” AND other options choices in multi-select questions. I would like to prevent this as much as possible, by adding a validation error message. For a multi-select tick-box question, I have the following validation rule:

Validation condition 1: “self.!ContainsAny(0) && self.ContainsAny(1,2,3,4,5,6,7,99)”

Error message: “VOUS NE POUVEZ PAS CHOISIR AUCUN ET AUTRE CHOSE AU MEME TEMPS” (You cannot choose none and other options at the same time"

Where 0 is “none”. This doesn’t seem to work (I get error messages when I compile). Is it possible that the syntax for !ContainsAny is wrong?

Thanks!

Elena,

you have invalid syntax. A dot followed by an exclamation mark is always wrong. Try (if 0 is the code for none):
!(self.Contains(0) && self.Length>1)

Sergiy

2 Likes