cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
common_user
Helper III
Helper III

How to reset ID column

Hi all,

I have a list in sharepoint. In this list I have an ID column. When I add a new record in the data table, I have a new row and an incremental number in this column. 

I have a problem when I delete a row. For example, if I delete a row, I would like that the second number (in the picture below) it will be 26. Can you help me?

common_user_0-1651841124517.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@common_user ,

One approach is to have a numeric column then OnSuccess of your New Form

Patch(
   YourSPList,
   {ID: Self.LastSubmit.ID},
   {YourNewColumn:ID: Self.LastSubmit.ID}
)

but this really only gets you the initial number (the same as the new ID). You would then need a process to flag any deletions and use that number for the next one.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @common_user ,

It is simply not possible - SharePoint increments this number from the creation and adding of the first record and it cannot be changed.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @common_user ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Drrickryp
Super User
Super User

@common_user 

@WarrenBelz is absolutely correct.  The principle of not reusing ID numbers is a critical element of database design. Relationships between tables depend on these indexes and it would create chaos if they were reused and connected incorrectly.

JimmyWork
Super User
Super User

@Drrickryp You will need to create your own ID column, you will not be able to use the system ID column like @WarrenBelz said.

common_user
Helper III
Helper III

Hi @JimmyWork@WarrenBelz,

thank you for your support.

How can do this with a custom column?

Do you have any suggestions?

 

Thank you 

@common_user ,

One approach is to have a numeric column then OnSuccess of your New Form

Patch(
   YourSPList,
   {ID: Self.LastSubmit.ID},
   {YourNewColumn:ID: Self.LastSubmit.ID}
)

but this really only gets you the initial number (the same as the new ID). You would then need a process to flag any deletions and use that number for the next one.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (4,410)