Is this expected behaviour?
If I have a sync set up to pull only, it seems to be deleting any new records I may have created on my mobile device.
The situation that I am trying to set up is as follows.
I want to be able to pull data down from my client table to my mobile device but any changes/additions to the data made on the mobile device need to be sent back into a different table at head office (a holding area where someone at HO can check the changes before approving/rejecting them).
Currently I have set up the following relationships (and required layouts) in GoZync Mobile:
gzh_client (client table) - GoZync - gzm_client (client table)
gzh_clientHolding (clientHolding table) - GoZync - gzm_clientHolding (client table)
In GoZyncHosted I have set the first sync to pull by default and the second to push by default.
This seems to work for edits to existing data, however new records on the mobile device just seem to get removed when I try to sync.
Am I going to be able to achieve this functionality?
Thanks,
Paul.
Pull - deletes new records on mobile device?
8 posts
• Page 1 of 1
Posts: 7
Joined: Thu Oct 17, 2013 5:09 pm |
|
See if any of the suggestions in this post applies to your setup:
www.seedcode.com/support/viewtopic.php? ... 58&p=10505 |
|
Posts: 7
Joined: Thu Oct 17, 2013 5:09 pm |
Thanks for the quick reply! I had a look at that post, but I don't believe it is the same issue as that user was reporting all records getting deleted on a second sync. I am only getting new records I add deleted, and it happens the first time I run the sync. I do have a filter in place so that it only pulls down records from HO that meet a certain criteria, but if that is what is causing the problem I am not sure how I could fix it anyway as the filter is happening on the HO set of records, and the new records are never going to be there anyway? As a test I tried disabling the filter and ran another sync, but my new records still got deleted. Is it standard behaviour for new records on a mobile device to be removed if the sync is set up to only pull data and not also push back? Thanks, Paul. |
No, those records shouldn't be getting deleted in your mobile file if they aren't being deleted on the server and you haven't specifically set up a filter to exclude them. I don't know what the cause might be without seen your files. If you don't mind sending them to me (support@seedcode.com) I'll have a look and help you figure it out.
|
|
Posts: 7
Joined: Thu Oct 17, 2013 5:09 pm |
Hi Jeff, The issue is that the records don't exist on the server at all, they have been created on the mobile device! I've stepped through the code some more, and it looks like this is just the way it works. There is a script that gets called as part of the "Pull" called "Get IDs to Pull From Host, Delete Records On Mobile That Have Been Filtered Out". Even if there I have no filter in place (in the "Filter Records to Sync" script), that script will return a list of all the ID's from the HOSTED database, and then delete anything from the MOBILE database that is not in the list. So in my case, because the record has been created on the mobile database, the ID for that record is never going to be in that list and will always get deleted! Unless I am misunderstanding the code, it would seem that if I want to PULL data down from the host, then I can never create new records in that table on the mobile database as they will just get deleted the next time a pull is issued... So I guess that means that my requirement - Pull down from the host into a table on mobile, then Push changes/additions made to the table on the mobile database back to a DIFFERENT table on the host - can not work without me making some changes to the scripts in GoZync Mobile. I guess I can make the changes, but I am not keen to do so as it will make upgrading to a new version a pain! Can you please confirm if my assumptions are correct? Thanks, Paul. |
Ah, now I see what you're saying. You're right, if there are records on the mobile device that aren't in the hosted file, then they will be deleted from the mobile device when you pull. If you want to change that behavior you'll have to do some custom scripting.
|
|
Posts: 15
Joined: Mon Sep 16, 2013 7:40 am |
Hi there,
Could you perform the push to the holding table before performing the pull. That would transfer your new / modified / changed data to the server before the records get overwritten by the pull. The only downside i can see to this is that although the data is now in the holding table the records will still be deleted from your mobile device as the data is not in the pulled table. |
I'm still a little confused about what you're trying to do. It doesn't sound like any use case I've ever heard of. But I think you get the basic concept, which is that records that don't exist in the hosted solution will be deleted from the corresponding table on the mobile device. So you could either do a round-trip sync, which pushes first then pulls, or have some scripted routine in the mobile file that replicates the records in another table (which you may or may not sync). Either way, you can manipulate the data however you want in the hosted solution using a server-side script. HTH
|
|
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest