Subject Re: [firebird-support] Barcode into SQL statement
Author Helen Borrie
At 10:27 PM 19/09/2006, you wrote:
>Hi,
>
>I have a specific request from few my clients to generate internal
>barcodes into some tables.
>That is not a big problem because I have a rulem for this action and
>I get 12 digits from EAN13 barcode standard, BUT checksumm is a
>problem.
>Math is: all even numbers are put in sum and that sum is multiply
>with 3 and all odd nubers are put in sum and add to a previous
>result. Aftre that you must find first nuber delimited with 10 and
>difference between that nuber and sum nuber are checksum.
>So is there any way to make math like that with SQL statement,
>please? :-?

Store all 13 digits, not just the 12 encoded ones. Most barcode
reading/printing devices come with software that calculates the check
digit appropriate to the barcode format you select and provides a
data interface. Don't "keep a dog and bark yourself". For input,
use your barcode software to generate the input string (which will
include calculating the 13th [checksum] digit.) Barcode readers read
the whole barcode (including the check digit) so you don't want to
slow down your searches by using expressions as search arguments.

If you want to do it the hard way, and calculate the checkdigit every
time, then you could write a UDF.

./heLen