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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ForAll update value on...
Power Apps
Answered

ForAll update value on each row in collection

(0) ShareShare
ReportReport
Posted on by

I have a collection where it captures the row number displayed in a gallery. If one row is deleted, I want to adjust the row number accordingly.

 

Current formula that applies the row number (in a text box):

If(!IsBlank(ComboBox2.SelectedItems) && !IsBlank(ComboBox1.Selected), Patch(ReviewerCollection, ThisItem, {LineOrder: If(!IsBlank(txtOrder.Text), txtOrder.Text, CountRows(ReviewerCollection))}),If(!IsBlank(ComboBox1.Selected), Patch(ReviewerCollection, ThisItem, {LineOrder:txtOrder.Text}))))

Result in LineOrder column is 1, 2, 3, 4...

 

But when row 2 is deleted, the LineOrder column is 1,3,4...  I want to be able to use ForAll (or UpdateIf) in order to adjust the LineOrder accordingly to 1,2,3. It sounds easy but I can't figure out what function to use.   

Categories:
I have the same question (0)
  • Verified answer
    Aethyta Profile Picture
    on at

    Finally figured this out using below formula on OnSelect property of the delete icon.

    Remove(ReviewerCollection, ThisItem);
    Clear(Counter);
    ForAll(ReviewerCollection, Collect(Counter, {RowNum: CountRows(Counter)+1, RowNumOld: Value(LineOrder)})); 
    ForAll(Counter, Patch(ReviewerCollection, First(Filter(ReviewerCollection, Value(LineOrder)=RowNumOld)), {LineOrder:RowNum}))

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard