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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting alphanumeric data fields to Code39One Barcodes

Status
Not open for further replies.

Cherrel

Technical User
Dec 5, 2001
34
US
Guru's,

I'm trying to print bar codes of equipment, inventory, and locations with Crystal Reports 7.0. I'm using the Code39One bar code font. I know from previous usage of this font that I must first put an astrick in front and after the data field in order for the bar code scanner to understand the bar code. (Example: *C123456789*)

I have tried to convert the alphanumeric data field to this barcode but have had no luck:
(1) Attempted to use the NumberToCode39 function, but that only works on numeric fields.
(2) Created a text block and put an astrick in the beginning of the block and then dropped in the datafield and then put an astrick afterwords in the text block and it doesn't work.

Any ideas?

Cherrel.[ponytails]
 
I don't know about the asterisks, but it sounds like you would just use a standard font, such as a Arial and place a Asterisk, then place the field and set the font, then place an asterisk and make sure that the font is Arial again.

What didn't work?

-k kai@informeddatadecisions.com
 
The asterisks convert to bar code font, as does the alpha-numeric field, but it's almost as if Crystal puts spaces in between the asterisk(s) and the alpha-numeric field.

Thus, the scan is incorrect.

Cherrel.[ponytails]
 
Cherrel,

There is a StringToCode39 function, too. That should do exactly what you're asking.

Naith
 
Naith,

Yes, I looked at that function, also. But, it only supports the _ and 0-9 characters. My clients also have letters in their equipment names.

Thanks,
Cherrel.[ponytails]
 
Instead of dumping the field in a text box, why don't you dump it into a formula like:
Code:
"*"+{YourString}+"*"
You'd have to use ToText on non-string fields. But it should eradicate your space anomaly.

Naith
 
Naith,

All I can say is, "YOU DA MAN!" [thumbsup]

I can't believe that I didn't think of doing that. I knew that it should have been something very easy....

Thanks so much!
Cherrel [ponytails]
 
I have one thing to add to Naith's post. If you have any embedded blanks that you want to retain in the bar code you must change them to underscore (_) characters before converting to 3-of-9 barcode, this can be performed using the Replace function.
 
hi,
i have a question for danENW. i am having the exact same problem tht u mentioned.... that is converting embedded blanks to barcodes. i tried using the replace function but tht gives me an error saying it should be a boolean function although it already is. if u kindly tell me the proper syntax to use for such a thing tht would be great.
T
 
I guess that I spoke a little too quickly, the Replace function first appears in CR8. The syntax for the Replace function is availble in the online help there.

If you are using an older version of CR then you are forced to perform the search and replace your self; which is not an easy task given the lack of looping constructs (also new with CR8).

You would need to use the older CR string functions of InStr to locate a blank and then split the string using the Mid (or Left and Right) function(s) removing the blank in the process. Then concatenate the two substrings with an underscore where the blank used to be. This process needs to be repeated for each blank in the original string, not an easy process when looping is not available.

There may be a third party UFL that performs the search and replace operation of the CR8 Replace function that works for the older versions but I have not looked.

I hope this helps, good luck.
 
I'm having the same problem also. I can't find a example of exactally how to code the replace function. Can anyone look at this and tell me how it should be written? Replace ("*" + Trim(({CusCushionInv.BaseModel} + "*"), " ", "_"))


All I wnat to do is replace a space with an underscore but I need to keep the "*" on each end because of the barcode. Can anyone help?

Thanks
 
Corinne,

Try using the following:

[tt]Replace ("*" + Trim({CusCushionInv.BaseModel}) + "*", " ", "_"))[/tt]

This will remove blanks both preceding and following your data field, it will then prepend and append the data field with asterisks, and it will then finally replace any blanks contained within your data field with underscores.

Good Luck,
 
DanENW,

Thanks for responding. I tried the line you gave me but when I check the syntax I receive an error that says "The remaining text does not seem to be part of the formula." The part that is highlighted is the very last ).
 
Naith,

I did that but it still does not replace the space with an underscore on the barcode label.
Any suggestions?
 
Corinne, can you show me an example of your data, together with a dump of your current formula?

Thanks,

Naith
 
Naith,
The current data that I need printed as a barcode is : 89-0312 1/2. I need to replace the space with an underscore so the example would be: 89-0312_1/2.

Currently the following formulas all pass the function check in Crystal. None of them do the replacement, when I use them to print the scan comes back as 89-0312 1/2:

"*" + Replace(Trim({CusCushionInv.BaseModel}), " ", "_") + "*"


Replace (("*" + Trim({CusCushionInv.BaseModel}) + "*"), " ", "_")



Replace(("*" + trim({CusCushionInv.BaseModel} + "*")), " ", "_")



Replace("*" + trim({CusCushionInv.BaseModel}) + "*", " ", "_")

Any ideas?
 
What barcode font are you using? If you set the font to a true type font, does the formula look like it's working?

All four of those formulas check out ok when I test them thusly:
Replace("*" + trim("89-0312 1/2") + "*", " ", "_")
Replace (("*" + Trim("89-0312 1/2") + "*"), " ", "_")
Replace(("*" + trim("89-0312 1/2" + "*")), " ", "_")
Replace("*" + trim("89-0312 1/2") + "*", " ", "_")


-dave
 
The bar code font is C39HrP24DhTt and yes I tried your suggestion & changed the font to a true type and the replace does work. So I'm chasing the wrong thing. Any suggestions on why hte barcode won't scan the underscore?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top