Syncing Found Sets
Developers love that GoZync can be set to pull just a found set of records down to an iPhone or iPad. Folks use this to deliver just one user’s records–usually very specific things like “my customer visits for today” or “my active orders in this territory”.
Less well known but almost cooler is that you can give your users the ability to “push” just a found set of records back to the office. This is great for when you’ve modified a lot of local records, but only a few of them are “done” (only some quotes are finished, only some orders have been signed). Users need a way to send just these “done” records back to the server.
You’re In Charge of Which Records Sync
Out of the box, GoZync will sync any records that have changed since the last sync. You can also run the script “Zync It – this record” to sync just the one record you’re currently on (that really big sale you want to get back to the office right away).
But you can also let uses tag which records they want to sync and GoZync will sync those flagged records, leaving other modified records alone.
Here is a video of syncing found sets in action:
Behind the Scenes of Syncing Found Sets
One of the subtle things happening here is that we need to clear the flag when a record is successfully pushed to the server. This is actually quite tricky as a number of things could happen during the sync (record lock, network disconnect, etc.) and we wouldn’t want to clear the sync flag in those cases.
Fortunately, this is what having a “transactional” sync is all about: anything goes wrong during the sync and ALL edits are reverted, including the clearing of that “sync” flag.
While the video above shows us managing this flag with an auto-enter calc, GoZync 4 lets us you do this in a script: the same script you’d use to mark records as checked out, for example. Details in the instructions referenced below.
Adding This to Your Own Files
Once you’ve added GoZync to your file, follow the instructions here to add a flag field governing which records are pushed back to the server.
To control which records are pulled down to your iPads and iPhones it’s even easier: GoZync will look within the results of a find request for records that have changed since the last sync. If you can write a find request, you can sync that found set down to your users.
This, of course, is part of the GoZync philosophy: GoZync is written solely in FileMaker…so modifying its behavior is just modding FileMaker scripts and calcs.