From the Field: Synchronizing Multi-User Databases - File Maker

So what if you do want to synchronize some databases with a handheld, but the databases are being hosted by your LAN via FileMaker Server, which FileMaker Mobile doesn’t support? Can it be done? The short answer is yes, but with a price.

Because you cannot actually just turn FileMaker Mobile sharing on for a database that is being hosted via FileMaker Server, you’ll have to move the records out of the hosted database into a single-user “agent” or proxy database that can then be synchronized and offloaded to your handheld. When you want to sync up again later, bringing data from the handheld back into your hosted database, you likewise must first sync with the agent database and then merge those records with the main database using some all-manual or somewhat automated process where the agent database and the master database talk to each other.

Agent Database
The agent database need be nothing more than a rough copy of the master database, containing only the fields you plan to sync with the master database.

The agent database must be single-user, that is, anyone who wants to sync to the main, shared system would have their own copies on their own local hard drives.

Whenever you want to hit the road, you would go to the master database, select which records to send to the handheld and click on them or mass export them to the desktop agent database. Then you would press the HotSync button and the records would be offloaded to the handheld from the agent database. Later, when you sync back to the agent database to bring your altered handheld data in, you would HotSync again, making sure the sync was set up to have the handheld overwrite the desktop, which is important because you only want one set of records in the agent database at one time.

Change Reconciliation Challenges
Once the records are back in the agent database, you need to walk through them and make some decisions. Certainly you could automate filtering out all records on both ends that hadn’t changed at all, but after that you would have the following kinds of records left in the agent database to deal with:

  • Records modified in the handheld.
  • Records created in the handheld.
  • Records deleted in the handheld.

Probably, this isn’t hard to figure out what to do if there aren’t a lot of users on your database system, and you trust your users to make such decisions as far as which changes, the handheld’s or the master system’s, win.

However, it gets a lot stickier when you consider that this is a multi-user system you’re dealing with and, while you were away with your handheld, records could also be created, deleted, or modified in the master system. So you’ve got to control what’ll happen when:

  • A record is modified one way in the handheld and another in the master system.
  • A record is modified one way in the handheld and deleted in the master system.
  • A record is not modified in the handheld but is modified in the master system.

There are probably other possibilities that aren’t listed here, and you would be wise to draw out all of the possibilities so that the coding in your agent database can control for all of these scenarios. Another potential flaw in this solution is how to deal with record locking.

Example System

On the CD-ROM in the Agent Database Example folder, you’ll find an example of what’s been described above, a way to sync data in a multi-user database system to a handheld using FileMaker Mobile and an agent database working as a proxy between the handheld and the master copy of your database.

What you have here is a basic contact database (People.fp5) that would be shared via FileMaker Server. AgentPeople.fp5 is the agent database that would be located on each user’s local hard drive.

To try this out, first open People.fp5 and find only those records you want to send to the handheld, omitting the rest. Next, go to AgentPeople.fp5 and click the Import Master button, which gets the People.fp5 records into the agent database.

Next, do a HotSync. Now go to your handheld and edit some records, create some, and delete some (not by actually deleting them, but by checking the Delete Record checkbox at the bottom of a record’s detail view. Now HotSync again, go back to AgentPeople.fp5, and click the Reconcile button. You’ll see a layout like this:

Example System

On the left you see records that were in the handheld; on the right you see records in the master-served database. Now you can flip through these records one by one and decide what to do with them. The example database set up to control for the following possibilities and to allow these options:

  • Keep the master record.
  • Keep the handheld record.
  • What to do when a record is deleted in the master record but not on the handheld.
  • What to do when a record is deleted on the handheld but not in the master record.
  • Adding new records to master database that were created on the handheld.
  • What to do when a master record is locked from updating by another using while you’re trying to reconcile that record.

For your information, this is what the AgentPeople.fp5 Specify Fields dialog (accessible via File > Sharing > Mobile Settings > Specify Fields) looks like:

FromtheFieldSynchronizingMultiUserDatabases


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

File Maker Topics