Jump to content

Remove digits to make Barcode


Danovh

Recommended Posts

I need to make a USP-A Barcode, but the data file has 2 extra digits at the end.

How do I set a Rule to remove those digits at the same time making the USP-A Barcode and what font to be used?

Link to comment
Share on other sites

The easiest method is probably to use the USPA Barcode Rule built into FP. Select your field(s) for creating the code and use the default font, AdvFIM, then click the "Convert to JavaScript" button. Edit the second to last line which reads:

final_data = '<span><f name="' + Var6 + '">' + NormalizeEntities(MakeUPCABarcode(retstr)) + '</span>';

to instead read:

final_data = '<span><f name="' + Var6 + '">' + NormalizeEntities(MakeUPCABarcode(Left(retstr,11))) + '</span>';

I added the "Left" function to trim the final variable to 11 digits -- the default number of digits for a valid UPCA barcode (the MakeUPCABarcode rule generates the 12th check digit).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...