Skip to Content
avatar image
Former Member

Can i delete data from ODataOfflineStore only from the device?

In my app the user must fill in a form and submit it. The process is to insert data via store.executeCreateEntity(…) and then call store.flushQueuedRequests() in order to send the data to the backend. After flushing the user has the data both in the device and the backend.

How can I delete data from the device only? If I call store.executeDeleteEntity(…) all deleted data wil be also deleted from the backend too in the next store.flushQueuedRequests().

Also, store.closeStore() seems not to delete data but only destroy the object from the memory.

I only want to delete data from a store in the device. Is it possible?

Add comment
10|10000 characters needed characters exceeded

  • Former Member

    can i open a store then execute store.executeDeleteEntity(…) and close the store without flushing? would it work?

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 11, 2017 at 01:21 PM

    Hello Former Member ,

    Please understand offline flow ,

    Initially, when you make a call to create OfflineStore, you would have 2 UDBs on your local device for that particular app , one is local copy of data that you requested to be available in offline and second one is request queue udb

    All the local changes are queued to that second udb

    FLUSH is performed on that second udb (request queue), it means that all local changes/requests are being send to back-end. Once this is successful (received by backend), the request is deleted from the queue, the change is made to backend.

    When you perform a REFRESH call next time, new version of object is sent to offline store.

    Regards

    JK

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Jitendra Kansal

      as described in the flush method in sap docs i understand the flow as:

      1. record is saved in local store

      2. record is added into the queue

      3. when flush is called the record is submitted to the remote backend and is deleted from the queue, but it remains in the local store. This causes local data of the application to go up to very large numbers.

      There should be something like an annotation that tells the store "do not keep in store just add it in the queue to be submitted" or "delete after successful flush"