Expression to avoid entering of the barcode not from the given list

Hi, I have a field for barcode scanning (I use a usb scanner). I need to prevent a user from entering a barcode which is not in the list (column Barcode, Table ‘Items’). I tried Data Validity (Valid if=), but it gives me a drop-down list in the field for barcode scanner.
Could you show me the direction, please?

Could you try a valid_if condition something like

IN([_THIS], Items[Barcode])


Thank you for your answer. I tried to use your advice, but I get a dropdown list in that field with all the barcodes I have. And I use this field to scan barcodes with a usb barcode scanner.
Is there any other option to forbid entering of the barcodes which are not in the list?

Please share the screenshot of that column’s settings

Here are the settings of the column for barcode scanner:


I hope this is the wight way to show the column’s settings…

Thank you. In the shared images by you, there is no valid_if setting. Basically, we wanted to know how you have entered the valid_if formula since the query is related to Valid_if.

The use of valid_if in bar code scanning is common. Even though in your case , I am unsure how the USB connected scanner will behave and if it has any specific additional settings etc.
Please refer to the post below wherein a barcode scanner Valid_if is used. The valid_if expression is different but just wanted to share that valid_if setting is common for barcodes. If it is meant to return YES/ No result, it should not display a list. The expression I requested, results into a YES/No result.

1 Like

Thank you for your answer. I examined the Valid_If Column Constraint article and the use of the function IN(). Unfortunately, I couldn’t find another example for my problem. And again when I use the valid_if condition IN([_THIS], Items[Barcode]) I still get a dropdown list. Here are the screenshots. The valid_if condition is set only for the first field BARKOD 1:

And here are the column’s settings with the valid_in condition:


Yes! Thank you very much for this link to the similar question. The adding of AND() is a solution of “valid_if” without a dropdown list.

AND(IN([_THIS], Items[Barcode]), TRUE)