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

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 IV
Helper IV

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,880)