Showing results for 
Search instead for 
Did you mean: 
Impactful Individual
Impactful Individual

SQL (OnPrem) - Refresh Data Bug

Something not quite right with data gateway service.


Load SQL data into a collection

change data in collection

patch data back to sql and clear collection

refresh datasource

load data into collection again


the changes are not populated even though they have been patched and the data source refreshed.

In order to load the changes i am having to do

refresh datasource


clear collection




there is definitely a bug here can somebody please advise. its not right that the datasource is not refreshing until the 2nd collect. and ive tried multiple refreshes and it makes no difference

Dual Super User
Dual Super User

Collect() adds new records to the collection, even if the records already exist.  You should be doing just a Refresh and then a ClearCollect to get a new collection of records from the data source. I'm not aware of any easy way to update an existing collection with changes made to a data source other than re-building it.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Impactful Individual
Impactful Individual

it doesn't matter if i use clear/collect or clearcollect, unless i do it twice the updated sql records do not refresh.

Hi @Delid4ve 

Could you check if you've enabled the 'use longer data cache' option?

If so, could you try disabling it to see if it makes a difference?



Impactful Individual
Impactful Individual

@timl  It is on at present, I’ll test shortly.


@Pstork1 i have to use clear and then collect as I’m using in forall as ‘in’ is not delegated.

this is the formula I have to run twice for it to work after patching/updating records:




ForAll(Distinct(Equipment,ID),Collect(Temporary_ClassificationLink_Equipment_General,Filter('[dbo].[ClassificationLink]',ForeignID = Result And ForeignTable = "Equipment" And Archived = false And Deleted = false And Or(ClassificationID =500,ClassificationID = 148,ClassificationID = 149,ClassificationID = 150,ClassificationID = 554,ClassificationID = 556,ClassificationID = 557,ClassificationID = 558,ClassificationID = 547,ClassificationID = 549,ClassificationID = 550,ClassificationID = 552,ClassificationID = 884,ClassificationID = 886))));
ForAll(Distinct(Equipment,ID),Collect(Temporary_ClassificationLink_Equipment_PAT,Filter('[dbo].[ClassificationLink]',ForeignID = Result  And ForeignTable = "Equipment" And Archived = false And Deleted = false And ClassificationID > 807 And ClassificationID < 871)));


Although I'm using a Flow to execute a SQL stored procedure to merge records into my destination database, I am also running into needing to refresh the SQL data source multiple (more like 3-4 times for me) times in some instances before new data that was successfully saved to the database to be returned to PowerApps.

@goobernoodles yep, even if you wait for the return to say it successfully executed. Somethings not right.

Im adding to a temp table (trigger on table so cant patch directly), running a stored procedure (flow new record) to update the correct table


at first I thought it was due to the stored procedure not yet being executed, however I tested by waiting a full minute and it still doesn’t update.  The only way it updates is to collect clear and then collect again, doesn’t matter how many times I refresh the source I have to collect twice

Impactful Individual
Impactful Individual

@Pstork1 @timl @goobernoodles 

So to show you exactly how it happens:


so I start with the field as Testing mk5 (top table is live sql and also bottom box)


I collect the data (table 2/3 and top 2 boxes) 2 is a temp collection for comparing data and 3 is what I am going to update from



I then edit the field in the collection (table 3) to mk6



I then update the sql with the new data (upload) which clears the collections and as you can see the live data table has changed to the new value.

I then collect the field again from sql however it gets the old value (unless I run collect/clear/collect)



I don’t know where it is even getting the old value from as you can see that it has updated in sql from the live data table. Confused as &#!$


Impactful Individual
Impactful Individual

@timl Tested with it disabled and it solves it so there’s the bug 👍

@Delid4ve - glad that solves the problem for you.

@goobernoodles - maybe you could check the same setting to see if that helps you?

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,339)