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

Delegation Warning - SortByColumuns

Hi I'm getting my variable underlined in blue and this warning:

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

 

I'm using this formula:

SortByColumns(TestPeople,varSort,Descending)

 

Please advise,

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions

I got the answer...

 

With({wFilterRecords: Filter(NTSTestPeople,StartsWith(Name,txtFilterName.Text))},Switch(varSort,"crd79_name",SortByColumns(wFilterRecords,"crd79_name",If(blnSortDescending1,Descending,Ascending))))

View solution in original post

6 REPLIES 6
Dual Super User III
Dual Super User III

I'm assuming that TestPeople is a person/group column.  That's why you are getting the delegation warning.  SortByColumns is only delegable for certain types of columns.  A person/group column is a complex value and therefore isn't delegable.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

I'm not sure why it is not delegable.  It's just a text field on an entity.  

 

Also, what are my options here?  I don't what the sorting to fail when the dataset grows.

Thanks in advance.

Also, I'm not sure I understand the meaning of a complex data time.  The person column is simply a text field in a custom entity I created.  So I don't see what is 'complex' about it.

Dual Super User III
Dual Super User III

My answer was specific to SharePoint, not CDS.  If you are using an entity you created and the field is just a text field then it should work.  Complex fields would be things like option sets or lookups or objects with multiple properties.  People are normally a complex object field because they usually contain properties for Names, emails, etc.  Can you share the schema of the entity?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Sure, but first I noticed that the problem is with the 'varSort' variable.

 

SortByColumns(Filter(TestPeople,StartsWith(Name,txtFilterName.Text),StartsWith(Location,txtCity.Text),StartsWith(Code.Code,txtHobby.Text)),varSort,If(blnSortDescending1,Ascending,Descending))

 

if I replace the variable with a column name then the warning goes away:

 

SortByColumns(Filter(TestPeople,StartsWith(Name,txtFilterName.Text),StartsWith(Location,txtCity.Text),StartsWith(Code.Code,txtHobby.Text)),"crd79_person",If(blnSortDescending1,Ascending,Descending))

 

 

 

 

I got the answer...

 

With({wFilterRecords: Filter(NTSTestPeople,StartsWith(Name,txtFilterName.Text))},Switch(varSort,"crd79_name",SortByColumns(wFilterRecords,"crd79_name",If(blnSortDescending1,Descending,Ascending))))

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,890)