How to sync one mobile file to multiple hosted files?

Help, Tips, and Tricks for deploying GoZync: our "sync" engine for FileMaker Go.
Posts: 18
Joined: Thu Oct 11, 2012 8:03 am
PostPosted: Mon Sep 16, 2013 11:16 am
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?
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Mon Sep 16, 2013 12:39 pm
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.
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Mon Sep 16, 2013 1:29 pm
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
PostPosted: Tue Sep 17, 2013 3:34 am
Will do. Thanks!
Posts: 18
Joined: Thu Oct 11, 2012 8:03 am
PostPosted: Tue Sep 17, 2013 12:15 pm
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:
you can remove all but one field from your sync layouts, and do all the work in SetField() scripts steps within the "Custom Field Mapping: Transformation and Hooks" script.
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.
SeedCode Staff
SeedCode Staff
Posts: 475
Joined: Wed Jan 02, 2013 11:47 am
PostPosted: Wed Sep 18, 2013 6:14 pm
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

Return to GoZync

Who is online

Users browsing this forum: No registered users and 2 guests

cron
(855) SEEDCODE
[email protected]
Follow us: