Downloading Found Sets
Can someone in the field download just their data?
Yes. GoZync lets you build a found set of records to bring down to your mobile device. These could be the records for a given user ("my contacts") or the records for that user which are flagged to be done that day ("my appointments for today"). You get to build the found set using whatever scripts you'd like – you're in FileMaker, after all – and GoZync will package up the resulting found set for the mobile user.
Here is how it works.
There is a single script in GoZyncMobile that controls bringing data down to a mobile device. The script is "Filter Records To Sync" and it begins by performing a "Show All Records" command.
If you leave it like this, all records will be considered for sync. Of those, only those that have changed since the user's last sync will be brought down.
But you can modify this script to build found sets depending on the table being synced. Each table you want to do this for would get its own branch (its own "IF" section). Here is what one such branch might look like:
We're pulling the entity "Customers", performing a find that only grabs the active customers. Using simple FileMaker Finds like this, you can easily add sophisticated syncing behaviors to GoZync.
Filtering in Action
Todd Geist demonstrates filtering as part of his "Three Favorite GoZync Features".
Tips for building found sets.
Tagging Found Sets.
You may want to mark records as having been downloaded, and in some cases record who downloaded them. This can be used as part of marking a record "checked out" and/or preventing such tagged records from being edited on the server while the mobile user has them.
To tag a record when it is being pulled down to a mobile device, use custom field mapping and you'll see branches very similar to those discussed above in building found sets. For each table occurrence, create SetField steps that mark the records as you see fit.
Don't forget that you'll probably want to un-tag these records when they are synced back from the mobile device. You can do that in custom field mapping as well.
Passing filter criteria up from the mobile file
This feature was added in version 3.17 of GoZync and simplified in version 4.
As described above, the script "Filter Records To Zync" in GoZyncMobile determines the found set which should be synced for each table. It is within this found set that we look for records changed since the last sync.
In some cases, you may want your users to determine which records sync. For example, they may ask for records from a certain territory (selecting a different territory every time) or you may simply need to include some fact about the mobile file (maybe the user's ID) in the find requests you're building in "Filter Records To Zync".
Remember, GoZyncMobile has access to any global fields in your mobile files. So these are easily used in find requests within the GoZyncMobile script "Send Filters to Pull".
Edit that script and you'll see a comment to "Specify user-defined search criteria" for the pull, It's easiest to write any criteria you need to a local $variable so you can use them in the PerformFind() steps that follow. For example, if you had a global field called "gzm_Properties::SelectedTerritoryGlobal", your calc might look like:
- SetVariable [ $territory ; gzm_Properties::SelectedTerritoryGlobal ]
Then your PerformFind() steps can use this variable as part of your criteria.
Can I "push" just a found set of records up from my mobile device?
Yes. Checkout Pushing Found Sets.
Controlling Filters Server Side
GoZync executes its filters in GoZyncMobile (the script "Filter Records to Zync" is IN GoZyncMobile). So you can't change your filter criteria without distributing new mobile files.
If you need to change filters without distributing new files, it's actually pretty easy to set up before you distribute your first mobile file:
This lets you embed all your filter logic in a calc in your hosted file, so you can change it on the fly. The down side is that you're probably searching on an unstored calc (your "flag" field) and that's not as fast as searching on indexed fields. You can use the split times in GoZync's logs to see how much of your sync speed is being take up by this find.