Character Substitution Follow

0
Avatar
Legacy Poster

I have a named data source which is a database field. The format of the field is... "AAAAA AAAAAA AAAAA" where there could be 1-5 alphanumeric characters in each grouping. The Bar code needs to read as is but Human Readable needs to read as "AAAAA-AAAAAA-AAAAA". I tried to use a VBScript with the "Replace" function but when I close the function, it says there is an error and winds up not printing the Human readable at all on the label.

Any help would be appreciated.

The Syntax that I was attempting to use is... "OnProcessData"

Value = Replace(Field("GenSerLabel04654 XXXX.SerialLabel_CustPartNum"), " ", "-")

The error message that the script assistant reports is "The script did not read from the "Value" property, which means that the currently specified data source was completely ignored. Ths may not be what you intended."

2 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Is this a formatting just for the human readable? If so then you should just use the formatting template option under the "Human Readable" tab of the barcode object properties.

If you want this to be the value of the barcode as well then use the below expression in the OnProcessData VB script.

[code]
value = Replace(value, " ", "-")
[/code]

Note that "value" in the above expression relates to the current value of the data source. It is that which you wish to format, after sourcing from the database, and not the actual database field itself. Remember that the OnProcessData event essentially allows you to manipulate the value of the data source "value" prior to printing.
0
Avatar
Legacy Poster
Comment actions Permalink

Thanks Ian. I'm not using the "Human Readable" on the Bar Code field. It's easier for me to just use a straight Text field for Human Readable. But your solution worked for me. I'm glad it was easier than I anticipated. Thanks for your help.

Please sign in to leave a comment.