About synchronization of Next Keys

Next Keys functionality allows long-running transactions to get a next value for a column entry, with or without a prefix, and without blocking other processes that are doing the same thing. These kinds of stored procedure calls can be set up using the Application Schema Columns Metadata form, in the Generator(s) field.

The application database includes a NextKeys table that lists the last value used for alphanumeric keys whose system-generated value can have a prefix. For example, customer orders can include a prefix such as "CO-", so the order numbers would be CO-00001115, CO-00001116, and so on. The value in NextKeys is incremented to determine the next system-generated value for the key.

Occasionally, the data in the NextKeys table gets out-of-sync with the contents of the other database tables that contain the key values. When this happens, the system displays "duplicate key" error messages.

To prevent this from happening, system administrators should periodically run the Synchronize Next Keys form. This form synchronizes the NextKeys table with the contents of the database tables that contain the key values.

The information on that form can help you determine if some values are not being used as planned. For example, if someone accidentally entered CO-40000 instead of CO-400 on a new customer order, you would run out of available numbers with that prefix much sooner than planned. If you catch it before more orders are entered, you could delete the problem order and add it back with the correct number.