Exporting to vCard from FileMaker

FileMaker Pro

FileMaker doesn’t offer the same level of system integration with OS X as it’s little brother Bento, although it offers more power. It is possible, however, with a little work to extract the data you want to use, in the format you need.

The advantage of being able to export a contact to a vCard is obvious. Once you have the vCard you can then import that vCard into Apple Address Book and from there into your iPhone or your Blackberry, pick your poison.

Oh and you can of course export either one contact record or all of the records.

So how do we do it?

A little googling led me to this post by Simon Page which provides an excellent guide on how to achieve this solution via a custom function, without any plugins.

Like Simon I stored the results in an un-stored calculation field and used the linked XSL stylesheet to facilitate the export. You can find a link to the standard stylesheet here.

My adjustments

I have adjusted his custom function, which I’ve named (following my conventions) export.vcard to add the following available fields in the vCard:

NICKNAME

This is simple enough to achieve:

Add the parameter:

AKA

Add this to the variables:

_Nickname = AKA;

Add this to the formatting for the vCard:

vnickname = _Nickname;

Add this to the final formatting:

“NICKNAME:” & vnickname & “¶” &

PHOTO

I’ve tried this with a series of combinations of the above, with images held in the file as well as stored with a reference to no effect. So I decided to take a look at a vCard from Apple Address Book with TextMate only to discover it’s encoded in base64. So for the moment I’m stuck, but I’ve a few leads, and I’ll update once I’ve found a solution.

BDAY

This is a little more complicated to achieve. You must export the date field in the right format. Here in the UK we format our dates as DD/MM/YYYY but for it to work with the vCard format it needs to be formatted as YYYY/MM/DD, so I created the following custom un-stored calculation field: c_Formatted_Date_of_Birth.

Rather than perform the calculation in the field I heading over to Brian Dunning’s site again and picked out a suitable custom function to allow me to reformat the date I had in my Date_of_Birth field. I chose this one penned by Tim Anderson. And I was able to provide the date in the format I needed. Then I just needed to:

Add the parameter:

DOB

Add this to the variables:

_BDAY = DOB;

Add this to the formatting for the vCard:

vbday = _BDAY;

Add this to the final formatting:

“BDAY:” & vbday & “¶” &

Updates

I’ve not yet completed my final vCard export routine so I’ll update this blog post with more information as I build out the new database. So check back for more.

Filed under: FilemakerTagged with: , , , , , , ,