cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vsslasd
Advocate V
Advocate V

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.

 

0 REPLIES 0

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (79,658)