cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lee123
Frequent Visitor

Delegation filter formula

Hi
I can't figure out why this formula won't delegate to a sharepoint list. 
 
Sort(
If(MyRecordsOnlyCheck.Value = true,
Filter(Ministerials As Min, currentUser = First(Min.MinisterialAuthor).DisplayName), Ministerials)
,'Due date', Descending)
 
Any ideas? MinisterialAuthor is a multiple person field. CurrentUser is a global var made from User().FullName
3 REPLIES 3
v-albai-msft
Microsoft
Microsoft

Hi @Lee123 ,

If your formula is perfect except for the delegation issue, you can keep the results of “First(Min.MinisterialAuthor).DisplayName” using a variable to resolve the delegation issue.

By default, First() function is not delegable in SharePoint, only below functions are delegable in SP:捕获.PNG

As a result, you can use Set() function to create another variable:

Set(firstresult, First(Min.MinisterialAuthor).DisplayName)

Then change your formula like below:

Sort(

If(MyRecordsOnlyCheck.Value = true,

Filter(Ministerials As Min, currentUser =firstresult), Ministerials)

,'Due date', Descending)
Note: If the number of your list items is not exceed to 2k, the filtered results will not be affected, you can ignore the delegation warning.

Best Regards,

Allen

Lee123
Frequent Visitor

Hi Allen thanks for your post.

I don't think it's quite what I'm looking for though as First(Min.MinisterialAuthor).DisplayName produces the first entry in the multiple select people field in the data source, it's not a static value for the filter as it changes for each record.

Is there another function that is delegatable that might do the job?

Lee123
Frequent Visitor

I've tried LookUp which according to the posted graphic is delegatable but it still complains that it can't be delegated

 

Sort(
If(MyRecordsOnlyCheck.Value = true,
Filter(Ministerials As Min, currentUser = LookUp(Min.MinisterialAuthor, DisplayName = currentUser).DisplayName), Ministerials)
,'Due date', Descending)
 
Also the formula is notably uglier.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (39,710)