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
Highlighted
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.

View solution in original post

1 REPLY 1
Highlighted
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.

View solution in original post

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 (5,099)