Downloading Found Sets
GoZync4.DownloadingFoundSets History
Show minor edits - Show changes to markup
Todd Geist demonstrates filtering as part of his "Three Favorite GoZync Features".
Filtering in Action
This feature was adding in version 3.17 of GoZync and simplified in version 4.
As described above, the script "Filter Records To Zync" in GoZyncHosted 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.
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".
To do that, GoZyncMobile access to any global fields in your mobile files. These are easily used in find requests within the GoZyncMobile script "Send Filters to Pull".
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".
To do that, GoZyncMobile access to any global fields in your mobile files. These are easily used in find requests within the GoZyncMobile script "Send Filters to Pull"
To do that, GoZyncMobile access to any global fields in your mobile files. These are easily used in find requests within the GoZyncMobile script "Send Filters to Pull".
There is a single script in GoZyncMobile that controls bringing data down to a mobile device. The script is "Filter Records To Zync" and it begins by performing a "Show All Records" command.
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.
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.
To tag a record when it is being pulled down to a mobile device, edit the script "Edit Record being Pulled..." 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 by editing the script "Before Committing Entity".
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.
We're on a layout based on the table occurrence "WorkTypes", performing a find that only grabs the active work types. Using simple FileMaker Finds like this, you can easily add sophisticated syncing behaviors to GoZync.
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.
http://www.seedcode.com/screenshots/gozync/EditFilter.png
http://www.seedcode.com/rootimages/stikipad/gozync/ifst.png
There is a single script in GoZyncHosted that controls bringing data down to a mobile device. The script is "Filter Records To Zync" and it begins by performing a "Show All Records" command.
There is a single script in GoZyncMobile that controls bringing data down to a mobile device. The script is "Filter Records To Zync" and it begins by performing a "Show All Records" command.
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:
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:
This feature was adding in version 3.17 of GoZync.
This feature was adding in version 3.17 of GoZync and simplified in version 4.
To do that, GoZyncMobile has a method for passing name-value pairs up to GoZyncHosted so they can be included in your find requests. Here's how to take advantage of this:
To do that, GoZyncMobile access to any global fields in your mobile files. 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.
- "$territory = " & SomeTable::SelectedTerritoryGlobal & " ; "
- "$territory = " & Quote ( SomeTable::SelectedTerritoryGlobal ) & " ; "
- "$territory = " & SomeTable::SelectedTerritoryGlobal & " ; $anothername = " & SomeTable::AnotherFieldGlobal & " ; "
- "$territory = " & Quote ( SomeTable::SelectedTerritoryGlobal ) & " ; $anothername = " & Quote ( SomeTable::AnotherFieldGlobal ) & " ; "
Can I "push" just a found set or records up from my mobile device?
Can I "push" just a found set of records up from my mobile device?
Can I "push" just a found set or records up from my mobile device?
Yes. Checkout Pushing Found Sets.
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 (it's own "IF" section). Here is what one such branch might look like:
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:
- "territory = " & SomeTable::SelectedTerritoryGlobal & " ; "
- "$territory = " & SomeTable::SelectedTerritoryGlobal & " ; "
- "territory = " & SomeTable::SelectedTerritoryGlobal & " ; anothername = " & SomeTable::AnotherFieldGlobal & " ; "
- "$territory = " & SomeTable::SelectedTerritoryGlobal & " ; $anothername = " & SomeTable::AnotherFieldGlobal & " ; "
Passing filter criteria up from the mobile file
This feature was adding in version 3.17 of GoZync.
As described above, the script "Filter Records To Zync" in GoZyncHosted 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".
To do that, GoZyncMobile has a method for passing name-value pairs up to GoZyncHosted so they can be included in your find requests. Here's how to take advantage of this:
To tag a record when it is being pulled down to a mobile device, edit the script "Edit Record being Pulled" 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.
To tag a record when it is being pulled down to a mobile device, edit the script "Edit Record being Pulled..." 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.
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, edit the script "Mark Record being Pulled" 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 record when they are synced back from the mobile device, you can do that by editing the script "Mark Record being Received".
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, edit the script "Edit Record being Pulled" 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 record when they are synced back from the mobile device, you can do that by editing the script "Before Committing Entity".
- Overriding Last Time Zync'ed. In the script "Filter Records To Zync" you'll see a few disabled script steps that can be used to ignore the last Zync time and bring down a found set regardless of when the user last zynced. This is really only useful to developers who may be working with smaller sets of data that doesn't have an accurate modification time. In most cases you'll leave these steps commented out.
- Overriding Last Time Zync'ed. In the script "Filter Records To Zync" you'll see a few disabled script steps that can be used to ignore the last Zync time and bring down a found set regardless of when the user last zynced. This is really only useful to developers who may be working with smaller sets of data that doesn't have an accurate modification time. In most cases you'll leave these steps commented out.
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, edit the script "Mark Record being Pulled" 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 record when they are synced back from the mobile device, you can do that by editing the script "Mark Record being Received".
There we're asking that is we're on a layout based on the table occurrence "WorkTypes", perform a find that only grabs the active work types.
There we're asking that is we're on a layout based on the table occurrence "WorkTypes", perform a find that only grabs the active work types. Using simple FileMaker Finds like this you can easily add sophisticated syncing behaviors to GoZync.
There are two scripts in GoZynConnector that control bringing data down to a mobile device. The fist of these, "Get Records From Host ( RecordType )" simply branches to decide what kind of records you're looking for (are you pulling contacts or products, for example). The real work is done in the scripts called by "Get Records From Host ( RecordType )", such as the script "Package up Products" in our example file. (You might have many of these in your deployment, having copied "Package up Products" to create "Package up Contacts", "Package up Workorders", etc.)
If you look in the script "Package up Products" you'll see the following comment:
And in our example this is followed by a simple Show All Records script step... because in our example we always bring down all the products to the mobile user.
To send a subset of records to the mobile user, just replace that Show All Records step with a scripted find that grabs the records you want your user to get.
There is a single script in GoZyncHosted that controls bringing data down to a mobile device. The script is "Filter Records To Zync" and it begins by performing a "Show All Records" command.
If you leave it like this, all records will be considered for sync, and 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 for you depending on the table being synced. Each table you want to do this for would get it's own brach (it's own "IF" section). Here is what one such branch might look like:
http://www.seedcode.com/screenshots/gozync/EditFilter.png
There we're asking that is we're on a layout based on the table occurrence "WorkTypes", perform a find that only grabs the active work types.
Coming Soon
Can someone in the field download just their data?
Yes. GoZync lets you build a found set of records to come down to the mobile device. This 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 are two scripts in GoZynConnector that control bringing data down to a mobile device. The fist of these, "Get Records From Host ( RecordType )" simply branches to decide what kind of records you're looking for (are you pulling contacts or products, for example). The real work is done in the scripts called by "Get Records From Host ( RecordType )", such as the script "Package up Products" in our example file. (You might have many of these in your deployment, having copied "Package up Products" to create "Package up Contacts", "Package up Workorders", etc.)
If you look in the script "Package up Products" you'll see the following comment:
And in our example this is followed by a simple Show All Records script step... because in our example we always bring down all the products to the mobile user.
To send a subset of records to the mobile user, just replace that Show All Records step with a scripted find that grabs the records you want your user to get.