cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jannis
Level: Powered On

Delegation Function nested in non-Delegation function

I have a Question regarding delegation with a sharepoint table.

In Sharepoint the Search function is not delegable, but the Filter function is. In my application it is very important for the Filter function to run on serverside because the table is very large, the Search function can run locally just fine.

SortByColumns(
    Search(                                                                    //this is not delegation friendly
        Filter(TestLogistik, logicalTest), TextSearchBox1.Text, SearchColumn   //this is delegation friendly
    ),
    SortColumn,
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

Powerapps shows a delegation warning because of the unsupportet search function, but the filter function is fine.

What is the expected behavior here? Will delegation work with Filter, and Search will be handled locally or does Search break delegation even for Filter?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Delegation Function nested in non-Delegation function

It should work its way from your innermost call outwards.

 

So you have a filter as your innermost call, which is delegable, so it will delegate that task and return only the found items, which it will then search within those returned results 🙂

 

If your search requirements are not a substring, then you could consider writing your formula to use a StartsWith, assuming you are doing a searchbox that you can search within the datasource

 

SortByColumns(
      Filter(TestLogistik,
               logicalTest1,
               StartsWith(SearchColumn, TextSearchBox1.Text)
               ) //this is delegation friendly
      ,
      SortColumn
      ,
      If(
            SortDescending1,
            Descending,
            Ascending
      )
)


You can also search within multiple columns this way and have the action delegable:

SortByColumns(
      Filter(TestLogistik,
               logicalTest1,

               //AND Part2,  i.e MUST have first logicalTest AND any of the below (OR)'s

               // These must be text fields to be searchable with StartsWith
               StartsWith(NameSearchColumn, TextSearchBox1.Text)
               ||
               StartsWith(JobNumberTextValueSearchColumn, TextSearchBox1.Text)
               ||
               StartsWith(SurnameSearchColumn, TextSearchBox1.Text)
               ||
               StartsWith(SearchColumn4, TextSearchBox1.Text)
               ) //this is delegation friendly
      ,
      SortColumn
      ,
      If(
            SortDescending1,
            Descending,
            Ascending
      )
)




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Delegation Function nested in non-Delegation function

It should work its way from your innermost call outwards.

 

So you have a filter as your innermost call, which is delegable, so it will delegate that task and return only the found items, which it will then search within those returned results 🙂

 

If your search requirements are not a substring, then you could consider writing your formula to use a StartsWith, assuming you are doing a searchbox that you can search within the datasource

 

SortByColumns(
      Filter(TestLogistik,
               logicalTest1,
               StartsWith(SearchColumn, TextSearchBox1.Text)
               ) //this is delegation friendly
      ,
      SortColumn
      ,
      If(
            SortDescending1,
            Descending,
            Ascending
      )
)


You can also search within multiple columns this way and have the action delegable:

SortByColumns(
      Filter(TestLogistik,
               logicalTest1,

               //AND Part2,  i.e MUST have first logicalTest AND any of the below (OR)'s

               // These must be text fields to be searchable with StartsWith
               StartsWith(NameSearchColumn, TextSearchBox1.Text)
               ||
               StartsWith(JobNumberTextValueSearchColumn, TextSearchBox1.Text)
               ||
               StartsWith(SurnameSearchColumn, TextSearchBox1.Text)
               ||
               StartsWith(SearchColumn4, TextSearchBox1.Text)
               ) //this is delegation friendly
      ,
      SortColumn
      ,
      If(
            SortDescending1,
            Descending,
            Ascending
      )
)




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

Jannis
Level: Powered On

Re: Delegation Function nested in non-Delegation function

This solved my problem
Searching for a Substring is required, but using the Search function won't be a problem after the data is filtered.
Thank you very much!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Kudoed Authors
Users Online
Currently online: 289 members 5,512 guests
Please welcome our newest community members: