Prevent duplicate values entries in roster

Dear SurveySolutions,

I would like to know if there is a way to prevent the enumerator from entering the same value for a variable, at different iterations of a roster.
In my specific case, I want to ensure that the enumerator scans different sensor barcodes, at each iteration of the sensor loop. To summarize, I want to add a validation to implement that @current.qrcode!=(n-1).qrcode.

I have tried to apply the documentation provided (, but couldn’t find a solution.

Happy to clarify further and thanks in advance,

would you like to achieve global uniqueness, that is for all of your QR-codes in the interview there must be no duplicate value of variable qrcode within roster ROSTERX?

If so, since a Barcode question is a string variable, you could check it through:


.ToUpper() ensures that the strings are compared case-insensitive. Not sure if this is needed with Barcodes.

1 Like

Hi Peter, yes this is what I was looking for. Yet, I get the following error once I set the validation as you suggested (maybe I’m missing something - I’ve just started coding with SS) Pls cfr picture below of the error: what is ROSTERX?

This is my roster:


sorry, my description might not have been 100% precise:

ROSTERX is a placeholder for the name of your roster that question qrcode is placed in!

Got it, will give it a try. thank you so much.

  1. @peter_brueck Peter makes an important suggestion, that checking the whole list may be more important then checking two neighboring values. Almost certainly this is what Emanuele wanted.

  2. Distinct() is a very useful tool that is commonly used for such checks. It is part of C# and is formally described here:

  3. Distinct() is possibly an overkill here. A simple expression could be
    It does a good job of highlighting

  • only the duplicates,
  • all duplicates
  • ignoring the questions not answered yet.

You can use any letter instead of x

  1. It is a good idea to put some effort to make sure the values are really distinct. Peter shows the use of ToUpper() method to reach case-insensitivity, Survey Solutions already trims spaces in the beginning and end of values, but not in the middle, which you may trim yourself along with dots, commas, and other non-informative characters.
1 Like