2015

Jul

10

Av

Many users work with a single FileMaker Pro database, copy the database to a mobile device, make changes and then copy it back to the desktop computer. If the database is small it can easily be copied between the desktop computer and the iOS device using iTunes, mail, or whatever. If the database is big it can be to time-consuming to copy the whole database back and forth. I spent some time earlier this year to develop a solution (well, “hack” might be more accurate) where I import/export only part of the data, exchange only the updated information between the main database and a small local copy at a iOS device, using Dropbox as an intermediate storage.

With this kind of solution you don’t need a FileMaker Server, you don’t need to connect the iOS database to your desktop database, you bring only the data you need to your iOS device, and you can even use a FileMaker Runtime solution on your desktop. You work locally on your iOS device and you don’t need any internet connection except when importing or exporting changes, which can be done when you have WiFi access. Dropbox is a free service, at least for small amount of data.

The idea is to keep track of all changed (and deleted) data in the desktop database and click an Export button when you want to save the changed information to a Dropbox file. In your local iOS database you then click an Import button to get the data from Dropbox, run a script to update the relevant records, and also remove the file from Dropbox when imported. And, of course, vice versa.

With this very simple import/export strategy it is not possible to change the same record on both places, and you can only have 2 databases exchanging information. The point is that the two databases is never connected to each other, all communication is through files saved in Dropbox, and it is easy for a single user to keep a desktop database and a local iOS database in sync.

I made a small sample to demonstrate the functionality. It is more like a “proof-of-concept”, it lacks features like error handling etc. The demo is simple, it is only one table with a few fields. I have made a short video, you can watch it below.

The demo is made up by the following techniques:

  • a Dropbox App, you make one in the Dropbox App Console. Choose the App Folder permission. You will need the App key (client id) and a redirect url for OAuth 2 authentication. The redirect url can be to a very small and simple html file (it only needs to say “Hello”), but it needs to be available on the internet. I put mine on Dropbox and made a public Dropbox link to it, it works fine,
  • a web viewer to authenticate the FileMaker database with my Dropbox account. You will get the access token from the url parameters when authenticated by the user, I use the function GetLayoutObjectAttribute ( “dropbox”; “source” ) to get the url including the access token. The access token is saved in the database and used for all other Dropbox communication,
  • web viewers executing Javascripts, I use AngularJS (I am a little bit addicted to it), ngDropbox, and some minor javascripts to write files to Dropbox, get a listing of all files in a folder from Dropbox, and remove imported files from Dropbox. Almost all the “magic” happens here,
  • the fmp protocol to get Dropbox file listings from a web viewer to FileMaker,
  • the Insert from URL script step to import data from Dropbox,
  • scripts in FileMaker for exporting and updating,
  • no plugins, the same technique works on both OS X, Windows and iOS.

In the video below I have FileMaker Pro to the left and a iPhone device to the right. Both are using a local database, the only connection is the Dropbox folder which is down to the right.

 



 

(There is no demo file.)

Skriv en kommentar

  • (will not be published)
  • seven − 6 =

Läs också: