cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,398)