cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
matt_trick
Regular Visitor

Unexpected results with formula-level prefetching

I have encountered issues with formula-level prefetching on Canvas apps in several different areas:

 

  1. Apps that need to submit to SharePoint, fetch new data, load that data to a local collection, and then use the local collection to store data in a variable - It appears that when formula-level prefetching is turned on the app attempts to increase performance by storing data in the variable first before submitting data to SharePoint and updating the local collection. For example, the following code submits a form to SharePoint and then uses the last item submitted to SharePoint in a local variable. However, when formula-level prefetching is on it will set the variable to the last item in the local collection prior to submitting to SharePoint:
    • SubmitForm(Form1);
      Refresh(SharePointList1);
      ClearCollect(
      LocalCollection,
      Filter(
      SharePointList1,
      'Created By'.Email = User().Email
      )
      ));
      Set(LocalVariable, Last(LocalCollection).Column);
  2. Apps that use If(Connection.Connected) to initialize local collections from SharePoint if online or load local collections from device if offline - For example, the following code initializes a local collection OnStart of the app either by pulling the data from SharePoint (if online) or by loading data from the users device (if offline). When formula-level prefetching is turned on if the user is offline they will get an error (issue with connecting to datasource). It appears as though the app is trying to preload the local collection with data from SharePoint before ever reading the conditional logic:
    • If(Connection.Connected,
      ClearCollect(
      LocalCollection,
      SharePointList1
      )
      ,
      LoadData(
      LocalCollection,
      "OfflineLocalCollection",
      true
      )
      )

In both of these cases turning off formula-level prefetching solved the issues and the app ran as expected.

 

Is there a way to override when formula-level prefetching is performed so that we can guarantee that code is run sequentially when the user knows that order is critical for the apps function? 

0 REPLIES 0

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,351)