cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
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
      )
)


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

2 REPLIES 2
Highlighted
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
      )
)


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted
Regular Visitor

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,925)