cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vsslasd
Level 8

Refresh with Filter doesn't work as expected.


We have an app which is using collections.

The collection is created using the following syntax:

ClearCollect(CollectvwView1, AddColumns(Filter('[dbo].[vwView1]', Id = ThisItem.ItemId),"GUID",Text(GUID())));

 

In our PowerApps App, we modify the collection data, and then we patch that data back to SQL Server.

 

The problem is, we need to refresh the View that has been patched (vwView1) in order to see the latest results in collection in the PowerApps App.

 

The View takes several seconds to execute and Refresh, when we try:

Refresh('[dbo].[vwView1]')

We really only need to refresh the View for those items that were updated or impacted by the changes, e.g. based upon Id.

 


This would work, and PowerApps allows this syntax, and this is very efficient and quick, but it does not actually Refresh:

Refresh(Filter('[dbo].[vwView1]', Id = ThisItem.ItemId));

 

However, Even though the updated data does actually reside in SQL Server correctly, PowerApps does not distintguish that the data has indeed been updated on the refresh statement noted above.

 

We must do (but this takes too long: about 40 seconds):

Refresh(BaseTable_which_was_Patched);
Refresh('[dbo].[vwView1]');

 

In addition, it seems like both of these commands need to be executed twice for them to work 100% of the time. It also seems that some time must go by... running these immediately successively doesn't seem to be 100% accurate, unless a period of time goes by (the data is in SQL Azure, and yet the patch statement shows that it updated the data immediately).

 

Why doesn't it recognize in the View that data was changed: we have to refresh the ENTIRE table and the ENTIRE view, which should not be necessary.

 

 

Then we can rebuild the collection like this:

ClearCollect(CollectvwView1, AddColumns(Filter('[dbo].[vwView1]', Id = ThisItem.ItemId),"GUID",Text(GUID())));

 

And that provides the accurate data that we are looking for, but we cannot have the latency issue.

 

So we need the following to return the most up-to-date, refreshed data, and this would work, if PowerApps would correctly pull data this way:

Refresh(Filter('[dbo].[vwView1]', Id = ThisItem.ItemId));

 

We are somewhat constrained by the View, because it pulls from a 3rd party app.

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,585)