KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Changing the starting number of the sequence number
PRODUCT: 4D | VERSION: 2004.1 | PLATFORM: Mac & Win
Published On: May 27, 2005
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

You can change the starting number that is returned by the Sequence Number command by using the Set Database Parameter command and by providing a seed number with the command. The Sequence number command returns a non-repeating number (unique for each table) that is incremented for each new record created for the table. By default, the sequence starts at 1. One way to change the numbering is to use the Set Database Parameter command. This command allows you to change various internal database parameters. To modify the current unique number (last number used) for the table, you pass the table, selector number 31, and the value which will be considered as the last number used. For example, the code below will change the current number of Table1 to 50 making the number returned by the sequence number to 51:

Set Database Parameter([Table1];31;50)

Another way to change the starting number is to provide a seed number which is the difference between the starting number desired and 1. For instance if you want a sequence number starting at 100, you add 99 to the Sequence Number statement:

[Table1]FieldNum1:=((Sequence Number([Table1])) +99)