Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxBarCode's 128 symbology problem 1

Status
Not open for further replies.

torturedmind

Programmer
Jan 31, 2002
1,052
PH
Hi All,

It's been a while since my last visit here.

Anyways, I have this:

Code:
SET PROCEDURE TO FoxBarCode ADDITIVE
SET PROCEDURE TO FoxBarcodeQR ADDITIVE
SET PROCEDURE TO gpImage2 ADDITIVE
PRIVATE poFbc, loFbc
poFbc = CREATEOBJECT("FoxBarcodeQR")
loFbc = CREATEOBJECT("FoxBarcode")

WITH loFbc
    .cSet128 = "*"			&& * - Auto, A - Set A, B- Set B, C - Set C
    .lShowHumanReadableText = .F.
    .nBarcodeType = 110			&& Code 128
    .nImageHeight = 100
    .nAlignText = 2			&& 0 - Left-aligned, 1 - Center, 2 - Right-aligned
ENDWITH

In my label, which I call immediately after the code above, I have an image control with control source "loFbc.BarcodeImage(ALLTRIM(TRANSFORM(TSample.Out_Qty, "99,999")) + " EA")". The label also have a QR code that works flawlessly.

The problem is in the generated 128 symbology. There is no problem when the TSample.Out_Qty is 9,999 or below. But when the said field is beyond that, there is where the problem show. If, for example, TSample.Out_Qty is let's say 41,875, the scanned value will always return 41,8750EA. I tested any other value and it always converts the space between the number and the "EA" string to zero (0) when the value is 10,000 and above. Am I doing something wrong? any insight/help is very much appreciated.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
I would start by being a bit more generous in your transform

Code:
TRANSFORM(TSample.Out_Qty, "9,999,999")

Otherwise at over 99,999 you are going to get **,***

Do you need the space between the value and the EA?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Thanks Griff for a very quick response.

The control doesn't need to be formatted past 99,999 as the out quantity barely reaches 50k. And yes, the space is required by the end-user.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Do you need the comma?
If not perhaps str() would work better?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi Kilroy. Welcome back.

I don't know the answer to your question, but I am fairly sure that there is no problem with the TRANSFORM(), or with the presence of absence of the comma. There is nothing in the way you are using TRANSFORM() that could cause the spurious zero to appear. You will need to look for the answer somewhere within the barcode object.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I wonder why you use gpimage, I think FoxBarcode makes use of vfpx gdiplusx, which is the far enhanced and further developer version of Cesar Chaloms initial gpimage libarary, I think he founded that vfpx project.

Looking at this from outside, not really knowing which version of FoxBarcode you use all I can see is [tt]TRANSFORM(TSample.Out_Qty, "99,999")) + " EA"[/tt] would give you a string without that 0, instead a space. So that 0 is added. Maybe no spaces are allowed? Does this library version need a code without spaces to translate into a barcode?

It would be good to upgrade to the latest VFP and gdiplusx/foxbarcode/foxbarcodeQR would likely work better for you.

Bye, Olaf.



Olaf Doschke Software Engineering
 
Hello good Sirs. Thanks for all your responses.

Sir Griff,
The end-user did not explicitly specified the need for the comma. But based on the format they submitted, a comma was there. Tried also STR() (<number exceeding 9,999 + " EA">) and the result was the same. If anyone was wondering, "EA" stands for East Asia where the out quantity is coming from.

Sir Mike,
Thanks. I was trying to get myself back into playing guitar again so I wasn't able to visit this forum more often. Anyway, that was what I suspect; the issue is in the class itself. I've also been reading if it allows space or not and if other devs also encountered the same issue but wasn't able to find any hint that would help me in my predicament. Still gonna read further.

Sir Olaf,
According to this, "FoxBarcode generates the images with the class gpImage2 of Alexander Golovlev (Russia) and Cesar Ch. (Brazil), based on GDI + and requires gdiplus.dll." Thus, the need for gpImage declaration. I'm also sure am using the latest version (ver 1.17)

I tried a version without the space between the number and "EA" using TRANSFORM and STR. The outcome was what everyone expect - no additional zero. I also tried all strings with space but no numbers and it was scanned without any problem. It could be that the class doesn't really allow space between a number greater than 9,999 and a string, I'm still not sure. I'm going to try and post my problem in VFPx and see if anyone there can confirm if this is a bug or not.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
OK, I note this dependency. Have you tried to find out whether online barcode decoders see that additional 0.

The barcode itself should encode only what you turn into the barcode, but hardware scanners can add to what they read back. I know barcode scanner configurations allow all kind of things like turning a barcode to keyboard input of a prefix+barcode+suffix and I wouldn't be surprised scanner could turn spaces to 0.

If a barcode decoder online or even your mobile phone with barcode app or native barcode recognition turn this to the expected output without the 0 you know the problem is not with FoxBarcode barcode graphic creation.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Thanks Sir Olaf for another hint. The barcode app on my mobile phone also scanned with the output having the "0". So after reading again the basics of code 128 symbology and reviewed my code, I decided to change this line
Code:
.cSet128 = [b]"*"[/b]			&& * - Auto, A - Set A, B- Set B, C - Set C
to this
Code:
.cSet128 = [COLOR=blue][b]"A"[/b][/color]			&& * - Auto, A - Set A, B- Set B, C - Set C
since I'm sure of what the code is going to contain and viola! No more "0" in place of the space. I think the problem is in the "Auto" parameter image creation. I tested the other sub-types and the scanned result is always good. I already posted this in the VFPX/FoxBarCode project and am still waiting for confirmation if this is a bug or not. Problem solved.

Thanks again good sirs for the un-ending support.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top