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

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Refresh(Data_source) not working. This happens a lot!

(0) ShareShare
ReportReport
Posted on by 206
This appears to be an ongoing issue with PowerApps canvas for several years. I have always struggled with keeping the data up to date in galleries. I put a refresh here and a refresh there until I get lucky. It should be a simple ClearCollect() then Refresh() afterward on the App OnStart or an OnVisble that but it's hit and miss. You would figure something this important would have been one of  Microsoft's top priorities but I guess it's not. Does anyone have a full proof way of making sure this is never a problem? 
I have the same question (0)
  • WarrenBelz Profile Picture
    150,769 Most Valuable Professional on at
    Refresh(Data_source) not working. This happens a lot!
    Disregard this post
     
  • Pstork1 Profile Picture
    68,094 Most Valuable Professional on at
    Refresh(Data_source) not working. This happens a lot!
    I can pretty much guarantee if you just did a copy and paste of the gallery without changing the code it will break again in the future. If you want it to work consistently you need to add a timer or something to do a delay when you do the refresh before building out the new collection.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • jv123 Profile Picture
    206 on at
    Refresh(Data_source) not working. This happens a lot!
    ok what I did is copy and paste the gallery, essentially made a new one, then blew away (deleted) old one. now it works. the inconsistency continues with this platform. :) thanks for your help.
  • jv123 Profile Picture
    206 on at
    Refresh(Data_source) not working. This happens a lot!
    because var has a specific add columns formula that pulls SP columns to display categorized records in the gallery.  I have nested galleries.
  • Pstork1 Profile Picture
    68,094 Most Valuable Professional on at
    Refresh(Data_source) not working. This happens a lot!
    So the reason why that isn't consistent is that the Refresh() of the data source takes a short amount of time.  Not a lot, usually 10-15 seconds.  So if you follow it immediately with a ClearCollect() there's a fairly good chance that the ClearCollect will be working with an older cached copy of the data.  I suspect I know the reason, but why are you loading the data into a Collection and then using that for the Gallery instead of basing the gallery on the Data source directly?  If you do that then the Gallery will update automatically after the Refresh() finishes and won't have the timing problems that you are having with the ClearCollect.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • jv123 Profile Picture
    206 on at
    Refresh(Data_source) not working. This happens a lot!
    ok first I apologize that is a typo. I updated the post. Yeah it's pretty straight forward.
    App OnStart has the following:

    Refresh(Datra_Source)
    ClearCollect(var, Data_Source)

    Gallery items property has the following:
    var


     
  • Pstork1 Profile Picture
    68,094 Most Valuable Professional on at
    Refresh(Var, Data_source) not working. This happens a lot!
    ClearCollect() Clears and resets the values in a Collection. Refresh() refreshes the records in a records set.  The two commands don't operate on the same data.  Also, Refresh() only takes one parameter, not two like you list in the title.  Depending on what the data is in the Gallery there should be no connection between doing a ClearCollect followed by a Refresh. If you'll explain what you are trying to do I will try to explain what you need to do to get it to work.  

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 998 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 426

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 257 Super User 2025 Season 2

Last 30 days Overall leaderboard