Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

SortByColumns and using variable sort columns and delegation

Hi, im using SortByColumn in a Gallery, and i am going to create buttons with different for different sort order, eg button for Title, Created, Location, Created by, Priority  Requester.  My variable is varSortColumn.


I use the set(varSortColumn,"Title")  to set the column name to sort by.

In the Item in the Gallery i use:




When i use a variable, and not the "hord code" name of the column i get an delegation warning. Is there a way to use variable without getting the delegation issue ?    When i use the column name, there is not any delegation problem, only when i use a variable. 








I tried With statement and it DOES clear the delegation warning but it doesn't retrieve all the records.

I tested by changing the limit to 5. It only retrieve 5 records.



This is what I'm trying


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



Frequent Visitor

Im getting the exact same thing, managed to get the with method to work but it does not get round the delegation issue


@JoshHudsy and @indhaa ,

Absolutely correct - you might read this blog of mine - the second dot point advises of this.

Helpful resources

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.


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
Users online (4,212)