Home > Blockchain >  ZPL GS1-128 barcode issue with Field Number variable and three identifiers
ZPL GS1-128 barcode issue with Field Number variable and three identifiers

Time:06-09

I'm having issues when generating a barcode template to be saved on the printer to be frequently recalled.

It's a GS1-128 barcode with three identifiers: 91(company internal information, 10(Batch number) and 90(Information mutually agreed between trading partners).

I'm creating the template using ^DF and ^XF to save and recall the format.

My code for the template to be saved is:

^XA
^DFE:TEMPLATE1.ZPL^FS
^FX Below is the top barcode build
^FX Position
^FO125,620
^Barcode formatting
^BY4
^Barcode generating code
^BCN,250,Y,N,N,D

^FD(91)^FN2 >8(10)^FN3 >8(90)^FN6 ^FS
^XZ

Then, recall the template and specify the field numbers (^FN2, ^FN3 and ^FN6) with the below code:

^XA
^XFR:TEMPLATE1.ZPL
^FN2^FD81773866^FS
^FN3^FD2130789610^FS
^FN6^FDC2^FS
^XZ

The intended result is to show a barcode similar to the below but with an additional identifier (additional pair of brackets and numbers).

Barcode intended result

Using this viewer Barcode actual result

If I replace the ^FNs with some dummy data I get exactly what I need though:

^FD(91)81773866>8(10)2130789610>8(90)C2^FS

enter image description here

Checking the error messages and the code I can obviously see that the ^FN1 is not delimiting correctly, is taking >8(90) in consideration, therefore, ignoring them. hence the reason why is only showing the '(91)' part on the start.

My question is, how do I generate the template for the barcode with three identifiers that is happy with the fact that will be recalled later specifying the Field Numbers please?

I haven't got a Zebra printer to try the zpl code yet.

CodePudding user response:

You cannot use ^FN inside ^FD...^FS. Here is what the ZPL manual says about it:

In a stored format, use the ^FN command where you would normally use the ^FD(Field Data) command.

For your example, you would need to use a single ^FN that contains the entire barcode text value.

In the saved format, you would have ^BCN,250,Y,N,N,D^FN2^FS

And when printing the label:

^XA
^XFR:TEMPLATE1.ZPL
^FN2^FD(91)81773866>8(10)2130789610>8(90)C2^FS
^XZ

Probably not the data encapsulation you were looking for, but it's the best that ZPL can achieve.

  • Related