Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Export Field Contents quirk

Featured Replies

I have a field that compiles the record data into iCal code (.ics). Then I use the ExportFieldContents function to create a .ics file to import into iCal. But! When it exports the data, it adds really weird formatting that makes iCal unable to read it. The .ics file starts with a random "<^" and then has weird spacing format issues (I have to press the arrow key or delete key two times in order to even move the cursor).

If I copy the field contents and manually create a .ics file, iCal sees it no problem and imports it. But if I use ExportFieldContents, iCal says the file is "corrupt." Any ideas on how to fix this problem?

Thanks!

  • Author

Okay, this zipped file contains two examples of my data export.

iCal_fieldExport.ics is the data directly exported from the global field.

iCal_CopyPaste.ics is the data copied from the global field and pasted into a TXT document then saved with the extension ".ics"

If you open them up with iCal, iCal_CopyPaste.ics works but iCal_fieldExport.ics does not --- it gives an "unreadable" error. If you open both of them up in a rich text editor (such as BBEdit, not word or TextEdit), you can see the "<^" thing and the spacing issue I'm talking about with iCal_fieldExport.ics.

Ideas?

ics_Files.zip

The difference is in encoding: field export is always encoded as UTF-16. I guess iCal doesn't like that.

It's the utf-16 encoding. Which you can see if you look at the lower left, in the status bar of BBEdit (which is a text editor, TextEdit is a rich text editor). That's the default (and only) encoding for Export Field Contents.* The "good" file is utf-8.

A quick way, on a Mac, of getting a utf-8 file is to just write the file using a shell script command, running it with AppleScript, in a Perform AppleScript step. It produces a utf-8 file by default, and also translates FileMaker field internal carriage returns (ASCII 11).

-- tell application "FileMaker Pro Advanced"

	copy cell "filename" of current record to fileName

	copy cell "Text_" of current record to exportMe

	do shell script "echo -n " & quoted form of exportMe & " > ~/Desktop/" & quoted form of fileName

	-- -n prevents a final line feed from being added

-- end tell

~/Library/Calendars/ is the user's calendars directory, if you'd rather use that.

You don't need the tell FileMaker lines inside FileMaker; but you do need them in Script Editor, so I leave them in, but --commented. In the above I'm only taking the file name from a FileMaker field, adding it to the path to the user's desktop.

  • Author

Oh man Fenton, that's perfect! I thought about AppleScript briefly but am not very fluent. I made some mods to your AppleScript so people can specify a custom filename (via Filemaker CustomDialog).

(Ooo, understood about BBEdit and TextEdit. Makes sense.)

Perfect! Thank you so much! Lifesaver!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.