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.

Import txt into field

Featured Replies

Hi,

Is there a way to import a txt file into one single field instead of breaking it up into multiple records? I'd like to import the whole content of one txt file into one field / variable! Any help would be appreciated!

Robin

I can think of a couple of ways. A native FileMaker method would be to use the Import Folder step. It will import text files into a single field. But, of course, you'd have to put the single file into a folder first.

Another slightly more difficult, but more convenient method would be to use AppleScript to read the file, then set it into a field.

Or use a file plug-in. But that's really the same thing, for more money.

This is an AppleScript that reads a chosen text file using the Unix "cat" command line. It creates a new record in the frontmost FileMaker window with the name and contents:


global theName

global theContents



set theFile to choose file with prompt "Choose a text file"

tell application "Finder"

	set theName to name of theFile

	set posFile to quoted form of POSIX path of theFile

	set theContents to do shell script "cat " & posFile

	-- converts Unix to Mac returns

	my FM_Create_Record()	

end tell



on FM_Create_Record()

	tell application "FileMaker Pro Advanced" -- not needed in FileMaker

		tell window 1

			set newRec to the ID of (create new record)

			go to record ID newRec

			set cell "Filename" of current record to theName

			set cell "Contents" of current record to theContents

		end tell

	end tell -- me neither

end FM_Create_Record

  • Author

Thanks a lot for the reply! As this application will also be running on a PC client (no Applescript), I think the easiest way is for me to do the import folder step and make sure taht just that file is in the folder!

Robin

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.