web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Why my collection is e...
Power Apps
Answered

Why my collection is empty ?

(0) ShareShare
ReportReport
Posted on by 30

Hello all,

 

I don't understand anything anymore!


I have a sharepoint list in which there are 2500 records.

 

500 with the date 01/01/2022 (dd/mm/yyyy)
500 with the date of 01/02/2022 (dd/mm/yyyy)
500 with the date of 01/03/2022 (dd/mm/yyyy)
500 with the date of 01/04/2022 (dd/mm/yyyy)
500 with the date of 01/05/2022 (dd/mm/yyyy)

I create one collection per month (to overcome the 2000 records problem)

 

like this :

ClearCollect(col1,Filter(AddColumns(TEST_SUM,"m",Month(MyDate),"d",Text(MyDate,"dd/mm/yyyy")),DateValue(d,"fr") >= DateValue(Text(DateFromActivity,"dd/mm/yyyy"),"fr"),DateValue(d,"fr") <= DateValue(Text(DateToActivity,"dd/mm/yyyy"),"fr"),m=1));

ClearCollect(col2,Filter(AddColumns(TEST_SUM,"m",Month(MyDate),"d",Text(MyDate,"dd/mm/yyyy")),DateValue(d,"fr") >= DateValue(Text(DateFromActivity,"dd/mm/yyyy"),"fr"),DateValue(d,"fr") <= DateValue(Text(DateToActivity,"dd/mm/yyyy"),"fr"),m=2));

ClearCollect(col3,Filter(AddColumns(TEST_SUM,"m",Month(MyDate),"d",Text(MyDate,"dd/mm/yyyy")),DateValue(d,"fr") >= DateValue(Text(DateFromActivity,"dd/mm/yyyy"),"fr"),DateValue(d,"fr") <= DateValue(Text(DateToActivity,"dd/mm/yyyy"),"fr"),m=3));

ClearCollect(col4,Filter(AddColumns(TEST_SUM,"m",Month(MyDate),"d",Text(MyDate,"dd/mm/yyyy")),DateValue(d,"fr") >= DateValue(Text(DateFromActivity,"dd/mm/yyyy"),"fr"),DateValue(d,"fr") <= DateValue(Text(DateToActivity,"dd/mm/yyyy"),"fr"),m=4));

ClearCollect(col5,Filter(AddColumns(TEST_SUM,"m",Month(MyDate),"d",Text(MyDate,"dd/mm/yyyy")),DateValue(d,"fr") >= DateValue(Text(DateFromActivity,"dd/mm/yyyy"),"fr"),DateValue(d,"fr") <= DateValue(Text(DateToActivity,"dd/mm/yyyy"),"fr"),m=5));

 

But when I look in the collections, I see that col5 is empty.
Can someone explain me how to do this ?

 

Thanks a lot

Categories:
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Unfortunately, your Filter() statement has several non-delegable operations within it, so no matter what you are hitting the 2000 record limit. Instead, try this:

    1. Load your records 2000 at a time using a delegable Filter() on a "shadow ID" column (see Warren's blog on this topic)
    2. Combine the smaller collections into a large main collection
    3. Finally, Filter() using your non-delegable operations as required

    In other words, if you know you need to work with a large collection internally, hold off with the non-delegable operations until it is completely loaded.

     

    Hope that helps,

    Bryan

  • GregPower Profile Picture
    30 on at

    Hello Brian and thank you very much for your reply.

    I now understand better the notion of delegation 😉

    Here is what I did:

     

    I created a YearCreated and MonthCreated number field in my sharepoint list and then I filter like this

     

    ClearCollect(col1,Filter(TEST,Created >= Date(YearFrom,MonthFrom,DayFrom) && Created <= Date(YearTo,MonthTo,DayTo) && MonthCreated=4));

     

    Is this delegable?

    Thanks a lot 🙂

  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Power Apps will warn if it thinks a Filter() can't be delegated, which varies according to data source. On your statement, the Date() functions within the Filter() could cause it to be non-delegable. Consider evaluating those ahead of time using a With():

    With({ fromDate: Date(YearFrom,MonthFrom,DayFrom), toDate: Date(YearTo,MonthTo,DayTo)},
     ClearCollect(col1,
     Filter(TEST, Created >= fromDate, Created <= toDate, MonthCreated = 4)
     )
    );

    Bryan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard