Export .ics Calendar Filesby dougalder
EXPORT ICS CALENDAR FORMAT FILES
The purpose of this module and scripts are to export an .ics file for importing into Calendar applications. The scripts anticipate Single Event or Batch event export. The Main script has a branch for Saving the export file to disk (and opening in the local calendar app) or Emailing the event file. .ics files can be read by most calendar apps such as Google Calendar, Apple Calendar, Microsoft Outlook etc. The script is designed for integration with data tables that include a Start Date, Start Time, End Time, Event Name and Event Description at a minimum.
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. Export Field Contents generates a UTF-16 formatted text file, which some Calendar apps don’t see as valid. Export Records has the option of generating a UTF-8 formatted text file, which Calendar apps accept. The export should work on Mac/Windows and iOS. The export file type is set to Windows ANSI, which seems to work on both platforms.
REQUIRED VERSION OF FILEMAKER – created in FileMaker Pro 13, but could probably run in FM12 or be rebuilt for FM7 format.
1) IMPORT VIRTUAL_LIST_UTILITY DATA TABLE
Import or recreate the Virtual_List_Utility data table in your solution.
REQUIRED FIELDS – 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)
2) UUID FIELD – If you don’t already have a UUID field, add one to your EVENTS 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, recreating this script set, 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.
3) IMPORT SCRIPTS – Copy and Paste (or recreate) the ‘Export ICS Files’ Folder of scripts in to your solution.
4) EDIT REQUIRED FIELDS – In the REQUIRED FIELDS Script, map your local date, time, description etc., fields to the approprirate script variables.
5) CREATE OR COPY BUTTON – Copy or create a button in your solution that calls the ICS Export script.
- Place the button on Events layout for users to export Event info to other calendar applications that support the Calendar (.ics) format.
6) ADD A VALUE LIST called ‘1’ with a value of 1. Set the ‘All Day’ Field to be a checkbox using this value list.
- Use the script debugger to walk through the steps. See what the variables are being set to.
- If you have problems with your file, open it with a text editor (TextMate on the Mac is great) and review what is being exported. Compare the generated file to an event exported from iCal or other calendar app.
More detail here: hbase.net
Update 2014-12-23: Version 1.1: Support for All Day and End Date fields. Previous version took a short cut and always made the End Date = the Start Date. Modified REQUIRED FIELDS script to export different version of file if ‘All Day’ is set to ‘1’. May be an issue with offset. It has been removed from the ‘All Day’ switch because it was causing issues depending on the time zone.