Select to view content in your preferred language

Syntax for constraint column in Survey123Connect?

365
2
Jump to solution
03-03-2025 01:26 PM
SusanWS_nysm
Occasional Contributor

Hi,

I have an integer question for which the answers can only be: 1, 2 or 3. It is not a required question (its within a repeat) so I have the default set to zero to avoid calculation errors (several questions with these answers -- calculation question with a sum divided by the count).

I have used the "spinner" for the appearance of the question, and the default, "0," shows up when I view the form (I haven't published it yet), but when I hit the plus sign, I can continue past 3 (4, 5, 6, etc). Here is what I have in the constraints column for this question:

. = 1 or . = 2 or . = 3

Is this the proper syntax, or am I missing something? 

Thank you in advance!

-Susan

0 Kudos
1 Solution

Accepted Solutions
SusanWS_nysm
Occasional Contributor

Okay! I "solved" the problem on my own -- apparently, there are different ways of evaluating constraints - in the form upon entry, OR upon submission of the survey. The syntax above is correct. I was also only testing the survey within the Survey123 Connect environment as well, which may not entirely behave as survey form on in the field app.  I published a test survey with an integer question with all the above parameters, downloaded it to my phone, and tried to enter the number "4" -- and it would not let me -- and it displayed the constraint-message as well ("Please enter 1, 2 or 3"). 😉

View solution in original post

0 Kudos
2 Replies
SusanWS_nysm
Occasional Contributor

Okay! I "solved" the problem on my own -- apparently, there are different ways of evaluating constraints - in the form upon entry, OR upon submission of the survey. The syntax above is correct. I was also only testing the survey within the Survey123 Connect environment as well, which may not entirely behave as survey form on in the field app.  I published a test survey with an integer question with all the above parameters, downloaded it to my phone, and tried to enter the number "4" -- and it would not let me -- and it displayed the constraint-message as well ("Please enter 1, 2 or 3"). 😉

0 Kudos
SusanWS_nysm
Occasional Contributor

And, I forgot to add, the "appearance" column/field must be left blank -- the constraint won't work with the spinner (or calculator, etc.)

0 Kudos