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

Avoiding Delegation Warning Trying to Use ClearCollect to Filter my Data into a smaller Segment.

Good Afternoon,

 

I am working on a powerapp that is currently small but I expect to be well over 10k records within a year of use.

 

To that end, I'm trying to pre-emptively avoid issues down the line.

 

I guess I'm either not understanding Delegation or ClearCollect or am butchering the syntax. (Likely Both.)

Currently to pull my data I can use this formula code:

 

 

Filter(Rosters, Gallery2.Selected.ClassTypeText = ClassTypes.Value ,Text(ClassDate,ShortDate) = Text(DatePicker1,ShortDate) )

 

 

 

My thought process is that on any given day we would only have maybe 50-300 records. So If I could presort the table based on the date picker, it would hopefully make this responsive/quicker and down the road when I do have 10k+ records, it won't start to work at a snails pace.

 

 

ClearCollect(DateCollection,Filter(Rosters,Text(ClassDate,ShortDate) = Text(DatePicker1,ShortDate));
Filter(Rosters, Gallery2.Selected.ClassTypeText = ClassTypes.Value)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

If you can use Filter() to get your data source below the data row limit then you don't need ClearCollect.  If you can't then ClearCollect won't help.  The key here is to use nested Filter() statements that are delegable to get your data set below the data row limit, then apply non-delegable functions to that data set.  For example,

Filter(Filter(Rosters, Gallery2.Selected.ClassTypeText = ClassTypes.Value),Text(ClassDate,ShortDate) = Text(DatePicker1,ShortDate));



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

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Leon_D ,

Firstly, you need SeletedDate on the Date Picker, but if ClassDate is a Date only field (not time), you just need this

Filter(
   Rosters, 
   ClassTypes.Value = Gallery2.Selected.ClassTypeText &&
   ClassDate = DatePicker1.SelectedDate
)

 

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.

Visit my blog Practical Power Apps

 

Pstork1
Dual Super User
Dual Super User

If you can use Filter() to get your data source below the data row limit then you don't need ClearCollect.  If you can't then ClearCollect won't help.  The key here is to use nested Filter() statements that are delegable to get your data set below the data row limit, then apply non-delegable functions to that data set.  For example,

Filter(Filter(Rosters, Gallery2.Selected.ClassTypeText = ClassTypes.Value),Text(ClassDate,ShortDate) = Text(DatePicker1,ShortDate));



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

@Leon_D 

Another option is to use Dataverse or Sql as a connected source.  Delegation is not as much of an issue with those. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,306)