Showing results for 
Search instead for 
Did you mean: 
Super User
Super User

Is refresh() necessary if you do a search filter change, or do a lookup?

I have a quick question with regards to using Refresh(), and its behavior.


I have a complex list tool that combines information from several sources.  Data has the ability to change on a fairly regular basis.  I do not believe it is necessary to do a data source refresh() if I am changing a search/filter criteria anyway.  It will pull all of the data direct from the source anyway, right?  I believe a refresh() only affects exiting open forms and/or galleries where a search is not updated.  I think its overkill to have refresh() in a statement that changes filters, then.  Yes?  Please let me know if I'm close on this.

Super User
Super User

Re: Is refresh() necessary if you do a search filter change, or do a lookup?


Refresh is only needed to do just that...go back to the datasource and get a refresh of the data.  If you already have the data and are just working with it - even adding or removing items, then there is no need.

If you Patch a record or Remove a record or do other actions on that datasource, then there is still no need to refresh as the datasource and the internal collection (not a "collection" collection) of data are in sync.  If the back-end data has the chance to change often and being aware of those changes in your App is important, then yes, refresh is needed.

NOTE - This does not apply for collections.  If you gather data in a collection, refresh will not refresh a collection...only the datasource.  If you need the collection to be refreshed, you will need to refresh the datasource and then rebuild the collection.


I hope that answer what you were looking for.

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.
Super User
Super User

Re: Is refresh() necessary if you do a search filter change, or do a lookup?

My datasources are not being updated by my app.  That is actually what I'm doing.  I'm writing a routine that scans a datasource for updates, then patches my collection with ONLY updates.  Since a full data load takes nearly a minute.  I have just finished my basic data "update" routine, and it only takes 6 seconds to scan my datasources for updates.  This is a significant improvement.


Thus, my datasources (3 SQL Views, and 2 Sharepoint lists) are being updated by other utilities.  My calls to the datasources are done via lookups, and filters.  I presume those functions will be pinging the data directly, so refresh() is unnecessary.


Just to show what i've done, this is my update routine.  I actually just finished it minutes ago.  I believe it is working as expected.  Its a big timesaver.



UpdateContext({TimerReset:false, Circle1_Color:Green})

Concurrent(Refresh('Engineering Change Notice'), Refresh('Engineering Change Request'), Refresh(Drawing_Vault),

If(CountRows(ClearCollect(UpdatedAcct,Filter(SortByColumns('[dbo].[tbINVTransactionDetail]',"PostedTimestamp",Descending),DateTimeValue(Text(PostedTimestamp))>DateAdd(LastUpdate,-DateDiff(Now(), DateAdd(Now(),TimeZoneOffset(),Minutes),Hours),Hours))))>0,UpdateContext({No_Acct_Updates:false}),UpdateContext({No_Acct_Updates:true})), If(CountRows(ClearCollect(UpdatedAcctProd,Filter(SortByColumns('[dbo].[VIEW_POWERAPPS_BASIC_ACCTIVATE_DATA]',"UpdatedDate",Descending),DateTimeValue(Text(UpdatedDate))>DateAdd(LastUpdate,-DateDiff(Now(), DateAdd(Now(),TimeZoneOffset(),Minutes),Hours),Hours))))>0,UpdateContext({No_AcctProd_Updates:false}),UpdateContext({No_AcctProd_Updates:true})) ); Collect(UpdatedAcct,UpdatedAcctProd); UpdateContext({Circle2_Color:Green}); Concurrent( ClearCollect(UpdatePartNumbers,UpdatedMDL.MD_PartNumber,RenameColumns(UpdatedAcct,"ProductID","MD_PartNumber").MD_PartNumber,RenameColumns(UpdatedAcctProd,"ProductID","MD_PartNumber").MD_PartNumber), ForAll(UpdatedAcct.ProductID,Collect(UpdatedAcctData,LookUp(RenameColumns('[dbo].[VIEW_POWERAPPS_BASIC_ACCTIVATE_DATA]',"ProductID","Acct_PartNumber"),Acct_PartNumber=ProductID))) ); UpdateContext({Circle3_Color:Green}); ForAll(Distinct(UpdatePartNumbers,MD_PartNumber).Result,Collect(UpdatedFromMDL,LookUp(Master_Drawing_List,MD_PartNumber=Result))); ForAll(RenameColumns(UpdatedFromMDL,"MD_PartNumber","MD_PartNumber2"), Patch(MDL_All,LookUp(MDL_All,MD_PartNumber=MD_PartNumber2), { MD_Project: MD_Project, MD_LatestRevNumber: MD_LatestRevNumber, MD_EngrgRelDate: MD_EngrgRelDate, Title: Title, MD_PDM_Link: MD_PDM_Link, MD_LinkToDrawing: MD_LinkToDrawing, MD_IsActive: MD_IsActive, MD_Data_Flagged: MD_Data_Flagged, MD_Latest_SW_DocumentID: MD_Latest_SW_DocumentID, LastCost:LookUp(UpdatedAcctData,Acct_PartNumber=MD_PartNumber2,LastCost), OnHand: LookUp(UpdatedAcctData,Acct_PartNumber=MD_PartNumber2,OnHand), Location_Acct: LookUp(UpdatedAcctData,Acct_PartNumber=MD_PartNumber2,Location), Discontinued_Acct: LookUp(UpdatedAcctData,Acct_PartNumber=MD_PartNumber2,Discontinued), Available: LookUp(UpdatedAcctData,Acct_PartNumber=MD_PartNumber2,Available) } ) ); Set(LastUpdate,Now()-.002); UpdateContext({TotalDwgCount:CountRows(MDL_All),LoadDataSpinner:false}); ClearCollect(StockQuote,GetKIQStockQuote.Run()); UpdateContext({LastStockUpdate:Now()})
Super User
Super User

Re: Is refresh() necessary if you do a search filter change, or do a lookup?


So, I'm not entirely clear on your requirements or app design, but it seems that you are still going through the process of reloading all the data in this formula.  The only aspect that seems to reduce the amount of data load is the fact that you are filtering on the modified date and only collecting items that are newer.

I assume that this then feeds or augments another collection of items that don't meet the filter?  Or are you not concerned with getting all the records in those datasources?

Also noticed - delegation must not be an issue Smiley Wink


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.
Super User
Super User

Re: Is refresh() necessary if you do a search filter change, or do a lookup?



On app load, ALL data is being loaded into MDL_All.  This takes about 60 seconds.  You are correct.  Only new data is loaded when you refresh.  Refresh time is recorded so you only recover the newest data.  That is only a 6 second activity.


Correct as well.  Delegation will never matter as data updates will never exceed the max.  


Additionally, if someone leaves the app open "forever", a full data load will occurr every 8 hours just to be sure its all fresh.

Helpful resources


Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

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


Join PowerApps User Group!!

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


Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 172 members 4,150 guests
Please welcome our newest community members: