cancel
Showing results for 
Search instead for 
Did you mean: 

Mobile Services hybrid app offline store delete entries locally

johnmurray
Participant
0 Kudos

Hi,

We have a hybrid UI5 application using the Kapsel Offline Store. The scenario is that the users create an Item, and all of the associated information, photos, etc out in the field, and then they submit that which marks the item as Complete. Then all of the information is flushed to the backend. The problem is that the Items and other information is not being deleted, and as a result the longer the users use the app for the more space it takes up on their device, getting steadily slower and slower. I'm unsure how to tackle this problem but I have the below ideas, and was wondering if anyone has any experience with any of them, or knows the most correct way to go about this?

1) Implement downloading functionality for all of the transactional information, but filter out any completed Items and associated information. I don't really want to do this as the users are often in areas with extremely poor connectivity and downloading various bits of information unnecessarily would cause slowness. I'm not even sure if this would fix my problem too, but presumably if the getItems entity does not return the Item then the Offline Store will remove it? To me this files like the most correct way of going about it.

2) Trigger delete requests in my app after the items have been completed, but catch the deletes in my backend and return a success message without actually doing anything. I think this would fix the problem as it would delete the items locally, but leave them intact in the backend, however it feels like a very "hacky" workaround to what should be a simple problem to solve

3) Somehow just delete the items locally? Perhaps there is a special header I can send with delete requests, or even interact with the offline store directly? I am aware of the OfflineOData.RemoveAfterUpload header from https://help.sap.com/viewer/42dc90f1e1ed45d9aafad60c80646d10/3.1.1/en-US/59ae11dc4df345bc8073f9da451... however the problem I have with that, is that if my users save a draft of their Item and other info, then sync, the items will successfully flush to the backend even though the item is not Complete, so it would remove them too early from the Offline Store unless I am misunderstanding something. It's also not clear to me if I can add this to requests at a later time in the process?

Thanks

John

Accepted Solutions (0)

Answers (1)

Answers (1)

ManuelStampp
Advisor
Advisor
0 Kudos

Hey John,

in case you have not heard of, the most simple approach for solving your problem might be the removeCreatedEntityAfterUpload option. This though has side effects to associations and ability to further updates.

Synchronizing Data - SAP Help Portal

In Kapsel, this can be achieved by adding a custom header to your create requests.

oModel.create("/DummyEntitySet", oEntity,{

headers:{

"OfflineOData.RemoveAfterUpload":true

},[...]}

Kind regards

Manuel

johnmurray
Participant
0 Kudos

Hi Manuel,

Thanks for your response. It's funny as I actually edited my question when you were writing your answer to talk about that particular option. The issue that that causes for me is that during the filling in of an Item the user can synchronise as they please, and so that would remove the items for future updates whilst they are only partially finished. I don't suppose you have any other ideas, that would allow me to trigger the deletes only at a certain point?

Thanks

John