Export vCardsby dougalder
The purpose of this script set is to export a standard .vcf or vCard files for importing into Contacts applications. The scripts are designed for easy integration with data tables which contain contact and address information. The export should work on Mac/Windows and iOS. The export can handle a Note field with carriage returns with limitations. The script substitutes all carriage returns out of the fields. Carriage returns in address fields may cause problems with the vCard export.
Virtual List Technique
Why use a Virtual List to Export this file?
The reason for using the Virtual List technique is because of UTF-8 text formatting issues. The script step ‘Export Field Contents’ generates a UTF-16 formatted text file, which some Calendar apps don’t see as valid. The ‘Export Records’ step has the option of generating a UTF-8 formatted text file, which Calendar apps accept.
Required Version of FileMaker
Created in FileMaker Pro 13, but could probably run in FM12 (not so much the demo file which has FM 13 specific aspects, but the scripts themselves). There is nothing specific that would not allow this to run in FileMaker Pro 11, if you take the time to recreate the scripts in FM 11.
Before Importing the vCard Export script, import (or create) the Virtual_List_Utility data table to your solution.
Virtual_List_Utility table should have two fields:
- ID_VL (auto-entry serial number field)
- virtual_list – a calculation field – GetValue($$virtual_list; ID_VL)
UUID Field – If you don’t already have a UUID field, add one to your Contacts table using FileMaker 13’s Get(UUID). A UUID will help identify the record when you reimport the same record and have the contents match up. If you are working in earlier versions of FileMaker, there are Custom Functions to create UUIDs (www.briandunning.com). Once you add a UUID field, remember to go back and enter a UUID for every record created before the addition of the UUID field.
Import the vCard Export scripts to your solution and map your fields to the variables at the top of the script.
Map Your Fields
Once you have the Virtual_List_Utility table in place, copy and paste the Export vCard scripts into your solution and edit the fields in the REQUIRED FIELDS script section.
Copy or Create ‘Export vCard’ Button
Copy or create a button in your solution that calls the vCard Export script.
Place the button on your layout for users to export contact info to other contact applications that support the vCard (.vcf) format.
Test the new module on your own data. See HomeBase Software for more troubleshooting tips if you have problems.