Hello,
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});
SaveData(offline_record,"offline_record_local_storage");
LoadData(offline_record,"offline_record_local_storage")
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
Solved! Go to Solution.
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
Thanks,
That's the code in the 1st button:
If(Connection.Connected,
If(Or(IsBlank(DataCardValue23),IsBlank(DataCardValue24),Value(Text(DataCardValue23))>30,Value(Text(DataCardValue23))<1,Value(Text(DataCardValue24))<70,Value(Text(DataCardValue24))>160),
UpdateContext({popup:true}),
SubmitForm(Form1);
Navigate(screen_welcome,ScreenTransition.None)),
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});
SaveData(offline_record,"offline_record_local_storage"))
And then, on open of the app:
LoadData(offline_record,"offline_record_local_storage")
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:
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.
Thanks
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
User | Count |
---|---|
133 | |
132 | |
95 | |
75 | |
74 |
User | Count |
---|---|
206 | |
195 | |
70 | |
60 | |
52 |