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 / Refresh('[dbo].[vwView...
Power Apps
Answered

Refresh('[dbo].[vwView]') & ClearCollect(viewcollection, '[dbo].[vwView]')

(0) ShareShare
ReportReport
Posted on by 349

We are trying to understand the Refresh vs. the ClearCollect.

 

Is a Refresh required prior to issuing a ClearCollect, or does the ClearCollect automatically execute a Refresh prior to returning the data from the views with the most up-to-date data ?

 

For example:

 

Do I need to execute the following to get the most up-to-date data from SQL Server:

Refresh('[dbo].[vwView]')
ClearCollect(viewcollection, '[dbo].[vwView]')

or does the following command:

ClearCollect(viewcollection, '[dbo].[vwView]')

 

execute the refresh when it performs the clearcollect getting the most up-to-date data?

 

Thank you

Categories:
  • Verified answer
    CarlosFigueira Profile Picture
    Microsoft Employee on at

    If you want to ensure that you have the most up-to-date information from a view in SQL Server, then you need to call Refresh on it. PowerApps may cache the data from data sources (such as SQL Views) until it knows that the cache is stale. For regular tables there are some cases where it knows that the cache is stale, for example, if a new record is added to / removed from the table, or if a record is modified. But (as of now), there's no way to tell that a view is dependent on some action on another data source, so if you want to ensure that you're getting the most recent data, you need to refresh it first:

    Refresh('[dbo].[vwView]'); ClearCollect(viewcollection, '[dbo].[vwView]')
  • vsslasd Profile Picture
    349 on at

    Thank you, can you tell me when PowerApps: "until it knows that the cache is stale. "

  • CarlosFigueira Profile Picture
    Microsoft Employee on at

    For views PowerApps doesn't have a way to know that it's stale (unlike tables, where it will know that a cached item is stale if there were update operations for that item, for example). I don't know if there is an internal "timeout" mechanism that marks a connected data source as stale after a period of time, but even if there is such a thing, this is an implementation detail that the apps shouldn't rely on. If you want to ensure that you have the latest data from a view (or even from a table, as other users may have made updates while you were using the app), you need to pull the latest data using Refresh.

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard