cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesSnaps
Advocate V
Advocate V

Avoiding delegation warning in collection

Thanks to some helpful posts on this forum, I'm using a function to collect a range of dates in a collection. I'm also looking to add a column to the code, that uses LookUp on a SharePoint list to verify dates. The code all works, but I get a delegation warning on the checkDate=DateAdd(weekStart, Value, Days) part. If I change 'Value' to a static number, this warning goes away. Is there any way to avoid this delegation warning at all, whilst using the current Value?

 

Or is the warning in this instance not a big deal and therefore I shouldn't worry about it?

 

 

 

ClearCollect(
    DateRange,
    AddColumns(
        FirstN(
            [0,1,2,3,4],
            DateDiff(weekStart, DateAdd(Today(),1-Weekday(Today(),StartOfWeek.Monday)+4,Days), Days) + 1),
        "Day",
            "Day " & (Value + 1),
        "Date",
            DateAdd(weekStart, Value, Days),
            "complete",If(IsBlank(LookUp(sfbbLogs,checkDate=DateAdd(weekStart, Value, Days))),false,true)
    )
)

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @JamesSnaps ,
Date queries are not Delegable, not matter how you "wrap" them. I have a workaround in this section of my blog on Delegation, although it may not be suitable for you.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @JamesSnaps ,
Date queries are not Delegable, not matter how you "wrap" them. I have a workaround in this section of my blog on Delegation, although it may not be suitable for you.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi @WarrenBelz , thanks for the reply. Why would the function appear as fine (no delegation warning) when I change 'value' to a static number, e.g. 1. Is that not still a date query? It would appear that it's the use of 'Value' that is causing the warning, so just curious.

 

 

 

 

ClearCollect(
    DateRange,
    AddColumns(
        FirstN(
            [0,1,2,3,4],
            DateDiff(weekStart, DateAdd(Today(),1-Weekday(Today(),StartOfWeek.Monday)+4,Days), Days) + 1),
        "Day",
            "Day " & (Value + 1),
        "Date",
            DateAdd(weekStart, Value, Days),
            "complete",If(IsBlank(LookUp(sfbbLogs,checkDate=DateAdd(weekStart, 1, Days) && nurseryID=varNursery.ID)),false,true)
    )
)

 

 

I can also change checkDate=DateAdd(weekStart, Value, Days) to just be checkDate=Today() and that also works fine, no warning. But using Value anywhere in the formula results in a delegation warning

 

 

Hi @JamesSnaps ,

I am not sure - I have not tried that one myself. Beware however that there are a number of things you can do in Power Apps that are "hidden" delegation limitations (the With() statement is one of them), but I have never been able to filter large data sets on date fields.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User
Super User

Hi @JamesSnaps ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

I think so Warren, I used the information to basically set up a different workflow that wouldn't suffer from being non-delegable, so thanks for the clarification.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,162)