Hi,
I have created a DB on eSpace & imported in Mobile application, Mobile app if Implemented with Read-Write Last Win Pattern as per Document.
Note:
- I have used Sync Action from Logic for Delete & Create/Update
- I have called SyncLocalTableAction of Client in OfflineDataSync as per document.
Below are my some queries to be cleared:
1- There is one table in my DB server, but I want to only get records based on user & current date only, Should I add filter on Local Entity / Entity in DB Table...?
2- Once I delete the record, it should also be deleted on Server DB, I check it delete from local but shows me on server DB?
3- If I edit & update, it should also be reflected on server DB?
4- what is the best method approach & offlineDataSyncConfig to be use for Offline-Online Data Sync?
5- Should I add action on onReady State of Home screen to fetch Data, but before that adding a check of GetNetworkStatus & calling the TriggerOfflineDataSync?
I know this might be 5 diffrent post , but they all are relalted to same, thus I post here in same thread.
Thanks,
Assif
Hi Assif,
before trying to answer your questions, let me say the online training has lessons on Local Storage, Offline and Data Syncronization that you should probably review and make sure you can implement their respective exercises.
Jorge Martins wrote:
Jorge Martins, Just to clear things with point1-1:
1- If I want to get User Specific Data from Server then where should I add a filter with respect to UserID.
A) Filter on Aggregate on Screen like : Table.UserID=GetUserID()
B) DataBase Entity [ But how]
Hi Jorge,
Thanks for the awesome reply :)
Well :
1- ok
2- Then it was showing me the records still on DB server table, even after delete & sync
3-ok
4-So If i set the required flags in offlineDataSyncConfig , than there will no need to manually call Sync ?
5- It was for calling Maunally the Sync Trigger
Thanks
assif_tiger,
In order to understand your issue with 2) I suggest you check your logic: if the records aren't being deleted on the Database entity, you probably are doing something wrong. Use the debugger to see the list of records to be deleted that is sent to the Server, and follow the execution flow to make sure they are being deleted properly and that the transaction commits successfully.
Regarding 4), automatic syncing can only happen on those three moments: when a user logs in, when the application becomes online again or when the app was in the background and is resumed (becomes the foreground app again, the one the user interacts with). Depending on your application logic, these might be enough, or you may need to trigger synchronisation explicitly:
Finally 5)... there are many places and patterns you can use to allow the user to trigger syncing... simple ones would be to have a button or link somewhere to explicitly trigger the sync (asynchronously) or the pull to refresh to force the data to be synced (in this case it might make sense for it to be synchronous, by directly calling the OfflineDataSync client action, instead of using TriggerOfflineDataSync).
Hope this clarifies things.
Hey Jorge,
That's Something Awesome Explanation. Thanks for your time,
Cheers,
If you want to filter server side data to sync, you'll want to do it in an (Database) Aggregate or SQL
You mean I should use direct DB Entity Aggregate on Screen instead of Local, Coz I created Entities in Local i.e copied from my DB section which I used in entire project.Also facing an issue with Update: Ï have used the UpdateTablelForsync Action of Login Tab in Screen, The issue is when I update any existing record from app, it added as an new entry in local table. whereas I pass same recordID to it.
Hi assif_tiger,
You mean I should use direct DB Entity Aggregate on Screen instead of Local, Coz I created Entities in Local i.e copied from my DB section which I used in entire project.
Not on your Screens, we are talking about synchronisation... I meant on your ServerDataSync Server Action.
Also facing an issue with Update: Ï have used the UpdateTablelForsync Action of Login Tab in Screen, The issue is when I update any existing record from app, it added as an new entry in local table. whereas I pass same recordID to it.
I have no idea what "UpdateTablelForsync Action of Login Tab in Screen" is...
A word of caution though: the Id assigned when you first create a record on the Database can be different from the Id that was assigned when you created the record on LocalStorage, this is why the sync patterns typically delete all data from the LocalStorage before adding back all the records it received from the server.