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 / No delegation warning ...
Power Apps
Unanswered

No delegation warning but it is not delegable

(0) ShareShare
ReportReport
Posted on by

Hi,

 

So I have removed the delegation warning on my code using the With Statement. However I found out now that it is not retrieving all the records. It is not delegable even though the warning is not there. Just tested this with 5 records to be sure.

 

indhaa_0-1651515051771.png

 

 

With ( {wFilterRecords: Filter(SP, 
 (ID=Value(IDFilterInput_2.Text) || IsBlank(IDFilterInput_2.Text)) &&
(FullName = NameFilterInput_2.Selected.DisplayName || IsBlank(NameFilterInput_2.Selected)))
 )},
 Switch(
 sortField,
 "Column1",
 Sort(wFilterRecords, "Column1", If(sortDirection,Ascending,Descending)), 
 "Column2", 
 Sort(wFilterRecords, "Column2", If(sortDirection,Ascending,Descending)) 
 ))

 

I tried like this too

 

With(
{wFilterRecords:SP},

SortByColumns( 
		Filter(
 wFilterRecords,
		(ID=Value(IDFilterInput_2.Text) || IsBlank(IDFilterInput_2.Text)) &&
	 (FullName = NameFilterInput_2.Selected.DisplayName || IsBlank(NameFilterInput_2.Selected)) 				
 ),sortField, If(sortDirection,Ascending,Descending)
 ))

 

 

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @indhaa 

    Yep, that would be the expected behavior.  Kind of like disabling the bell in a fire alarm.  Doesn't prevent the fire. 

  • indhaa Profile Picture
    on at

    Yah. there are some posts given this as a solution. 

     

    I thought my App was working and found it the hard way when it was not retrieving the latest records. So there is no way out of it, right. I have to use a collection?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @indhaa 

    Check out @WarrenBelz 's blog for some alternatives.  https://www.practicalpowerapps.com/delegation/power-apps-delegation-sharepoint/ 

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

    HI @indhaa 

    and thanks for the blog tag @Drrickryp ,

    The issue on the With() statement is that it is a "hidden" Delegation limitation and the Delegable filter in it still needs to return record numbers under your limit to get a complete set. In your case however you should be able to do this as this is the one occasion you can refer to fields dynamically.

    SortByColumns(
     Filter(
     SP, 
     (
     ID = Value(IDFilterInput_2.Text) || 
     IsBlank(IDFilterInput_2.Text)
     ) &&
     (
     FullName = NameFilterInput_2.Selected.DisplayName || 
     IsBlank(NameFilterInput_2.Selected.DisplayName)
     )
     ),
     sortField,
     If(
     sortDirection,
     Ascending,
     Descending
     )
    )

     

    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.

    Visit my blog Practical Power Apps

  • indhaa Profile Picture
    on at

    Hi @WarrenBelz 

     

    Sorry but I didn't get what you meant above. Are you saying it will work for me with my current code?

     

    My issue is the filter is not retrieving all the relevant records. I'm got a delegation error on the "sortField" variable which I was able to hide with With statement. Already my no of records is over 500. 

     

    In the meantime I'm going over your blog !!

     

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

    Hi @indhaa ,

    My error with the SortByColumns being not Delegable with the Variable - I believed it was. Testing here confirms you are correct (as well an If or Switch statement in there also not being Delegable).

    The issue is that your filter is otherwise Delegable and will return any number of records (100 at a time as you scroll though the gallery). Your variable sort field however is not, so cannot be used with this filter.

    A With() statement collecting a Table with a Filter is really a (very) temporary collection and is subject to the same (and non-warning) Delegation limit. It is an extremely good tool for "Pre-filtering" when you can get the Delegable output under you limit and then use non-delegable queries on the result.

    I think you may have to compromise with your filter if you want all of your records. You can of course use a single Sort on it.

     

    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.

    Visit my blog Practical Power Apps

     

  • indhaa Profile Picture
    on at

    Hi,

     

    With() Statement is very useful. You can make your code small and I think it fetch the result much sooner too.

     

    Since I have to use nested If too which is not delegable on the second If, I have to use Switch inside an If statement and remove the With() to make it delegable.

     

    Thanks for your help @WarrenBelz @Drrickryp 

     

     

     

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard