New: TFORMer Designer V9.2 — easily design and print labels and forms. Explore the product →

H.B. Fuller Amazon BMW Pfizer Bosch Bayer Siemens GS1 Austria Solution Partner
Code Snippet: How Can I Create a Timestamp for a Unique Package ID?

Using timestamps is a workaround if you cannot use persistant serial fields. The following expression creates a 12-digit alphanumeric timestamp for a unique package ID (incremented with each print job).

CStr(Chr(65 + Year(Now()) % 26)) +
CStr(Chr(65 + CLng(Format(Now(), "MM")) - 1)) +
CStr(Chr(47 + CLng (IIF (Day(Now()) >10, 7, 0)) + Day(Now()))) +
CStr(Chr(65 + Hour(Now()))) +
Format(Now(), "mmss") +
Format(PrintedItems, "0000")
  • Converts year, month, hour to A-Z to save space.
  • Converts day to A-Z, 0..7
  • Includes the actual label copy as a 4 digit counter

Put this expressions into a calculated field like clPackageID (data type Text). If you use individual label copies calculate it per Record Copy.

8 Digit Version

With 8 digits, we can remove the year and the seconds and limit the serial part to 3 digits.

CStr(Chr(65 + CLng(Format(Now(), "MM")) - 1)) +
CStr(Chr(47 + CLng (IIF (Day(Now()) >10, 7, 0)) + Day(Now()))) +
CStr(Chr(65 + Hour(Now()))) +
Format(Now(), "mm") +
Format(PrintedItems, "000")

This auto-package id consists of a 5-digit timestamp (month/day/hour/minute) followed by a 3-digit sequence number. That means the number of items/pallets in one job is limited to 999 and the minimum time between print jobs must be 1 minute. The package id can repeat itself every year.

View in help center ›

Online Inquiry

Write an e-mail instead

For support or sales: edit your message and send it yourself. Sales enquiries are forwarded internally. Recipient: support@tec-it.com

Incomplete transfer: only first name, last name and e-mail can currently be copied. Other answers, full trial licence keys and files are not copied. Add your question below, omit full licence keys and attach files manually in your mail app.