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 / Collection not populating
Power Apps
Unanswered

Collection not populating

(0) ShareShare
ReportReport
Posted on by 277

Hello, first of all I want to apologize if what I am going to ask is very silly, but in reality it is the first time that I deal with PowerApps, I love this platform but I am still learning.

 

My problem is, I have a list of employees EmployeesDirectory and this list of calls contains information of the employees such as the day of the birthday, these fields (day, month and year) are of a single line text type.

 

I am building an application in PowerApps where I want to show the birthdays of the month, then I must filter my list by the month field called Mbirth and then order the records by day field called Dbirth, so I can show the list of people who have birthdays that month.

 

I have managed to connect the SharePoint list with the apps and the records are displayed, but reading I understand that it's better to use collections and configure the data source property of the gallery with the collection.

 

I have tried placing the code in OnVisible (Screen) and also in OnStart (App) but it doesn't work.

 

Set(varMonths, Text(Today(),"mm"));
ClearCollect(colBirthDay,Filter(EmployeesDirectory,Mbirth=varMonths));

 

But my problem is that the collection is not only not filled, even when I go into the properties I see some fields that are not the fields of my list.

 

Can anyone give me any suggestions as to what might be going on?

 

I put the code of the filter and the images of the collection.

 

Thank you very much, I hope you can help me.

Screenshot 2022-04-15 132708.png
Screenshot 2022-04-15 132606.png
Screenshot 2022-04-15 132634.png
Categories:
I have the same question (0)
  • slerch Profile Picture
    59 on at

    Is the column MBirth in your SP List a string that's formatted as "mm"?

     

    For example, if your birthday was today (April 15), would the value of MBirth be "04"?

  • WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    Hi @ADumith ,

    You can improve the OnStart collection a bit to get rid of the Variable (which would remain all the time the App is active) and I am also assuming here mBirth is as you described a Single Line of Text containing a number (01, 02, 03 etc). If it is, then the below should produce results

    With(
     {
     varMonth, 
     Text(Today(),"mm")
     },
     ClearCollect(
     colBirthDay,
     Sort( 
     Filter(
     EmployeesDirectory,
     Mbirth = wMonth
     ),
     Dbirth
     )
     )
    );

    Is any of this not correct?
    I think your other confusion with the field names you mention is due to you importing your list from Excel, which has the unfortunate effect of making the original (or "real") field names field_1, field_2 . . . 
    This makes ongoing references quite difficult and for that reason, you are better advised to create your list in SharePoint with the desired field names, edit in Grid View and then copy and paste (you can do about 50 at a time) from Excel. There is also a workaround using the legacy import process, but you need a browser with the "old" Internet Explorer capability.

     

    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

  • ADumith Profile Picture
    277 on at

    Thank you very much for continuing to help me.

     

    I was testing your idea but it doesn't work, instead I used this one and was able to get the collection with the loaded data.

     

    At App.OnStart

    Set(varMonth, Text(Now(),"mm"));

    ClearCollect(colBirthDay, Sort(EmployeesDirectory,Mbirth,Ascending));

    I was wondering if I could add a new sorting by Dbirth?, I mean the collection being sorted by month and day, both ascending.

     

    When I apply the filter at gallery.items:
    Filter(colBirthDay,Mbirth=varMonth)

     

    It doesn't show any records, but when I remove the filter and leave just the collection name all the data is loaded.

     

    Any idea how to fix it?

     

    Thank you in advance,

  • WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    @ADumith ,

    What type of field is mBirth? Also how many items are in your list?

  • ADumith Profile Picture
    277 on at

    Hello Sir,

    My list has 180 records.

    Mbirth is single line of text, so for this month's records have 04 instead of 4.

    However, yesterday I realized the collection problem could be solved by simply saving the app, closing PowerApps and reopening it.

    The problem I have now is with the filter, it's not working, so I exported the app and sent it to a friend to test and the app works, so it may be failing on my platform that makes the filter not works, the problem is not code, there is something that is not working well.

     

    Do you have any idea?

     

    Thank you!

  • WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    Hi @ADumith ,

    I do not know what platform you are on, however the code should (and does on the other computer) work.

  • ADumith Profile Picture
    277 on at

    Thanks for your reply.

     

    Sorry, I forgot to mention that great little detail. 😋

     

    I am working on SharePoint Online

     

    Any idea?

     

    Have a good evening

  • WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    @ADumith ,

    I assumed SharePoint - the other user would be on this as well, so that does not explain it. What are you using (it should be fine on Chrome or Edge)

  • ADumith Profile Picture
    277 on at

    I think I found the issue source.

    ListSettings.png

     

    Note that each field has its title.

     

    But, when the collection is created, the title of the field is not brought, but rather an ambiguous title is placed, I mean, field_1 instead of FullName, field_2 instead of EmployeeEmail, etc.

     

    How can I solve it?

     

    Thank you for your time.

     

    Thanks again for your time and support

  • WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    Hi @ADumith ,

    You have imported your list initially from Excel which is (as you have discovered) not the best idea as the "original" field names are field_xx. If you want to get rid of this, make your SharePoint list with the field names you need and then "line up" the fields with your Excel sheet and paste them in (you can do about 50 at a time) from Excel in a SharePoint "Edit in Grid View" function.

     

    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

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard