Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

saving offline records


I am trying to save records while working offline, so that they get uploaded at the end of the day to my Sharepoint list when back online.

In my edit form, I create a collection with the info entered, save it to the phone's cache, and load the data which I display in a gallery.

Collect(offline_record,{date: DataCardValue22.SelectedDate,centre: Dropdown3.Selected.Value});

I created a gallery where I display the collection by setting the items property to offline_record, and it works. 

However, when I enter a new offline record, it replaces the previous one, instead of adding it up.
So my gallery always displays the last offline record entered, instead of the whole list of offline records.

If anyone has some advice that would be great.

Thanks a lot


Accepted Solutions

They are only disposed of if the app is closed. In that case, using the "OnStart" and using LoadData() to populate those collections will give you the data for offline. You just need to make sure as you use the app, that you update the offline files with savedata() on any changes after you update the collection. This way next time you load the app, the collections get populated with local data if offline.

View solution in original post

Solution Sage
Solution Sage

I wouldn't reload the data from cache in one step, it's probably not finishing the write to save before loading so It's loading the first one. Use Load on app start but not during the save. See if this helps at all.

Thank you for your help.


I broke the instruction in 2 steps: I do the Collect and the SaveData in one button.


And then I come out out of the app and on open I lood the data from the cache.


However I still get the same error.


It seems like when I save a new record it overwrites the previous in the cache....I don't know where I got it wrong



Anyway to post your code? Sure you don't have any odd characters on the files? I pulled my hair out once and found out the files are case sensitive and I had one letter caps on save vs my load one.

That's the code in the 1st button:




Collect(offline_record,{date: DataCardValue22.SelectedDate,centre: Dropdown3.Selected.Value,bag: DataCardValue23.Text,sample1: DataCardValue24.Text,sample2: DataCardValue25.Text,sie: ListBox1.SelectedItems.Value,route: DataCardValue2.Text});


And then, on open of the app:



Hi @blue_lotus. I see your code here. You can disregard my request in your other post. Here are some ideas that may help debug your issue:

  1. Ensure all your comparisons are correct.
    1. Put some debugging labels in your app that show the status of your comparisons.
    2. Example: Create a label with Text Property set to IsBlank(DataCardValue23). Make sure its accurate. Repeat this for all your comparisons.
  2. I've found quite few times that things are not always cut and dry with IsBlank. Depending on how you setup your options or the type of control, you may need to use = " " or IsEmpty. 
  3. Also < and > comparisons can get weird when you are converting things to Text then Value(), etc.
  4. Another idea is to put debug Gallery on the screen with its Items set to the LoadData() Collection. This will tell you what the data is on your mobile phone. It can be tricky to debug Load/SaveData() without this.

Good luck!


I followed your advice but it's still not working.

it just seems that I constantly overwrites the collection, instead of adding a new reocrd to the collection.

How can I get support on that? Im hitting a wall here.



Hi @blue_lotus. So, all of your comparisons are correct? What does the Gallery show before and after you SaveData()? What does it show after you LoadData()?

Hi Seadude,


So i enter my record.

After i save, the records shows in the gallery which display the collection.

it is in the cache and then I load it to the collection. 

It appears on the unsaved_screens I have


Then I go out of the app. 
Still offline, I want to enter a 2nd record.

I save it, and it shows in the collection
I load it, and then, on the unsaved_screen, I can see that this 2nd record has overwritten the first one.

THat's my problem. At the end of the day working offline, I would like to have all my records saved on the phone, when I get to a place with wifi, i can upload all those records to my Sharpeoint list.

I hope it's clear, let me know if you need any other info,


Thanks a lot for your help

In my App, I use a separate collection that holds "changes" for uploading. Then have an upload screen that sends these to my data source. When I create any new records, I patch to my app collection and then to the changes collection and savedata() on both. Then when Online I use a forall using the addition collection to patch the changes to the online datasource. I only use Loaddata() to start the app up. This way no matter what, my changes collection won't get overwrote or be used in any way, and I can loop through just the additions into the data source. But luckily for me I only have additions, no edits / deletes, this complicates things a bit more :).

Helpful resources

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 (2,678)