FoxPro Programming
UPC Validation
Gravatar is a globally recognized avatar based on your email address. UPC Validation
  n/a
  All
  Nov 20, 2014 @ 06:30am
I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John

Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  Rick Strahl
  John C
  Nov 20, 2014 @ 12:32pm
There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  n/a
  Rick Strahl
  Nov 20, 2014 @ 02:20pm
Thanks Rick, I took a look at the library but it's about decoding UPC codes(from barcodes) and generating barcodes - not what I'm looking for.

I'm looking for a routine that tells me if a specific UPC is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your reply anyway.
John


There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John



Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  Rick Strahl
  John C
  Nov 21, 2014 @ 04:55am

I would think that you have to scan and parse the code in order to see if it's valid regardless. I think that's implicitly supported.

+++ Rick ---



Thanks Rick, I took a look at the library but it's about decoding UPC codes(from barcodes) and generating barcodes - not what I'm looking for.

I'm looking for a routine that tells me if a specific UPC is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your reply anyway.
John


There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John






Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  n/a
  Rick Strahl
  Nov 21, 2014 @ 05:28am
How do you parse this number Rick "992312323421"? I have no barcodes to scan i have no scanner. Besides how many barcodes have invalid UPCs?

Again, I'm looking for a routine(software) that tells me if a specific UPC(a series of digits) is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your help.
John


I would think that you have to scan and parse the code in order to see if it's valid regardless. I think that's implicitly supported.

+++ Rick ---



Thanks Rick, I took a look at the library but it's about decoding UPC codes(from barcodes) and generating barcodes - not what I'm looking for.

I'm looking for a routine that tells me if a specific UPC is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your reply anyway.
John


There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John






Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  Carl Chambers
  John C
  Nov 21, 2014 @ 09:10am
Hi John,

It's been a number of years since I dealt with this but I'm not certain that UPCs are generated or validated using any type of algorithm.
AFAIK, the valid UPC is a string of exactly 12 digits and is registered (I forget who the registering body is but this symbology started in the grocery industry). If you look at any UPC Code, you can see the digits printed with the bar code.

If I remember correctly, the first 6 digits are assigned to the item registrant (a manufacturer, for example) and the last 6 digits are assigned to the item.
I have dealt a lot with UPC Codes in a particular industry and the first 6 digits of every UPC for a given manufacturer are identical. I know of one manufacturer who provided private label packaging for their parts to be sold under other brands and ended up with several different UPC codes for each part - one for each private label vendor.

AFAIK, you cannot generate your own valid UPC codes - each code is a registered item.

If you just want to know if a UPC code is bogus (i.e. not registered), maybe there is web API for that by now. I have never had a need to validate a UPC code so I don't know about that.


HTH,
Carl


How do you parse this number Rick "992312323421"? I have no barcodes to scan i have no scanner. Besides how many barcodes have invalid UPCs?

Again, I'm looking for a routine(software) that tells me if a specific UPC(a series of digits) is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your help.
John


I would think that you have to scan and parse the code in order to see if it's valid regardless. I think that's implicitly supported.

+++ Rick ---



Thanks Rick, I took a look at the library but it's about decoding UPC codes(from barcodes) and generating barcodes - not what I'm looking for.

I'm looking for a routine that tells me if a specific UPC is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your reply anyway.
John


There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John







Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  n/a
  Carl Chambers
  Nov 21, 2014 @ 10:51am
Hi Carl,

Thanks for the very informative reply. This answers a lot of my questions, much appreciated!
John


Hi John,

It's been a number of years since I dealt with this but I'm not certain that UPCs are generated or validated using any type of algorithm.
AFAIK, the valid UPC is a string of exactly 12 digits and is registered (I forget who the registering body is but this symbology started in the grocery industry). If you look at any UPC Code, you can see the digits printed with the bar code.

If I remember correctly, the first 6 digits are assigned to the item registrant (a manufacturer, for example) and the last 6 digits are assigned to the item.
I have dealt a lot with UPC Codes in a particular industry and the first 6 digits of every UPC for a given manufacturer are identical. I know of one manufacturer who provided private label packaging for their parts to be sold under other brands and ended up with several different UPC codes for each part - one for each private label vendor.

AFAIK, you cannot generate your own valid UPC codes - each code is a registered item.

If you just want to know if a UPC code is bogus (i.e. not registered), maybe there is web API for that by now. I have never had a need to validate a UPC code so I don't know about that.


HTH,
Carl


How do you parse this number Rick "992312323421"? I have no barcodes to scan i have no scanner. Besides how many barcodes have invalid UPCs?

