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 / Monitoring Forall loop
Power Apps
Unanswered

Monitoring Forall loop

(0) ShareShare
ReportReport
Posted on by 125

Hi All

I am just wandering if there are any way to monitor at which stage Forall loop is
So if I am updating 2000 SP list items - can I have a label which would show how many items already updated etc?

Shame we cannot updatecontext from within forall 🙄 
Thanks

Categories:
I have the same question (0)
  • romankorchak2 Profile Picture
    125 on at

    I think I found it - you can create 2 collections and collect new item into first one every time and collect to second one every time Forall passes certain amount of items. 
    So something like

    Clear(C1); Clear(C1); 
    ForAll(Filter(MySPlist,Country <> "GB") As it, 
     Collect(C1, {i:1}); 
     If(Mod(CountRows(C1),100) = 0 , Collect(C2,{i:1}) );
     Patch(MySPlist, LookUp(MySPlist, ID=it.ID),{Country:"GB"} ) 
    ) 


      

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @romankorchak2 

    The reason you cannot use UpdateContext and other actions in a ForAll is that ForAll is a function that creates a table.  It is not a For Loop like in some development platform.  

    When you use the ForAll backward like you have, it will still attempt to function, but your performance will be quite horrible as you are invoking the Patch function on a datasource over and over and then performing a lookup in it as well.  All will work, but the performance will be poor.

     

    Your formula should have been this for better performance and to utilize the ForAll properly:

    Patch(MySPlist, 
     ForAll(Filter(MySPlist,Country <> "GB") As it, 
     {ID: it.ID,
     Country:"GB"
     } 
     ) 
    ) 

    This formula produces a Table (which is what ForAll is for) and passes that to the Patch function which will then intelligently update all the records from the table provided to the datasource.

     

    However...you might also want to consider not doing any of this and simply using the UpdateIf function.  Then your formula will be:

    UpdateIf(MySPlist, Country <> "GB", {Country:"GB"}) 

     

    Keep in mind that all of the formula (including the formula in your last post) are all limited by the record limit of your app.

     

    I hope this is helpful for you.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 547

#2
WarrenBelz Profile Picture

WarrenBelz 444 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard