Thank you for your help.
The reason for my question is because the user has 2 different tables, one with the "normal" codes and another table with the barcodes.
So I wanted to know to search in one table or the other.
I will probably have to search in one, and if it doesn't exist, search in the other.
"I will probably have to search in one, and if it doesn't exist, search in the other."
This is the logical approach I personally would recommend, as in some cases, I am sure the operator will need to manually key a barcode.
eg, Label is damaged and the barcode won't scan and the PLU code cant be seen either.
International Barcodes are normally 8 or 13 digits in length. If the PLU Code Length is other than 8 or 13 digits, then that will tell you which
Field to scan first. Then you can always try the other.
Machines are are so quick these days, that doing a double scan will not be noticable, I should think.
Also as suggested by mc73, if you know which algorythim is used in the barcode, you can always try do a quick calc, to identify that the code is a PLU Keyed, or a Barcode. Typically a Barcode has "weightings" on each digit used to calculate the last digit - deemed the CDV "Check Digit Verifification Code".
eg, 1234567X where X is the CDV "may" be calculated using wighting of 121212etc
1 x 1 + 2 x 2 + 3 x 1 + 4 x 2 + 5 x 1 + 6 x 2 + 7 x 1 = 38
If the Base is 11, then the CDV will be 38 / 11 = 3 with a remainder of 5. In this example the CDV = 5 Barcode = 12345675
That is just an example - there are many different methods of calculating CDV depending on which was used.
en.wikipedia.org