cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeAnderson
Level: Powered On

Filter on Collection not working correctly

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

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Level 8

Re: Filter on Collection not working correctly

Hi @MikeAnderson ,

 

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

2 REPLIES 2
v-siky-msft
Level 8

Re: Filter on Collection not working correctly

Hi @MikeAnderson ,

 

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

MikeAnderson
Level: Powered On

Re: Filter on Collection not working correctly

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.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 390 members 5,777 guests
Please welcome our newest community members: