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 Apps
Answered

Delegation issue

(0) ShareShare
ReportReport
Posted on by 27

Hi,

I have an app where a user enters a case number into a textbox then presses a button and that button should load the case with its history.

Each update to a case is stored as a new item in a sharepoint list. Later when moving to production we plan to use an SQL table.

 

A case history and the latest update is stored as follows:

 

 

Set(
 CaseHistory,
 Filter(
 Sandbox,
 Sandbox[@CaseNumberText] = [@CaseNumberText].Text
 )
);
If(
 !IsEmpty(CaseHistory),
 Set(
 latestRecord,
 Last(CaseHistory)
 )
)

 

 

 

I've set Delegation to 1 to identify any issues then saved and published.

I've also added a test case to the sharepoint list via the app, then loaded what was saved and saved an update.

 

When trying to load I only get the original case item. When checking in PowerApps Studio the CaseHistory Table has only 1 record

But there's no Delegation warning in the app.

My columns in the sharepoint list are all single-line text, multi-line text and number.
Only the default sharepoint columns have datetime and person/group:

ModifiedDate and Time 
CreatedDate and Time 
Created ByPerson or Group 
Modified ByPerson or Group

 

Is there anything I'm missing? How to load with delegation to sharepoint/later SQL?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @szilvasidave ,

    If you have set your Delegation limit to 1, then the Filter in the first Variable statement will only return one record (the first matching, sorted in ID number). Your second statement will also return that record. If however you want to avoid any Delegation issues (your Filter is Delegable), you could do this

    With(
     {
     wHistory,
     Filter(
     Sandbox,
     Sandbox[@CaseNumberText] = [@CaseNumberText].Text
     )
     },
     If(
     !IsEmpty(wHistory),
     Set(
     latestRecord,
     Last(wHistory)
     )
     )
    )

     

    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.

  • szilvasidave Profile Picture
    27 on at

    Hi,

    Thank you

    Can the wHistory and latestRecord variables be used later in the app in this case? Will they not error out?

     

     

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @szilvasidave ,

    You cannot use wHistory - it only exists while the code is running. latestRecord however is a Global Variable that is available.

     

    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.

  • szilvasidave Profile Picture
    27 on at

    @WarrenBelz,

    I need access later in the app to the full case history table as well. The CaseHistory table is not expected to be bigger than 5-10 records, but the sharepoint list/ later sql table will have probably 5k-10k records

    I tried the following:

     

     With(
     {
     wHistory: Filter(
     Sandbox,
     Sandbox[@CaseNumberText] = [@CaseNumberText].Text
     )
     },
     If(
     !IsEmpty(wHistory),
     Set(
     latestRecord,
     Last(wHistory)
     );
     Set(
     CaseHistory, wHistory
     )
     )
     )

     

     

    I dont get any delegation warnings but the CaseHistory table still holds only the original case entry I made, it doesnt have the update to it.

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @szilvasidave ,

    You are trying to put a Table into a Variable - try a Collection

    With(
     {
     wHistory: 
     Filter(
     Sandbox,
     Sandbox[@CaseNumberText] = [@CaseNumberText].Text
     )
     },
     If(
     !IsEmpty(wHistory),
     Set(
     latestRecord,
     Last(wHistory)
     );
     ClearCollect(
     colHistory, 
     wHistory
     )
     )
    )

     

    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.

  • szilvasidave Profile Picture
    27 on at

    @WarrenBelz ,

    I have replaced the code with yours. Unfortunately I still only get the first sharepoint list item, but not the second one.

    As a test I set the delegation count back to 500 and then clicked the button to load the data and now it shows both.

    Then I set the delegation count back to 1 and now it shows only the first item

    I still dont have any delegation warnings

     

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @szilvasidave ,

    That is correct - as per my first post, setting your Delegation to 1 will simply only collect one record in the second Table item. Put it back to 500 (or up to 2,000 if you want) and you will get the records you need. A collection will only collect the numbers in your limit (and will not give any warning)

     

    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.

     

  • szilvasidave Profile Picture
    27 on at

    @WarrenBelz ,

    If I set the delegation count back to 500 & my sharepoint list has for example 25 000 items & I do a filter on it as we discussed then save it to a collection.

    What happens if the two items the filter should have returned are items 24000 and 24001?

     

    Will my collection in the app still contain these two items?

  • szilvasidave Profile Picture
    27 on at

    I think I get it:

    Delegation limit is this according to documentation:

    Power Apps imposes a limit on the amount of data that can be processed locally: 500 records by default.

     

    The confusing part is that PowerApps studio says this is a limit only for non-delegable functions, but doesn't specify that there would be a limit for delegable ones.

     

    The point is, whatever I do, the operators and functions I use should be supported for delegation and the data these data sources return should not exceed 500 records by default.

  • Verified answer
    WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @szilvasidave ,

    Yes, it is confusing, but think of it as the limit for local processing - if you set it to 1 and try to collect (which is what you are doing with a table value) locally, you will only get up to your limit.
    If you apply a Delegable filter to a gallery, it will display all matching items (although it does this in batches of 100 as you scroll down for performance reasons).

    I have done a blog on Delegation that may be useful to you.

     

    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.

     

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 739 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 268

Last 30 days Overall leaderboard