Syncing up external Filemaker data with Rails

One of the web apps I work on leverages a Filemaker database. My co worker Brent the expert Filemaker dude, and I had a serious problem to tackle - how to get Rails and Filemaker talking to each other.

Now Filemaker has iffy SQL standard support and we didn’t necessarily want our web app to run live from the Filemaker database. We spent some time looking at making an ActiveRecord adapter for FM but really at the end of the day it was too much like hard work.

There are 3rd party solutions out there that can do this stuff for you, but if your needs dictate that they won’t work - our experience may help you. I’m going to write up the theory behind this which has been live in production for a good 6 months + and in the coming weeks will release some code acts_as_syncable or similar…

First off we wanted it occassionaly connected, one way synchronising. We had an installed instance of Filemaker Web Publishing engine so we could expose our data as xml views. We used a background rails (backgroundrb) process to query Filemaker every 5-10mins and ask for changed data, pull that data using REXML, and populate/update on the Rails side using ActiveRecord.

Here’s the mechanics…

Possibilities become real.

A while back, at a previous company, our clients inundated us with feature requests. At one point at the infancy of this software’s life, the codeword for “thank you for your request, we’ll try to get it into the software” was called Possibilities. It always left the door open, however I’m sure the rate at things went through the door and never came back (well not until years later!) possibilities became a dreaded word…

Now however (my personal belief) is between Rails and Flex turning the seemingly impossible to implement round in no time at all. After a rocky road start to Flex, I’m now having the opportunity to develop a full blown B2B application in it. Replacing a PHP/HTML solution. Both exciting and nerve racking - last night a good 2 hours was spent tracking down how exactly to get something shown in the correct order.

I am well impressed, and looking forward to the future of possibilities with Flex 2, Apollo (and what Flex 3 may bring). To share my enthusiasm a good portion of this blog is going to be dedicated to documenting the rebuild of the previously mentioned B2B application.

Currently I have client buy in, after ~ 6 hours of knocking up simple interface showing off a very ‘windows like’ application within a web browser he’s sold on it, so it’s now the big re-write.

Here’s the starting point for it:

- A rails app with database migrations to take the v1 app’s database and migrate it into a rails friendly naming scheme.
- Basic objects replicating core functionality within Rails
- Two flex front ends, one for general order management, and the other a tailored interface specifically for manufacturing.

So far, here’s my pro’s and con’s list

Pro
+ It’s going to work once, anywhere. Flash bugs cross browser are fee and far between. (compare that with XHTML/CSS/JS)
+ More native application functionality (drag/drop, grids etc)
+ Less network traffic per session
+ More responsive application

Cons
- Write, compile, write, compile, write, compile (although Flex Builder/Flex compiler shell reduces the pain)
- A lot more code in building the interface
- Guess work figureing out how to do complex stuff
- Loosing some of Rails niceties (or duplication of things like validations)

Next up some screenshots….

Continue Previous page

About

Rowan is a Director of Technology for a large marketing services company, specialising in architecting, developing and putting web applications into production - in particular Ruby on Rails based apps. He lives in Toronto, Canada but speaks in a funny accent as he's originally from New Zealand. He's been working in the software and web business for over a decade. This blog covers Web Application development and deployment in the real world, dealing with topics from business fundamentals to Ruby on Rails, Merb, PHP, Flex, MySQL, Apache and more.

Read more ...

 

 

View Rowan Hick's profile on LinkedIn

 

Subscribe to my RSS feed