Again, I'm looking for a routine(software) that tells me if a specific UPC(a series of digits) is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your help.
John


I would think that you have to scan and parse the code in order to see if it's valid regardless. I think that's implicitly supported.

+++ Rick ---



Thanks Rick, I took a look at the library but it's about decoding UPC codes(from barcodes) and generating barcodes - not what I'm looking for.

I'm looking for a routine that tells me if a specific UPC is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your reply anyway.
John


There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John








Gravatar is a globally recognized avatar based on your email address. Re: UPC Validation
  Harvey Mushman
  John C
  Nov 24, 2014 @ 08:43am
Somewhere in my archives, I still have a copy of the original UPC specifications... back in those days I was working for a food company and we had to code everything for the retailers. What Carl said is correct, you must be registered. The code as I recall is two sets of five digits with some extra bars that make up the check sum. I think you can find something about this in Wikipedia.

As far as printing them once you have your registered number (the first five digits) there are several easy to use tools such as XFRX. You specify the font and pass it a value which in turn will print the barcode in the place on your form. The Type of Code (39, UPC, QR...) is specified by font which is most likely a separate TrueType or PostScript download.

Choosing the best code for your application has to do with what market your product will end up in. For that matter, I have seen over the past few years retailers using several codes on their products.

Going the other way of reading the code is a bit more tricky and actually something I'm still looking for in a solution to embed into my HTML5 application. I have found the Google Code project called Zxing is promising.

Here is a like to the library Barcode Routine

In this case you send the online routing an image file and it returns the value of its contents or a fail error. It seems to work fairly good but lacks when it comes to embedding into a browser. But this I mean, when you look at other commercial barcode readers like QR Reader, they have an interface that shows what your camera is looking at on the scree and as it is trying to read the code you are pointing at, it shows a horizontal bar moving up and down the view area. Once the image can be detected the screen changes to display the code. There is an error screen that is displayed after a timeout period is reached.

This sort of UI would be great to find in a JavaScript routine... the screen interface that passed to a call back function to decode the image and after X number of retries returned an error or a valid code. Oh well, that is my project and off topic here.... <g>

--hm


Hi Carl,

Thanks for the very informative reply. This answers a lot of my questions, much appreciated!
John


Hi John,

It's been a number of years since I dealt with this but I'm not certain that UPCs are generated or validated using any type of algorithm.
AFAIK, the valid UPC is a string of exactly 12 digits and is registered (I forget who the registering body is but this symbology started in the grocery industry). If you look at any UPC Code, you can see the digits printed with the bar code.

If I remember correctly, the first 6 digits are assigned to the item registrant (a manufacturer, for example) and the last 6 digits are assigned to the item.
I have dealt a lot with UPC Codes in a particular industry and the first 6 digits of every UPC for a given manufacturer are identical. I know of one manufacturer who provided private label packaging for their parts to be sold under other brands and ended up with several different UPC codes for each part - one for each private label vendor.

AFAIK, you cannot generate your own valid UPC codes - each code is a registered item.

If you just want to know if a UPC code is bogus (i.e. not registered), maybe there is web API for that by now. I have never had a need to validate a UPC code so I don't know about that.


HTH,
Carl


How do you parse this number Rick "992312323421"? I have no barcodes to scan i have no scanner. Besides how many barcodes have invalid UPCs?

Again, I'm looking for a routine(software) that tells me if a specific UPC(a series of digits) is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your help.
John


I would think that you have to scan and parse the code in order to see if it's valid regardless. I think that's implicitly supported.

+++ Rick ---



Thanks Rick, I took a look at the library but it's about decoding UPC codes(from barcodes) and generating barcodes - not what I'm looking for.

I'm looking for a routine that tells me if a specific UPC is valid or not, like...

if lIsUPCValid(m.cUPC)
...
endif

If I knew the rules of how a UPC is created I could write the code but cant find anything anywhere.

Thanks for your reply anyway.
John


There are libraries that let you read and write UPC barcodes. You can see if you can find something in .NET and use wwDotnetBridge to access it potentially. I have no first hand knowledge but a bit of searching might turn up something?

Here's one:
https://zxingnet.codeplex.com/

Again I haven't used it, but maybe worth checking out.

+++ Rick ---



I was wondering if anyone knows a way to validate a UPC code. I know it has something to do with CRC but I'm sure it's more complicated than that.

I'd also like to know how to generate a valid UPC, I know one can buy them, but I want to be able to create valid ones as well.

TIA
John










--hm--

© 1996-2024