Skip to end of metadata
Go to start of metadata


When printing a single label, the output to the label from a script appears to be correct, but when a quantity of more than 1 is printed, the field gets larger with each label printed and all or part of the value is printed repeatedly.


This issue is caused by using the Input field on the label for the output value. When a label is printed, the initial label reads the data from the drop file, socket request, or On Demand Print Form. Each successive label uses the value stored in memory from the last label printed instead of using the initial request. The script is able to alter these stored values when you print a label that has a new value for that field.

Input field = A
The script adds another A (A+A)
The script prints "AA" to the Input field

The Input value stored in memory is now "AA", so the next label will print "AAA", followed by "AAAA", and so on. This can be particularly frustrating when dealing with barcodes, as the second label often prints off the end of the label and is unreadable, and if there is no human readable this reason can be difficult to determine.


The solution is to make the Input field a non-printing field, and print the altered value to an "output" field so that the initial value for the input remains unchanged.

Bad Script
var input = label.fields.field.(@name=='Input').@data;
input = input + "A";
Good Script
var input = label.fields.field.(@name=='Input').@data;
input = input + "A";

Use Case

This scenario can be used intentionally to mimic an incrementing field.

var input = label.fields.field.(@name=='Input').@data;
input = (input*1) + 1;

This should only be used when control of when this value will increment is needed, otherwise using an incrementing field on the label is recommended.

Article Number



Loftware Label Manager 9.5 and higher


Any supported LPS family product environment