From SeedCode Documentation

GoZync4: ZyncIt

Overview

The "Zync It" scripts were imported into your mobile file as part of integrating GoZync. These are the scripts which start many syncs and are called by the "sync' and "upload" buttons in our example files. These are also the scripts you'll start with to craft a sync that matches your specific workflow.

You can also call the API scripts in GoZyncMobile directly, as you would if you wanted to start a sync out of context (from another table occurrence) or wanted more control.

How do I call the Zync It scripts and which options do they support?

Zync It - This Table. Call this script if you're on a table you want to Zync; you'll call this script with no script parameters and it will run the default Zync options for that table/layout. You must be on a layout based on a primary TO (table occurrence) and whose TO name is configured in GoZync: ie. it is one of the TO names listed in the "Table Occurrence / ID columns of GoZyncHosted's configuration tab on the mobile side.
Zync It - This Record ( RecordID ). This is just like the script above (it performs the default zync options for the table occurrence you're on) but it does so for only one record. You'll pass in the record's primary key as a script parameter. In the example below "_id" is the primary key of the table, "TimeRecords":
Zync It - Everything. Call this script without any script parameters and it will run the default zync options for every zynced table occurrence in GoZyncMobile. This is certainly the simplest way to Zync, but if your app has many primary TOs you many not want to sync them all every time.

Call in the API scripts in GoZyncMobile directly

If you want more control over your syncs, you can call the syncing API scripts in GoZyncMobile.fmp12 directly from your file. The script you're interested in is located in the "Zync It" folder and is called:

Zync It - Public API - ( TOName ) { Action ; RecordID }

Notes at the top of the script explain the parameters it accepts, but here are some more details:

TOName - This is the name of the table occurrence you want to sync. The most common reason for calling this API script directly is when your users aren't "on" the TO they want to Zync: they're on an interface record, a child record, or on the same base table but where its TO has a different name. Pass the TO name like this: "TOName = Projects" Note the spaces on either side of the equals sign: those are required. "TOName= Projects" won't work.
TOName is the only required script parameter.
The TOName parameter can also accept lists of TOs separated by carriage returns. Like this: "TOName = Projects¶Staff¶WorkTypes"
Action - Optionally you can specify the action you'd like take on a TO. Possible actions are Push, Pull, and Round Trip. Including an action would look like this: "TOName = Projects ; Action = Pull". Note the spaces on either side of the semicolon: those are required.
The Action parameter is required if you pass in a list of TONames.
RecordID - Allows you to sync just one record: pass in the primary key of the record you're interested in. Like this: "TOName = Projects ; RecordID = " & TimeRecords::_id
You can't pass in a RecordID when you've passed in a list of TONames.
Retrieved from http://www.seedcode.com/pmwiki/pmwiki.php?n=GoZync4.ZyncIt
Page last modified on June 12, 2014, at 05:01 PM