What is the best way to handle syncing one mobile file to two hosted file?
I want to do a full round-trip sync of every table to one hosted file, and a push sync of specific tables/fields to a different hosted file. This second hosted file actually has multiple clients push their sanitized data to it for a more global analysis of certain data points. The setup within GoZyncHosted and GoZyncMobile is working fine.
The trouble is that with new/updated records, the sync is either/or. Whichever hosted file is synced to first, that record won't sync to the second hosted file. What is the best way to ensure that a new/updated record syncs to both hosted files?
How to sync one mobile file to multiple hosted files?
6 posts
• Page 1 of 1
Posts: 18
Joined: Thu Oct 11, 2012 8:03 am |
|
Hi Aaron. I just tried this myself, and I think I see what you mean. I don't have an answer for you yet but I'll get back to you as soon as I do.
|
|
The reason you weren't able to sync the same record to the second hosted file (without first making an additional change to that same record) is that the gz_Send field gets set to "0" once the record is pushed to the first hosted file. For that reason, that record isn't among the "changed" records that are found to send in the "Push Selected TO" script in GoZyncMobile.
So you could say that GoZync isn't designed to sync a record to more than one place. But there are two mechanisms you could use to do this: 1. You could sync to one hosted file, then the have a server-side script move the data to the second file. That is certainly the simplest. 2. Or you could use Custom Field Mapping to set fields using a second table occurrence (to hosted file #2) after all the fields were originally synced to file #1. Here's more info on Custom Field Mapping: http://www.seedcode.com/pmwiki/pmwiki.p ... eldMapping HTH |
|
Posts: 18
Joined: Thu Oct 11, 2012 8:03 am |
Will do. Thanks!
|
Posts: 18
Joined: Thu Oct 11, 2012 8:03 am |
To get this working, I ended up doing it all as a server-side script, ripping out all references to host file number 2 from GoZync. The obvious benefit is that this speeds up the mobile-processing and bit-pushing side.
Out of curiosity, how would this have worked with Custom Field Mapping? My limited understanding of playing with it and reading your documentation is that Custom Field Mapping can only update existing records, not create new ones. At least that is what I get from your documentation when you state: So if I create a new record and sync, it will go to host number 1, but won't have a record at host number 2 to update via Custom Field Mapping. |
You can do all kinds of cool things in the "Custom Field Mapping: Transformation and Hooks" script. First, set up the If[] branches for your TOs (similar to how you set up the GTRR script), then add Set Field steps to move whatever data you want using any table occurrence using whatever conditional logic you like. And since all of the TOs you added into GoZyncMobile have the "allow creation" option checked, you can create new records in other tables as well. HTH -Jeff
|
|
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests