Link to home
Get AccessLog in
Avatar of Tim Ragan
Tim RaganFlag for United States of America

asked on

Code 39 Barcode font translates incorrectly

I'm working with SQL Server and Crystal Reports Version 8.5.   I am printing several fields as readable fonts and the same values in code 30 font.   Four of the five fields scan as I expected.  The formula I am using is "*"+{table_name.field_name)+"*".   The field I am having problems with is data coming out of a memo field.   I accessing the data via a view I created.  I converted the memo to varchar.    The data in the memo field is:  No:MTR-12345 Qty:2.   When I scan the bar code I get:  N**MTR-12345Q***2.   I have the scanner set to code 39 full ASCII.  Any help is appreciated.
Avatar of DansDadUK
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of Tim Ragan


I'm unsure as to how I will solve this problem even though I understand it now.   Thanks.
>> ... I'm unsure as to how I will solve this problem ...

You just need a more complex formula, where you check each character in your input data against a table of (128) values which maps each input character to the required output characters, or characters.
As the Code 39 extended repertoire is exactly the same as the basic ASCII coded-character set, just use the character-code (returned by functions such as Chr$()), associated with each input character, as an index into the table; input characters with character codes of 128 - 255 would obviously be errors.

E.g. "a" has ASCII character code 97, so the 98th entry in the table (indexed from zero) would indicate that the required output characters are "+A".  

I don't use either SQL Server or Crystal Reports, so can't offer any more specific advice.

.., and it seems that the start/stop characters must be encoded as "/J" instead of "*" to indicate use of the extended Code 39 variant.
So the 43rd entry in your table (for input character code 42) would map to "/J".
There data in the field will be of various lengths and character types.  The first three characters of any record will always be No:   Anything can happen after that.  If I understand your reference to 43 entry be the character count in the field.
>> ...  reference to 43 entry be the character count in the field ...

No; 43rd entry in (constant) table in your mapping function.

I was perhaps over-simplifying things when I said "You just need a more complex formula".

What you actually need is some sort of function.
As I stated before, I have no knowledge of either SQL Server or Crystal Reports, but I assume that one or the other may provide some sort of scripting language, with which you could write a suitable mapping function.
Thank you