I have a Table with the Primary key set to type Integer and the AutoIncrement is set To YES. The Form has a “rebuild” fucntion that deletes all Records and the RePopulates the Data in the Table, After ReBilding, the “Entry” Value keeps on Incrementing First Rebuild Last entry = 100 Second Rebuild First Entry = 101 (Q1) How can I make the Entries Start at 1 after each Rebuild ? (Q2) Commit : Does this Statement Commit the whole Database or just the Current Transaction ? Maybe I should Commit After DeleteAll ?
From Onlinehelp: AutoIncrement Use this property to specify whether or not each field value should be automatically given a new number that is greater than the number given to the previous value. Applies to Fields of the Integer and BigInteger data type. Comments A table can only contain one field that has been defined as an auto-increment field. The numbers that are assigned will not necessarily be consecutive because: If you delete some records from a table, the numbers that are used in these records will not be reused. If several transactions are being performed at the same time, they will each be assigned a different number. However, if one of these transactions is rolled back, the number that it was assigned cannot be reused. If you add an auto-increment field to an existing table, it will automatically generate consecutive values and insert them into the table. If you enable the auto-increment property for a field that already contains data, there must be no zero values in the field. The AutoIncrement property does not work for C/SIDE temporary tables.
Just do it the Navision way: IF ENTRY.FIND(’+’) then Integer := entry.integer + 1 else integer := 1; COMMIT only stores the userdata.
Q1: You can’t do this. Use AutoIncrement when the sequence of the value is not important; It is mucn better than the FIND(’+’) pattern in such a case. (By the way, from 4.0 SP1 use FINDLAST instead of FIND(’+’). Q2: Not sure what you mean by ‘the whole database’, but in any case COMMIT will commit your own current transaction and release all locks held within that transaction.