Jump 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.

Featured Replies

Hi,

 

it's probably very easy, but I don't know how to access the data inside of a container field.

 

I have a script that inserts a small text file (insert, no reference) into a container and all I can see is a file icon with the filename. When I use «GetAsText(ContainerField)», I only get the filename. But how can I access the data inside of this container/file?  I need to perform a couple of text manipulations and store the results in another field of this record.

 

Thanks so much for any help.

 

Gary

 

That's not something that FM supports natively.  When you insert a file into a container, you insert the binary file, not the contents of the file.  If you need the contents you will need to resort to a plugin for that.  Or do some OS-level manipulation using the OS scripting languages.

  • Author

Thanks for the quick reply!

 

So, what you are saying is that there is no way to access even the binary data?  Wow, that's a surprise.

 

I don't know enough AppleScript (I'm on a Mac) to be able to do this.  Any suggestions?

 

Thanks a lot,

 

Gary

  • Author

After a couple of hours of trial and error, i have found the easiest way to read a text file into a text field, using a shell command inside an AppleScript (Mac only):

 

Compose a variable $script (for example) and use it in an AppleScript script step:

 

$script =

- - - - - - - - - - - - - - -

 

set fn to choose file
copy POSIX path of fn as text to cell "Path" of current record
set cell "Text" of current record to (do shell script "cat /Users/gc/Desktop/A00542721.txt")

- - - - - - - - - - - - - - -

 
The pathname is still hard coded here, so that you get the idea. I have divided that into two small scripts. In the first, I am saving the file name of the file that the user chose into a gobal «Path» field. And in the second I use this path field to read the contents of the file into my field «Text».
 
I hope that someone finds this useful.
 
I'm still puzzled that FileMaker can't do this simple task by itself.
 
 
Gary

Create an account or sign in to comment

Important Information

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

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.