GoZync2

Primary Keys

How can I ensure my ID make the "round trip" from host/server to mobile device and back again?

You want your IDs to make this "round trip" if you want to edit existing records on the server or mobile device. When GoZync finds records with the same IDs as ones it's pushing or pulling, it edits those records instead of making new ones.

So how do you tell GoZync which field is the primary key in your table?

Simple: in the "Set XXXX Fields" scripts (the ones that do field mapping) you'll see a comment beginning "If you wish to edit an existing record..". Simply follow the instructions in the next script step to pass in the primary key (ID) of the table you're editing.

Note that in your field mapping layouts (the ones in the Outbox folder of layouts), you'll also want to make sure that the first field on the main tab of the layout is the primary key (ID) for that table. (And here "first" means the first field in tab order.)

Do I need my primary keys to be unique across all mobile devices (UUIDs)?

No. And in most cases your IDs in the mobile file don't need to be unique across all your users if you're making new records when that data comes in to your hosted files.

If you're editing records in your hosted files, you'll have brought those record's IDs down into mobile so you don't need to worry about that either.

The IDs in our sample invoices file show how to concatenate the user's name and build number into the ID so that you can tell records apart in InBox if you need to. This is really just for debugging.

The only time you'd need to have the ID created in Mobile persist into the hosted file is if you want the mobile user to be able to post multiple edits to the same record without downloading that record from the host. This is a fairly specialized case and we'd encourage you to get in touch and help us craft such scripts for you. In most cases users will post a record, delete it from mobile (either manually or as part of getting a new build down) and if they need it back again it will come down from the server/host with it's newly created ID.

(855) SEEDCODE
[email protected]
Follow us: