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 / Filter on Collection n...
Power Apps
Answered

Filter on Collection not working correctly

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a simple collection that is populated from a database view.

ClearCollect(PendingEquipmentCollection, '[dbo].[vwPendingEquipment]')

I have two gallerys.  One gallery the user selects and ID from, which then filters the above collection.  My issue is, the filter code is not working against the collection, but it works against the view.

 

This works:

Filter('[dbo].[vwPendingEquipment]', RequestID = TreeGallery_DetailsScreen.Selected.Entity)

This does not:

Filter(PendingEquipmentCollection, RequestID = TreeGallery_DetailsScreen.Selected.Entity)

What's even more perplexing, if I hard code the value of the entity into the collection filter, it still doesn't work, for example:

Filter(PendingEquipmentCollection, RequestID = "123456")

But if I change the column I'm filtering on, it works, for example:

Filter(PendingEquipmentCollection, Job = " 1202.")

Any thoughts on why this is not working when it works just fine directly against the view?

Filter(PendingEquipmentCollection, RequestID = TreeGallery_DetailsScreen.Selected.Entity)

For those who are more visual, here is a screenshot to validate the working vs non-working against the same id:

 

Working:

Working.png

 

Not working:

Notworking.png

Categories:
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Is there any error information with the formulas? What is data type of ‘Request ID’ column? Is there any value in Request ID Column? Is there any other formulas applied to change the value of collection.

    Please check if the RequestID column has been populated with proper value in your Collection?

    I have made a test,  and don’t have issue you mentioned. The gallery can be filtered well against the collection.

    RequestID  and  TreeGallery_DetailsScreen.Selected.Entity should have same data type. So could you use two Tables to show RequestID column of collection and data source to check if there is any difference between values? Or you can put the below formula to Text property of Label to check if both of them are same.

     

    First('[dbo].[vwPendingEquipment]').RequestID = First(PendingEquipmentCollection).RequestID

     

    To work around it, I suggest you can remove SQL Connection, then re-connect it and re-create the collection to check if the issue is fixed.


    Best regards,

    Sik

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Well,

     

    After the app sat for a day, when I went back in, it is working as expected. No code changes, no tweaks, just worked as it should have worked from the beginning.

     

    Thank you for the reply.

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 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard