Configuring Generated Docket Numbers

Structure link

Docket numbers in 2ic Pallets are structured with three distinct parts:

  • Prefix - Zero or more characters at the beginning of the docket number.

  • Number - Any number number of digits (0 to 9) in the middle section of the docket number.

  • Suffix - A single character (or nothing) at the end of the docket number.

For example a docket number with a 3-character prefix, 5 digit number, and a suffix may be 'ABC00345K'. A docket number such as 'SYD-722589126' could also be generated.

This structure is aligned with industry convention, and also enables complying with requirements from CHEP and other pallet companies.

Generating link

2ic Pallets has settings for structuring generating docket numbers. They can be generated automatically when keying a transaction, or on-demand with the keyboard shortcut Alt+n.

Settings are configured separately for each account. The prefix is fixed for an account while the number and suffix are calculated based on the system clock at the moment of generating the docket number.

Below are docket number settings in 2ic Pallets.

Docket Number Settings

The settings are:

  • Prefix is a fixed set of characters that appear at the start of every generated docket number.

  • Start number and End number define the range of numbers. The number of digits is set based on the end number, but the same number of digits is typically specified in the start number for clarity.

  • Suffix sequence lists all characters that can be used as the docket number suffix. When the range of numbers run out, it ticks over to the next suffix character and recommences numbering from the start.

  • Count of unique values is provided for convenience. If the range is 1 to 999999999, i.e. 99,999,999 unique numbers, and there are 23 possible suffixes, then the count of unique values is 23 * 99,999,999 = 2,299,999,977.

  • Increment milliseconds determines how often a new docket number is 'available'. For example setting it to 200ms means there are five new docket numbers per second.

  • Start date is set to specified to provide a starting point for generated numbers.

  • End date is provided for convenience, showing the date on which docket numbers will run out.

Setting the increment milliseconds to a low number reduces the likelihood of two users generating the same docket number. A warning is provided when saving a transaction with a duplicate docket number, so the second user to save would be prompted to generate a new docket number. However this is inconvenient and increases the risk of mistakes, so it is better to avoid it with a fast increment.

Time-based vs Sequential Numbers link

2ic Pallets version 2 generated sequential docket numbers, and this system where many numbers are skipped between transactions is quite different. The reasons for switching to a time-based system are:

  • It is faster. Docket numbers can be generated on the client device rather than having to query the server for the 'next' number.

  • It works offline. Transactions can still be raised and docket numbers generated if the internet connection is disrupted.

  • It enables automatic generation. This is disabled for sequential numbers because it requires getting the 'next number' (which increments it) when a generated docket number may not be required. This results in skipped numbers in the sequence and more quickly exhausting the range. Automatic generation has neither of these impacts on the time-based system.

  • It enables a distributed computing architecture. Having a single endpoint in the cloud to query the 'next' number prevents scaling to a distributed system.

  • It prevents duplicates being generated if reverting to a database backup. Restoring a backup (in case of a corruption) means the 'next' number is reset to an old number so duplicates are generated.

Last updated on 21/06/2024