GoZync3

Downloading Found Sets

These are the notes for GoZync 3. Docs for the latest version of GoZync--GoZync 4--can be found here. GoZync 4 is a free upgrade and is highly recommended (hint: it's faster).

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 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. 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 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.

Tips for building found sets.

Authentication. Remember, your mobile user has logged into GoZyncHosted at this point (has been asked for a user name and password) so you can use Get ( AccountName ) to determine who they are and search for only their records. You also have access to Get ( UserName ), but this is often something like "Bill's iPad" and is something users can change--pretending to be someone besides Bill, for example.
Check Out. In addition to "my" records, you may want to have mobile users download records that have been tagged in some way, such as deliveries that need to be made that day. Including this Tag in the find criteria is easy, and you can often use this tag to prevent users back at the office from editing records that a mobile user has "checked 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 don't have an accurate modification time. In most cases you'll leave these steps commented out.
Run the script in isolation. Navigate to the TO you're syncing and run the script "Filter Records To Zync" by hand. You should be able to fine tune and debug your find request here, which is much simpler than debugging it from within a running Zync.

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 "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".

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:

In GoZyncMobile, edit the script "Send Filters to Pull"
Edit the first SetVariable line in the script and you'll see some notes on how to pass up name value pairs. For example, if you had a global field called "SelectedTerritoryGlobal", your calc might look like:
"$territory = " & Quote ( SomeTable::SelectedTerritoryGlobal ) & " ; "
Then in GoZyncHosted, when you're making your find criteria you'll have access to local variables for each of the named pairs you pass up. So in this example you could use the variable $territory in your find request.
You can pass up as many pairs as you need but remember that the script "Send Filters to Pull" runs out of context, so you should probably set any criteria you want to include to global fields or global variables at the beginning of "Send Filters to Pull" if they're not globals already.
And if you want to send more than one name value pair, use the following syntax:
"$territory = " & Quote ( SomeTable::SelectedTerritoryGlobal ) & " ; $anothername = " & Quote ( SomeTable::AnotherFieldGlobal ) & " ; "
Note that if you're using hard coded values instead of field names, you have to do a little coding to get the $ and "s correct. Here is the same thing with hard coded values:
"$territory = \"The Territory\" ; $anothername = \"Some Name\" ; "

Can I "push" just a found set of records up from my mobile device?

Yes. Checkout Pushing Found Sets.

(855) SEEDCODE
support@seedcode.com
Follow us: