cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ShowMeTheAnswer
Level: Powered On

Refresh not working as expected.

I have a button, it was there by default.

It's supposed to refresh the data on the screen.

It's supposed to refresh the data on the screen:

Refresh('[dbo].[MAIN]');Refresh('[dbo].[KAPMT_MAIN_VIEW_2]')

Data is in a "Data Table".

Data Table "items" is set to a "collection" called products.

Products collection is made like this in the OnVisible for the screen:

ClearCollect(Products, Filter('[dbo].[KAPMT_MAIN_VIEW_2]',MARKET_ID = MarketId.Text,MANUFACTURINGCENTRE_ID=ManufacturingCentreId.Text,SITE_ID=SiteId.Text,APPLICATION_ID=ApplicationId.Text,PROCESSSTEP_ID=ProcessStepId.Text));Refresh('[dbo].[KAPMT_MAIN_VIEW_2]')

 

Code is also used on my edit form after "Submit":

If(SaveControl_Edit_1.Text="Don't Save","",Refresh('[dbo].[MAIN]');Refresh('[dbo].[KAPMT_MAIN_VIEW_2]');SubmitForm(EditForm2_1))

 

Result: The DataTable is not "Refreshed" straightaway; changes that users make are not reflected on screen until the NEXT time you go in and try and edit a record.

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Refresh not working as expected.

@ShowMeTheAnsweryou are using a collection (Products) as your datasource.  It will NOT update or refresh until you do the ClearCollect again (OnVisible).  

If you want the refresh to be instant, you will need to use the dataSources you are refreshing directly, not through a collection.  Otherwise, you will need to do the ClearCollect again after you refresh.

 

If you set your DataTable Items to:

   Filter('[dbo].[KAPMT_MAIN_VIEW_2]',MARKET_ID = MarketId.Text,MANUFACTURINGCENTRE_ID=ManufacturingCentreId.Text,SITE_ID=SiteId.Text,APPLICATION_ID=ApplicationId.Text,PROCESSSTEP_ID=ProcessStepId.Text))

You will see instant updates when a record is edited. 

 

If you cannot set your datasource directly and need a collection for other purposes, then you need to ClearCollect that collection each time you want to refresh. 

 

Hope that helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
1 REPLY 1
Super User
Super User

Re: Refresh not working as expected.

@ShowMeTheAnsweryou are using a collection (Products) as your datasource.  It will NOT update or refresh until you do the ClearCollect again (OnVisible).  

If you want the refresh to be instant, you will need to use the dataSources you are refreshing directly, not through a collection.  Otherwise, you will need to do the ClearCollect again after you refresh.

 

If you set your DataTable Items to:

   Filter('[dbo].[KAPMT_MAIN_VIEW_2]',MARKET_ID = MarketId.Text,MANUFACTURINGCENTRE_ID=ManufacturingCentreId.Text,SITE_ID=SiteId.Text,APPLICATION_ID=ApplicationId.Text,PROCESSSTEP_ID=ProcessStepId.Text))

You will see instant updates when a record is edited. 

 

If you cannot set your datasource directly and need a collection for other purposes, then you need to ClearCollect that collection each time you want to refresh. 

 

Hope that helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 42 members 3,941 guests
Please welcome our newest community members: