Validating Roll Numbers

In my organisation we are using a survey which validates the roll numbers of all respondents in the survey (self administered). In order to identify the respondents by roll numbers and not mix up participants we want each respondent to re-enter the roll numbers (numeric) twice, only post which they can start with the survey.

Is there some way we can put in a condition where answer for these two questions have to be same (numeric) and only then they can move onto the other questions

Hi @anamikadutt,

Welcome to the community! You could do the same by using constraint and constraint_message as outlined in the image below:

In the survey tab of the xlsform:

Reference xlsform:
Roll Number (constraint).xlsx (10.4 KB)


yes. You have 3 options, first one is the easiest & best

  1. Define constraint with the second RollNr, as ${RollNr02} = ${RollNr01} (and a constraint_message).
    Update: Or as @Kal_Lam just wrote in parallel with . to reference: . = ${RollNr01}.
  2. Add an acknowledge item after the second RollNr with required = true and filtered by relevant ${RollNr02} != ${RollNr01}
  3. Add a note item after the second RollNr with required = true and filtered by relevant ${RollNr02} != ${RollNr01}. As notes are read_only, required here is a tricky use to block.

Main advantage of the first solution is that the user is still there, whereas with the other options has to move back to correct.
Of course, both RollNr items should be required.
Kind regards & happy and healthy New Year

1 Like

@Kal_Lam response pin points the precise solution to your query.

However, as long as the numbers are same, the form would move to the next question. It does not account for whether the number is a true roll number. I hope this was not the case on your query too


1 Like

This really helped. Thank you so much for this

1 Like

Yes it does. But thank you for pin pointing that out. However, if we have to pin point to a real roll number what could be the solution

In this case you need to address your form by a specific logic.

  1. Roll numbers are known in advance, i.e. they cannot change e.g. from let us say ROLL001 TO ROLL004

  2. You create a question where the constraint is only a number from the list

  3. You can then use the entire process explained by @Kal_Lam

Note: You cannot stop an interviewer from entering the same roll number more than once in different forms.


1 Like