cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TrulsB
Advocate II
Advocate II

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:

 

SortByColumns(Filter(Serviceoppdrag;StartsWith(Tittel;TextSearchBox1.Text);Active=false);varSortColumn;If(
SortDescending1;Descending;Ascending))

 

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. 

 

 

 

 

22 REPLIES 22

Hi

 

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.

indhaa_0-1651512093204.png

 

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)))
    )},
 Switch(
        sortField,
        "Column1",
        Sort(wFilterRecords, "Column1", If(sortDirection,Descending,Ascending)),  
        "Column2", 
        Sort(wFilterRecords, "Column2", If(sortDirection,Descending,Ascending)) 
      ))

 

 

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

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (3,168)