Create unique serialized carton ids at time of creating the print job Follow




I would like to create unique serialised carton ids at time of printing the labels using BT2016 R8 Automation. There are several PCs used for creating the labels and access to a central pool of serial numbers in not possible.


Barcode symbology is GS-128 with application identifier 93.

14 numerical digits in total are available.

Two digits are used for the application identifier and four digits are set aside for the sequencing the serial number.

This leaves eight digits that can be used to create the unique string to identify the particular print job.

Maybe the system time and a machine id or installation id can be extracted when the print job is created and used to create the unique string?


Your help is greatly appreciated.



Peter Thane
Comment actions Permalink

If you have X PCs then you could set the serial number in each one to start at a different number and increment by X each time a label is printed.

For the other 8 digits you could just use the date of printing.

eg (4 computers)

PC1 201812190001 then the next label would have serial number 201812190005 then .....0009 etc.

PC2 201812190002 then  201812190006

PC1 201812190003 then 201812190007

PC1 201812190004 then 201812190008


This system would work only if you are printing less that 9999 labels in total each day, but if it were more you could change to say a six digit date YYMMDD with a prefix or suffix for the computer such as 01 to 04 above or even have the two digits splits and at either end of the date date (01812191 for example) 

Jedler Edler
Comment actions Permalink

Hello Peter,

Thank you for the suggestion.

It works in a controlled environment which I do not have.

This is why a string made up from:

a) Prefix


     System.DateTime (maybe binary format?)

     Machine Id

b) Serial number sequence

     0001 to 9999

reset at the start of every print job

appears to give me the flexibility needed.

While I have been able to adapt a VB script to allow printing "Carton X of Y" by specifying Y at the beginning of the print job, I have not been able to change this print the above ID structure.



Peter Thane
Comment actions Permalink

Not sure where you would get the machine ID from but as a suggestion you could save a Notepad file in the C: root folder of each PC with a different 2 digit number in it  

You could then set the label up like this

  1. Add a field off the side of the Label and give is a name (from the Change Data Source Name button) on the Data Source tab. I have called mine PCIDCode and then set the Data Source type to External File and link this to the notepad mentioned above
  2. Next add a 2nd field, again off the label (so you can reference it but it does not print out - unless you want it showing in which case drag it back on to the label) and again name it (i used PCDateCode) and set this to a Clock Field and Date Sub-Type using a custom setting of YYMMdd
  3. Finally add a 3rd named field, as above, this time I used SerNo as the name, and make this your 4 digit sequential field that preserves the number of characters and resets to 1 at the start of each job.
  4. For your barcode add an Embedded Data data source sub-string with a value of 93 and then on the bottom left of the window use the New Data Source button to add a 2nd sub-string. Make this field a VB Script>Event Controlled Script and select the OnSerialise option. In the box in the middle type Value = and then select the PCIDCode from the Named Data Sources showing in the left column and then type <space> & <space> and this time select the PCDateCode string and repeat to add the SerNo.

The VB should look something like

Value = Format.NamedSubStrings("PCIDCode").Value & Format.NamedSubStrings("PCDateCode").Value & Format.NamedSubStrings("Serno").Value

Your barcode at print time will then be populated with the 93 AI and then these 3 values concatenated together.

For your X of Y you do not need to use VB instead you can

  • Add a text field on the label with an Embedded Date starting value of 1 but then in the Transforms set to serilaise and increment with a reset to 1 each print job
  • Again use the New Data Source button to add a second substring to this field making it again Embedded Data with a value of <space> of <space>
  • Then add a 3rd Embedded Data substring with a value of any number but give this one a name (like the above). I use NoofLabels. You can then close this field.
  •   Open your Data Entry Form and add either a Text of Number Entry box and link this field to the NoOfLabels 
  • On the File>Print screen click on the button to the right of the Number of Serialised labels data entry box and when the new screen opens choose the Get Quantity from Data Source option and then click on Data Source in the left hand column. Now click on the Change Data Source Name but instead of specifying name click on the NoOfLabels name in the list at the bottom to link the 2 fields together

Hopefully this will work for you


Please sign in to leave a comment.