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 / Delegation warning - F...
Power Apps
Answered

Delegation warning - ForAll

(2) ShareShare
ReportReport
Posted on by 119

Hi team,

My Power Apps gallery is supposed to display order data based on a filter condition.

Previously, it failed to load data during the first launch due to a delegation warning.

 

I’ve updated the formula, and there are no more delegation warnings now.

I’m using a Premium license.

 

Can I confirm that this issue won’t happen again in future launches?

Appreciate your clarification!

 

Thank you and have a great day.

 
With(
    {
        orderSeq: Filter(
            SortByColumns(
                Orders,
                 "CompletedTime",
                SortOrder.Ascending,
                "TimeCreated",
                SortOrder.Ascending
               
            ),
            Status = "Urgent" && (Progress = "Order Received" || Progress = "In Preparation" || Progress = "Delivery")
        )
    },
    ForAll(
        Sequence(CountRows(orderSeq)),
        Patch(
            Index(
                orderSeq,
                Value
            ),
            {RowNo: "U" & Value}
        )
    )
)
Categories:
I have the same question (0)
  • MS.Ragavendar Profile Picture
    6,961 Super User 2026 Season 1 on at
     
    Avoid using with() + Index() for large database updates, by adding Row No column during a separate collection.
     
    ClearCollect(
    collectionName,
    AddColumns(
    Filter(
                SortByColumns(
                    Orders,
                     "CompletedTime",
                    SortOrder.Ascending,
                    "TimeCreated",
                    SortOrder.Ascending
                   
                ),Status = "Urgent" && (Progress = "Order Received" || Progress = "In Preparation" || Progress = "Delivery")),
    "RowNo", "U" & Text(CountRows(collectionName)+1)
    )
    )
     
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • WarrenBelz Profile Picture
    155,291 Most Valuable Professional on at
    Delegation warning or not, what you have is still subject to your Data Row Limit as With() is a "local" (client-side) function (effectively a Collection) and its output has the same limitations (so your ForAll statement will only execute on the first (Data Row Limit) records returned by the Delegable filter (which will be executed fine by the data source).
    Unfortunately AddColumns is in the same category - it is also a local function and will only add the column to the same number of records from the filter's output.
     
    You do not get a Delegation warning on either as they are never sent to the data source - they only act on what comes back.
    So in short, you cannot use either to add a column on record sets bigger than your Data Row Limit and receive the total result back without maybe venturing into the area of large collections.
    How many records do you expect to be returned from your filter ?
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • AR-03030545-0 Profile Picture
    119 on at
     
    Do I need to add a collection somewhere else first? 
     
     
    Does that mean my code somehow is still non-delegable?
    Just fyi, my team and I plan to do auto-archive (by using Power Automate, maybe) as our backup plan if the code I provided is not suitable to be used for large database. 
  • WarrenBelz Profile Picture
    155,291 Most Valuable Professional on at
    A collection is also limited to your Data Row Limit. You could read this blog of mine which may explain some of it better.
     
    There are many functions that never get sent to the data source by Power Apps, but are processed locally - so I guess you can say they are not Delegable. These include With, Add/Drop/RenameColumns and GroupBy/Ungroup to name a few. ForAll also can have restrictions on each iteration if you are gathering data with a filter.
     
    The filter you initially posted in the With() statement is Delegable and will return matching records. If you put this filter (only) as the Items of a gallery, you would get all matching records (actually 100 at a time which will resolve as the user scrolls down) with no limit. However when you take that filter output and put it inside a Collection, a With output or want to AddColumns to it, Power Apps will only action record numbers up to your Data Row Limit out of this output (as this is all you can process locally).
     
    So to summarise, the actual total number of records you have in your data does not matter - the restriction applies to the number returned by the filter - if this is less than your Data Row Limit (maximum 2,000), then all will work as expected.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
    Buy me a coffee
     
  • AR-03030545-0 Profile Picture
    119 on at
     
    Understood your explanation. But does that mean I can still workaround with purely or fully using Power Apps as a method to solve this? Like I mentioned from previous response, we might want to implement auto-archive using Power Automate but I would like to know if we can solve this by using only Power Apps code.
     
    Plus, we cannot change the Data Row Limit?
  • SebS Profile Picture
    4,805 Super User 2026 Season 1 on at
    It might be easier and more reliable to move this logic to Power Automate to avoid any delegation or performance issues in Power Apps.
    Here’s a quick outline of the actions you can use in the flow:
    •     Trigger – PowerApps (manual trigger)
    •     Get items – from your Orders list
    •     Filter array – to include only records with Status = Urgent and Progress in the selected states
    •     Sort array – by CompletedTime and then TimeCreated
    •     Apply to each – to generate row numbers (RowNo) using an incrementing variable
    •     Return value – back to Power Apps (e.g., as JSON if needed for a collection)
    • Or update it direct to SharePoint
  • WarrenBelz Profile Picture
    155,291 Most Valuable Professional on at
    Yes you can use Power Automate, however you are going to need to convert all Filter formulas to the Flow format, which is going to get complex with what you have. @SebS has provided some framework on this You would the need to use AddColumns or Patch on the returned record set.
  • AR-03030545-0 Profile Picture
    119 on at
    Hi @SebS@WarrenBelz. I am sorry for the late response as I am on leave.
     
    I don't really understand this part:
    •     Return value – back to Power Apps (e.g., as JSON if needed for a collection)
     
    Does the return value here means the Row Number? Hence, I need to use AddColumns or Patch on this Row Number inside the Power Apps code?
    And if I were to implement the flow that Sebs provide for example, does that mean I need to remove all of the ForAll() function?
  • WarrenBelz Profile Picture
    155,291 Most Valuable Professional on at
    You would be getting back some JSON, which you can make into a colleciton to then apply your code to. As the collection is not coming from a data source query, your Data Row Limit should not apply. If you want to head this direction, I will leave you with @SebS who has already posted some of the groundwork.
    To be honest, I would be trying to keep the data returned under 2,000 records so you can do it all in Power Apps.
     
  • AR-03030545-0 Profile Picture
    119 on at
     
    May I know your insights on this? Because based on the explanation given, my assumption is, it is impossible to work around or do it all in Power Apps if data returned is more than 2000.
     
    Also, let me know if I understand this correctly - by data returned is less than 2000, does that mean filtered data less than 2000?
     
    In my case, we are expecting to receive around 90 orders for one day, and around 2700 for a month after doing some estimation calculation. 
    And if they undergo this filter, I don't think they will go beyond more than these 90 orders. Because 90 orders consist of Urgent, Normal and Pre-Order. For example, 10 orders could be under Urgent, 10 under Normal and another 10 under Pre-Order. Hence, I don't think this would affect each of these Status galleries.
     
    Because it's not like all 2700 orders are under one single status, instead they came from any of these three.
     
    Let me know if my logic or understanding is correct or wrong.

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 644

#3
11manish Profile Picture

11manish 626

Last 30 days Overall leaderboard