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

Collection filter does not work


I have a button that `on select` does this:


However what I noticed is that the `test_collection` gets updated only if I click on the button twice. It never seems to return the correct updated collection within a single click.

Any ideas why?

Super User
Super User

Re: Collection filter does not work

Hi @vshets

Just a guess but it may be that the ClearCollect is firing off before Refresh has had a chance to finish.  You can test this by replacing your button with a timer control and set the following properties:

  • OnTimerStart: Refresh('[dbo].[employeeBucket]')
  • Duration: 8000
  • OnTimerEnd: ClearCollect(test_collection,Filter('[dbo].[employeeBucket]',Bucket="Billing"))

If that works you found the problem, then try decreasing the duration until the problem recurs.  

Level: Powered On

Re: Collection filter does not work

Hi @Drrickryp .. I tried and made it wait until 30s but that does not seem to have worked. What I did was create 2 separate buttons: One button just to refresh the database .. wait for 30s and then click on the other button (as in the original post): i.e. a `refresh` before calling `clearcollect`. So basically I am calling refresh twice with a gap of 30s between the refresh intervals.


Not entirely sure why it always works on the second click at a minimum .i.e only if I repeat the above loop twice.

Level 10

Re: Collection filter does not work



I found this as a problem myself and found that you not always get just inserted/updated records directly back to PowerApps. I don't know why, but I would think this maybe has to do with cashing on the sql side off things. For me this was a reason to go for another setup off my solutions by introducing flow as an interface which calls a stored procedure on the sql server which returns my records to my collection. 


If you like to learn how to do this and see if this is an option you could use, see MS PowerApps | SQL Server & Flow


Know there are more advantages in adopting flow then only returning all the records to the collection.


Hope this helps.



Helpful resources


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


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

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


Join PowerApps User Group!!

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


Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 170 members 4,239 guests
Please welcome our newest community members: