From SeedCode Documentation

GoZync5: Integration1Of4

Editing Relationships in GoZyncMobile and in Your Hosted File

You may have a big mobile solution with lots of entities to sync: contacts, invoices, price lists, etc. But the one you're working with now this first table to sync is the main table for one entity. Your invoices table, for example. (Invoices is the "entity" even though it is made up of an invoices table and an invoice line items table.)

When you're done with the 3 steps here, we'll show you how to use the Configuration tab in GoZyncHosted to check your work.

Step 1.1: Add your hosted table occurrences to GoZyncMobile

Choose File / Manage / Database in GoZyncMobile and select the relationships tab: click the "+" button in the lower left to begin adding a new table occurrence.

If this is the first table you've wired up from this hosted file, select "Add FileMaker Data Source" from the Data Source menu and select your hosted file. Now select your file and select the table you're working with.

If you had to add a FileMaker Data Source, find the file you're interested in and then select the table as described above.

Your table will be added to the relationship graph: change its name so that it begins with "gzh_" like our "gzh_Contacts" table occurrence (TO) does. All the TOs from your hosted file will be prefixed "gzh_".

Place this TO on the "left wing" of the graph.

Step 1.2: Create the same table occurrence in your hosted file.

Having added a table occurrence named "gzh_Contacts" to GoZyncMobile, you'll now add the same table occurrence to your hosted file--to your mothership file, represented by WorxHosted in our example files.

You don't need to mess with external data sources though as the base table is already in your hosted file. Simply create a new instance of the same table occurrence you selected in step 1.1 and give it the same name.

(If you want to see what this looks like in our Worx example file, you'll see a TO named "gzh_WorkOrders" in both GoZyncMobile and in WorxHosted. Crucially, these point to the same base table.

Step 1.3: Add your mobile table occurrences to GoZyncMobile

Here you'll do the same thing as in step 1.1 above, but you'll choose the corresponding table from your mobile file. (If this is the first table you've wired up from this mobile file, select "Add FileMaker Data Source" from the Data Source menu and select your mobile file. Now pick the table as you did above.)

Your table will be added to the relationship graph: change its name so that it begins with "gzm_" like our "gzm_Contacts" table occurrence (TO) does. All the TOs from your mobile file will be prefixed "gzm_".

Place this TO on the "right wing" of the graph. There is no corresponding action to take in your hosted file.

A Note about TO names:

The corresponding base tables in your hosted and mobile files may have slightly different names. For example, the Invoices table in your hosted file may be named "Invoices", while the one in your mobile file may be named "My Invoices". Whatever the names are in your files is fine. However, the names you give these TOs in GoZyncMobile much match, aside from their "gz..." prefixes. So in the "My Invoices" example here, you'd need to rename that TO "gzm_Invoices" so it matched the name of its hosted counterpart "gzh_Invoices".
The name used for the gzh_... tables in GoZyncMobile must also match those used in your hosted file.

Step 1.4: Link your new TOs to the GoZync TO

Continuing on the relationship graph of GoZyncMobile, create relationships between your new TOs and the GoZync TO just as you see relationships between "gzh_Contact", "gzm_Contact", and "GoZync". Eventually all your synced table occurrences will be related this way:

A few couple to double check about these relationships:

The relationship is from the primary key or unique ID of your table to the field "PrimaryID" in GoZync.
Your tables side of the relationship should have "Allow creation of records..." turned on:

A Note About the Free Version

LowZync, the free version of GoZync, only supports syncing a single Table Occurrence and ships with our Worx example file already syncing. If you want to sync your file instead you'll need to stop syncing Worx or purchase a GoZync license. Here is how to remove Worx from the sync before you move on to check your work:

First, you may want to make a backup of these files incase you'd like to refer to a copy with WorxMobile integrated.
Next, head over to GoZyncMobile and go to the relationship graph again. Change the prefixes for the two WorkOrders... table occurrences by putting an "x" in front of their names so they become
That's it. TOs without the "gz..." prefix are not considered for sync and will be removed when you hit "refresh" on the configuration tab of GoZyncHosted.

Step 1.5: Link table occurrences in your hosted file

If this is the first table you're wiring up in your hosted file then you're done. But if you're adding a related table to the sync you'll make a different kind of relationship for it in your hosted file.

You'll like the gzh...table occurrences in your hosted file the same way you want to sync them: so if all of the gzh_ occurrences are being synced on their own, you don't need to make any relationships. If some are being synced as related tables you'll link them together from primary key to foreign key as you see "gzh_WorkOrders" linked to "gzh_WorkOrderItems" in our Worx example file.

If this is a related table occurrence you're creating, read up on related syncing here: Related Records

Check your work

Head over to GoZyncHosted and select the "Configuration" tab. Click "refresh" toward the right hand side of the screen and GoZync will read the relationships you just edited. If you see a green check mark in the "Table Occurrence / ID" column in both the hosted and mobile columns, then you've done everything correctly.

If this is the first table you're wiring up, you may get a warning that the "GTRR" scripts aren't working. Don't worry, we'll get to them sooon.

If you see a caution icon instead in any column instead of a green check, click on it and GoZync will tell you what's missing in the configuration. (You can click on the green check mark also if you'd like to see all the things you did right.) Click refresh after each of your changes until the caution icon goes away. You can return here throughout your integration to check your work in this way.

When everything checks out green, you're ready to move on.

Next...

Move on to the next step.

Now we'll create simple layouts in GoZyncMobile and your hosted file based on the new gzm_ and gzh_ TOs you just added. Continue to step 2 of 4
Or return to the Integration Overview.
Retrieved from http://www.seedcode.com/pmwiki/index.php?n=GoZync5.Integration1Of4
Page last modified on April 29, 2015, at 05:29 PM