So I recently deleted some rows of my table from the Cloud Database and using a process model, I tried to enter user values via a form. The primary key in my table is ID and the rows that I deleted had ID's = 4, 5
When I entered new values via a form, the new row generated in my table had an ID = 6 and not ID = 4
So how do I make changes in the XSD file so that my ID value starts again from 4 ?
Discussion posts and replies are publicly visible
You have to make changes in the database table itself. Reset your autoincrement to 4 using the following statement (for MariaDB):
ALTER TABLE table_name AUTO_INCREMENT = 4;
Make this statement part of your delete query
As you can see, when I created a new record here, its ID started as 11 and not as ID = 9, because I had deleted 2 records earlier, so how do I change my ID = 11 to ID = 9 so that my next entries go accordingly ?
Can you provide more context on why you want to do this? In general it's a good idea to not reuse the same ID after you delete it because each unique identifier should only be used once. Just as an example - suppose you created another table and referred to the ID in this table with a foreign key. If you reuse the same ID, it's unclear if the foreign key refers to the original value or the new value.
Hello leonclintonc,
From the Cloud database, go to operation and adjust the auto_increment box to.
Hope this helps.
To add, from a design perspective, this is why we use constants for our user-facing identifiers (such as Request Number #), which we can control via Appian with the Increment Constant node, and manual updates when necessary, leaving the database ID to only be used as the primary key, thus not mattering in user interface/reporting what this value is, if it skips sections due to removals etc - since as noted it can only be reset on the DB side.