Brian Dunning's FileMaker Custom Functions

cfCode128 ( chaine )

Calculate optimized barcode symbols for shortest string length in Code 128 barcode font (Table B and C Alpha-numeric and ASCII punctuation symbols only, no special command codes from Table A)

  Be the first to rate this function Log in to vote

Nathan Brand   Nathan Brand - Show more from this author
Gunntech Mfg. Inc. / Bullet Tools
http://www.bullettools.com

Share on Facebook Share on Twitter

  Sample input:
cfCode128("Barcode123456")
  Sample output:
ÑBarcodeÌ,BX*Ó

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Calculate optimized barcode symbols for shortest string length in Code 128 barcode font (Table B and C Alpha-numeric and ASCII punctuation symbols only, no special command codes from Table A). Filemaker 18 required (may be compatible with later versions too).



Beware that there is an older version of the code128.ttf font being distributed which has a different mapping for the control characters. I recommend deleting all old code128 fonts and installing the one from the OpenBarcodes project if you plan to use this script as-is.

My testing with this barcode font showed that a font size of 32pt or larger can be read reliably at various distances with a WASP brand USB barcode reader, but smaller than 30pt is almost impossible for the scanner to read at any distance. Do include at least 1/4" of whitespace before and after your barcode so that your scanner can read it appropriately.

cfCode128(chaine)
chaine: string to be used as a barcode.

Use with Code128.ttf version 2.0 as provided by GrandZebu in the OpenBarcodes project
https://sourceforge.net/projects/openbarcodes/


Version 1.00
Written By Nathan Brand Aug 2019
For Filemaker 18 or above

Based on the code/algorithm created by GrandZebu
https://grandzebu.net/informatique/codbar-en/code128.htm


Notable changes:
1. Non ASCII characters replaced with "0" zero characters
2. It runs in Filemaker!
3. An empty string will return the barcode for "0" with appropriate start, stop, and checksum.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: