cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrstian89
Helper IV
Helper IV

SortByColumns delegation warning

In my inventory app i have several ways of filtering my gallery list:

  • Three dropdowns
  • Two toggle buttons

 

To make this possible, I use If sentences to decide what is shown in my gallery depending on all these inputs.

I have 10+ ways of filtering the list. Each code looks something like this:

inputFilterStatus.Selected.Result = "All" && inputFilterCategory.Selected.Result = "All" && inputFilterDepartment.Selected.Result = "All" && !varToggle1  && !varToggle2 && !SpecialFunction && !SpecialFunction2,
    SortByColumns(Filter(Search([@'Equipment'],
    inputFilterSearch.Text, "searchcolumn1","searchcolumn2"),
    Location = myPlant),
    varSortOn,If(SortDescending1, Descending, Ascending)),

 
I have a delegation warning on the varSortOn, which is the sorting variable.
I need the user to be able to change what they want to sort the list by.

I have read old threads here and searched online, but did not find the solution.


Have tried If / Switch sentence where the varSortOn is now.

 

Any suggestion on how to be able to choose a custom sort column and remove the delegation warning?
Each If sentence (10+) has varSortOn at the moment.

3 REPLIES 3
RandyHayes
Super User
Super User

@mrstian89 

Your formula appears to be incomplete!

 

However, for the section you do show, SortByColumns is not delegable when you use a variable column name.

Also, Search is not delegable...so that is the base of the issue.

 

You can use the following to work around both the Search and SortByColumn delegation warning.

With({_items: Filter(Equipment, Location = myPlant)},

    SortByColumns(
        Search([@'Equipment'],
            inputFilterSearch.Text, "searchcolumn1","searchcolumn2"
        ),
        varSortOn,
        If(SortDescending1, Descending, Ascending)
    )
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks for the response!
Tried your code, but it still gives me two blue lines under varSortOn with the message:

Delegation warning. The "SortByColumns" part of this formula might not work correctly on large data sets.


Any suggestions? 🙂 

 

I am using Dataverse as DataSource. So the search function does not give me delegation warning, only the "sort variable".

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,564)