web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Auto number Priority c...
Power Apps
Answered

Auto number Priority column in SharePoint when User updates an Item

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

 

I have seen this question listed by other users but didn't come across a working solution. I'm trying to renumber priority column in SharePoint when user updates priority in power apps.

 

For ex. data set is: 

Item    Priority 

AA       2

BB        1

CC       3

 

User updates item CC to priority 1 then Item BB should become priority 2 and AA should  become 3

Updated:

Item Priority 

AA    3

BB     2

CC    1

 

Really need some assistance with this. Thank you so much for your time!

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at
  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Are you using a gallery to display item and priority data?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @NandiniBhagya20 

     

    Yes, I'm using gallery to display item and priority. Priority is a stand alone field on edit screen that user can use to update it.

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I did a sample for you.

    vxiaochenmsft_0-1660724797003.png

    vxiaochenmsft_1-1660724804757.png

    vxiaochenmsft_2-1660725402773.png

    Set(var,LookUp(LIST265,Title="D").Number);Patch(LIST265,LookUp(LIST265,Title="D"),{Number:Value(TextInput1.Text)});If(var>Value(TextInput1.Text),ForAll(ShowColumns(Filter(LIST265,Number<var,Number>=Value(TextInput1.Text),ID<>LookUp(LIST265,Title="D").ID),"ID") As this,With(LookUp(LIST265,ID=this.ID) As record,Patch(LIST265,record,{Number:record.Number+1}))),var<Value(TextInput1.Text),ForAll(ShowColumns(Filter(LIST265,ID<>LookUp(LIST265,Title="D").ID,Number>var,Number<=Value(TextInput1.Text)),"ID") As this,With(LookUp(LIST265,ID=this.ID) As record,Patch(LIST265,record,{Number:record.Number-1}))))

    vxiaochenmsft_3-1660725442049.jpeg

    vxiaochenmsft_4-1660725454849.png

    vxiaochenmsft_5-1660725503451.png

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-xiaochen-msft 

     

    Thank you for you assistance. I tried the solution and it works well for existing records. The problem I'm facing now is that when a user creates a new entry and the priority already exist, then it's not renumbering. I need it to renumber if user enters in existing priority and if it's new priority then simple patch that in.

     

    Thanks once again for your time. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @cwebb365 ,

    I'm back with another problem mentioned above. Any assistance you can provide with this will be extremely helpful and appreciated.  

     

    Thanks,

  • cwebb365 Profile Picture
    3,334 Most Valuable Professional on at

    Other solution seems a bit complex. But depending on if you are using a form to add new items or manual patch will determine how to handle it, but basically for an edit I would use the following BEFORE you patch in the update. 

     

    ForAll( Filter(SPLIST, Priority >= Value(TextBoxPriority.Text), Patch(SPLIST, Lookup(SPLIST,id = ThisRecord.id), {Priority: ThisRecord.Priority +1} 

     

    This bumps all the priorities up one equal or higher than what you are saving in. 

    This would work with new records as well. Just before Patching / saving the new one, you run that so it bumps everything out of the way, then when you add the new one it'll save it there. 

     

  • cwebb365 Profile Picture
    3,334 Most Valuable Professional on at

    This also assumes you'll never have more than a handful of "active" priority items that you can filter to with the updates etc. You don't want this growing into the hundreds, as performance will degrade over time. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 226 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard