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 SQL View datas...
Power Apps
Answered

Refresh SQL View datasource after Table Patch

(0) ShareShare
ReportReport
Posted on by 11

Scenario:

Gallery or datatable is displaying Items based on Filter('[dbo].[SomeSQLView]').

A Patch() is executed on another datasource '[dbo].[SomeSQLTable]'. This patched data source is a table that is part of SomeSQLView.

 

After the Patch() executes there is a Refresh('[dbo].[SomeSQLView]'), but the new data returned does not reflect the change just made by Patch() so Gallery does not reflect latest change.

 

I can add a button that will execute the Refresh('[dbo].[SomeSQLView]') to the screen and keep clicking it manually and not see the data change reflected for some time maybe 30 seconds.

 

Meanwhile I am confirming via SQL Management Studio that patched data was changed immediately in target table.

 

A current partial work around is to bind UI elements to collections that are based on datasource and then update the collections in parallel to patching datasources which works well and saves time waiting for Refresh() to run. But in some scenarios the SQL views are returning columns that are complex calculations that we do not want to try and duplicate in the App when modifiying collections.

 

The  App does have 50 datasources referencing different tables and views from one SQL database.

 

Please let me know how I can successfully show updated data after it has been patched in this type of scenario.

 

Thanks!

Categories:
I have the same question (0)
  • RezaDorrani Profile Picture
    12,145 on at

    Hi @amwinsalexr 

     

    Is your gallery showing a delegation warning?

  • amwinsalexr Profile Picture
    11 on at

    Hi @RezaDorrani. Thank you for your reply.

     

    No delegation warning. For example I have this problem with Gallery or Datatable (or any ui element pulling data from the datasource) where Element.Items = Filter('[dbo].[PlanTemplateFlat]', solutionID = _paSolutionID, ADPPlanID <> Blank())

     

    So there should be no delegation concern with this type of data binding.

     

    App has somewhat complex data model and UI so form elements are not used just input elements dropped on screen and Patch executed in Button.OnSelect events.

     

    More detail for screens I am working on right now, but this happens consistently for all my data sources:
    Screen A: Data table with items from '[dbo].[ViewOfTableAandBandC]', Click "Add Item" button

    Screen B: Input elements and button.OnSelect -> Patch('[dbo].[tableA]'...);Patch('[dbo].[tableB]'...);Refresh('[dbo].[ViewOfTableAandBandC]')

    User then navigates back to Screen A and data table does not reflect patch calls.

  • Verified answer
    amwinsalexr Profile Picture
    11 on at

    I believe I have found the source of my troubles.

    The App Setting "Use longer data cache timeout and background refresh" had been set to enabled.

     

    Since I disabled this setting then the SQL data source refreshes always seem to complete as expected where before they would complete, but the app would not reflect the latest data.

     

    If you are seeing Refresh() not displaying latest data from database try to disable this setting.

     

    -Alex

  • srduval Profile Picture
    1,796 Moderator on at

    I'm having this same problem but can't find that setting you are referring to. Has it been moved to another menu option or has it been removed from power apps?

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard