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.

Script to export a single field from many records

Featured Replies

Hi All

I have a simple FMPro 8.5 database and I am trying to write a script in Scriptmaker to write one file for every record, containing the content of just one field, and with the file named according to the content of a different field.

The following is a screenshot of what I have tried to do:

Picture 283.png

It doesn't work, of course!!

I have 2 problems :) (1) I don't know how to create the filename out of a field's content [so I've used qqq.htm just as a placeholder, until I could figure that out]; and (2) I'm not sure how I'll get a set of files (one for each record) written into the folder I want (called "specimens", in the same folder on my Mac as the FMPro 8.5 database resides.

Could somebody please help me to get it to do what I need. Mnay thanks. Philip

Not sure if it will work with 8.5. but you need to create a variable for the file name, and then use that variable as the name in the export dialogue box.

In this case my variable = '$file'

Set Variable [ $file; Value:

Get ( DesktopPath ) &                     //this is the path to your desktop

last_name &                                    //this is the value from one of the fields

".csv"                                               //this is the file extension

]

Go to Record/Request/Page [ First ]

Loop

Set Variable [ $file; Value:Get ( DesktopPath ) &  export field::last &  ".csv"  ]

Export Field Contents [first_name; “$file” ]

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

First, put the Go To Layout step above the Loop. Notice that rivet checked the "Exit after last" option (or the loop will never end), and rearranged your steps.

The file path to the folder of the FileMaker file (on a local computer, not a hosted file) can be calculated, result Text, Storage [x] Do not store.

Substitute ( Get ( FilePath ); ["file:/"; ""]; [Get ( FileName ) & ".fp7"; ""] )

Example: Macintosh HD/Users/fej/Documents/FileMaker/My_FM/CONTAINER/Blobbo/

Add an "absolute" prefix & your file name to this.

"filemac:/" & Substitute ( Get ( FilePath ); ["file:/"; ""]; [Get ( FileName ) & ".fp7"; ""] ) & "file name.txt"

Typically you would get the file's name from some unique field (ID) in the FileMaker record, and use in the above calculation, instead of "file name".

  • Author

Thank you, rivet. That worked perfectly! Regards, Philip

  • Author

Thank you, Fenton. Rivet's answer (and your explanation) worked perfectly! Regards, Philip

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.