Using ^SF command when populating a field defined in a recalled stored format

// Expert user has replied.
J Jason Humberstone 3 years 7 months ago
50 1 0

Hello,
 
I'm using a ZT420 printer with ZPLII.
 
Can anyone please tell me why my serialised field is incrementing fine with this code:
 
^XA
^XFE:PRODUCT.GRF
^FS^FT296,1056
^FDBL0000
^SFAAdddd,1
^FS
^PQ2
^XZ
 
However, when I use this similar code that uses a field defined in the PRODUCT.GRF stored format, the serialised field isn't incremented.
 
^XA
^XFE:PRODUCT.GRF
^FS
^FN1
^FDBL0000
^SFAAdddd,1
^FS
^PQ2
^XZ
 
The field definition in the PRODUCT.GRF stored format is:
 
^FT296,1056
^FN1
^FS
 
Is this expected behaviour? If not, can you tell me what I need to do to get the approach in the second piece of code working, please?
 
Thanks,
Jason.

Please Register or Login to post a reply

1 Replies

S Samantha Corn

Hi Jason,

The issue is that when you are calling the format, the ^FN1 command is only looking at the ^FD command directly after it, completely ignoring the ^SFAAdddd. If the field data format is always the same (two letters, four numbers), you can move the ^SFAAdddd,1 inside the stored format after the ^FN1. I did it with this basic format:

^XA
^DFR:PRODUCT.GRF^FS
^FO25,25^A0N,50,50^FDZebra Printer^FS
^FO25,75^A0N,50,50^FDSerial Number^FS
^FO25,150^A0N,50,50^FN1^SFAAdddd,1^FS
^XZ

Which I was able to print the correct serial numbers using:

^XA
^XFR:PRODUCT.GRF
^FS
^FN1
^FDBL0000
^FS
^PQ2
^XZ

CONTACT
Can’t find what you’re looking for?