Downloading Found Sets
Filtering: 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.
Todd Geist has a great video walkthrough on filtering in GoZync 5, including examples of filtering by user name and by the current location of the iPad: "Filtering by UserName and Location".
Todd also demonstrates filtering as part of his "Three Favorite GoZync Features".
How it works.
There is a single script in your hosted file that controls bringing data down to a mobile device. The script is named "Filter Records To Pull" and is one of the scripts you imported into your hosted file during integration. In our example file it's in the file WorxHosted.
The script 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 "WorkOrders", performing a find that only grabs the records tagged to be checked out. Using simple FileMaker Finds like this, you can easily add sophisticated syncing behaviors to GoZync.
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 and 5.
As described above, the script "Filter Records To Pull" in your hosted file 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) and you'll want to include this criteria in the find requests you're building in "Filter Records To Pull".
To do this, edit the script "Specify User Defined Search Criteria (TOname)" in GoZyncMobile. You'll see some example steps where after a branch for each table occurrence we pass filter criteria to a sub script with this filter criteria as a parameter.
For example, if you had a global field called "Properties::SelectedTerritoryGlobal", the parameter for the subscript might look like:
Then your PerformFind() steps in the script "Filter Records To Pull" will have access to a variable named $Territory and you can use this variable as part of your find criteria.
Can I "push" just a found set of records up from my mobile device?
Yes. Checkout Pushing Found Sets.
These steps should help debug most issues with filtering found sets.