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

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
Memorable Member
Memorable Member

@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 II
Helper II

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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,631)