From SeedCode Documentation

GoZync4: Integration3Of4

Background: Pasting in Fields and Scripts

GoZync just needs a couple of fields in your tables. Please add these fields exactly as they are in our sample files and don't change their names.

You'll also paste in a folder of scripts. Like the fields, most of these come in without requiring any modification. There is one script you'll want to change: more on that below.

Step 3.1: Adding a new table to your mobile file

Pasting in the gz table.

Open one of GoZync sample mobile files (like QuickContact) and copy the gz table, pasting it into your mobile file. The table requires no modification and no records. You do not need to do this in your hosted file.
If you don't have FileMaker Advanced, and can't copy and paste tables, we're happy to do this step for you. Send your mobile file to support@seedcode.com or get in touch if it's too big to email.

Step 3.2: Add required fields

You'll need to add a couple fields to your tables to get GoZync to work.

The fields are listed below. If you have FileMaker Advanced you can simply copy and paste these fields from one of GoZync's example files (be sure to copy the hosted fields from the hosted example file, the mobile ones from mobile).
If you don't have Advanced, just recreate the fields in your table, paying special attention to the field's type and auto-enter definition (if any). Or get in touch; we offer implementation packages to wire this up for you.
And while you need these fields in your tables, you DON'T want them on your sync layouts.
Hosted.
The hosted tables only require a single new field named "gz_ModTimeStamp". Copy this field from QuickContactHosted.fmp12.
Mobile.
Your mobile tables require four GoZync fields:
gz_ModTimeStamp
gz_Send
gz_LatestAction
gz_TimeStampZynced
Copy these from QuickContact.fmp12 (our mobile example file). None of these fields will require any modification after being pasted in.

Modification of related records.

If the table you're syncing is the parent to related records, take a moment to read about how GoZync considers a record "changed" as you may need to add some some scripts so changes to related records still trigger a record to sync.

Step 3.3: Required Scripts (Mobile file only)

Pasting in scripts.

Again, open one of GoZync sample mobile files (like QuickContact.fmp12) and in scripts you'll see a folder called "GoZync".
Be sure that the example file you're copying from is in the same folder as your mobile file and GoZyncMobile.fmp12
Then copy that folder and paste it into your mobile file. (You don't need to add these to your hosted file.) If you don't have FileMaker Advanced you can import the folder of scripts by clicking the "import" icon in the lower right of the Manage Scripts window in your mobile file.
You only need to edit one of these scripts, "Zync - Is a new version permitted". Toward the beginning of that script we go to a layout based on the primary TO you're syncing. Edit the script so you're going to the right layout. You can return to this script later to add additional branches for other TOs you may be syncing in the same file.
Note that the script "Zync It - This Table..." will be one of your go-to scripts for sync. You can call it without a script parameter if the Table Occurrence (TO) name of the layout you call it from matched the name of one of your sync TOs in GoZyncMobile (without the gz... prefix). Otherwise pass in the TO name from GoZyncMobile as a script parameter. Example:
Your TO in GoZyncMobile is "gzm_Contact" but the layout in your mobile file is based on a TO named "People". Call the script "Zync It - This Table..." passing in a parameter of "Contact". You wouldn't need a parameter if the layout in your mobile file were based on a TO named "Contact".

Step 3.4: Edit the Go To Related Records Script in GoZyncMobile

There is one script to edit in GoZyncMobile. Learn what needs to be changed here: Set Up Go To Related Records.

Step 3.5: UUIDs

Convert your primary keys to UUIDs.

Each table you're going to Zync, both on the mobile and hosted side needs its primary keys converted to UUIDs.
For more on the rationale here and details on what UUIDs are, read our article on UUIDs.
If you're already down with UUIDs, change your primary keys to Text fields with an auto-enter calc of Get(UUID). Uncheck "Do not replace existing value..." and check "Prohibit modification..."
Take your existing ID field and...
1. Turn it into a text field (you may have had it as a number originally).
2. Add an auto-enter calc. Click "Options" and then "Specify" next to "Calculated value". Enter the following as the calc definition:
Get ( UUID )
Your calc should look like this:
3. Set it to not be modifiable. Click "OK" on the screen above and make sure your auto-enter options are set like this:
Be sure to do this in both your mobile and hosted files. And if you're creating these fields just for sync, be sure they're indexed (in field options, click storage and either check "Automatically create indexes...")

Check your work

Head over to GoZyncHosted and visit the Configuration tab again: click "refresh" and see if your fields check out. If they don't, click on the caution icon beside them to see what's wrong.

Now click on the checkbox area in the "more" column: if you've done everything there click "done".

Next...

Move on to the next step.

Now you can move on to the last step. Continue to step 4 of 4
Or return to the Integration Overview.
Retrieved from http://www.seedcode.com/pmwiki/pmwiki.php?n=GoZync4.Integration3Of4
Page last modified on March 08, 2014, at 12:54 AM