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.

exporting as .csv question

Featured Replies

I have a script to export a found set of records as a .csv file, but I would like the file to be named dynamically. As it is now, the file is named untitled.csv

Is it possible to have the filename also include the date of the export. ie export-oct-01-04 ?

Thanks

Not with FileMaker. With AppleScript or a plug-in (or possibly other). What operating system does this have to work on? It's best to specify that when asking questions about external files. I don't want to assume just from your profile, which is Mac, as you may want it to work cross-platform.

The "universal" answer is to export to a fixed-name file and user-accessible common location, then rename with another tool. Just where that location would be, and what tool is the question.

  • Author

Thanks for the reply,

It would be used on Mac first, and then possibly used for on Windows as well. I kinda figured that it would be hard to do in filemaker. I know that Excel can do it, so I thought Filemaker might as well.

No big deal, I can work around it.

Thanks again.

Darron

Actually it's rather easy to do on both platforms, without a plugin.

Both Command line interfaces support the 'echo' command. All you need to do is to loop through each record and calculate an echo command that takes the data of each field you want and sepearate it by a comma. This completely bypasses the FM export engine so it is a flexible as you want it to be.

At the start of the script you would calc an echo command that would result in something like this:

(using the Windows example)

cmd /c echo "fieldname1,fieldname2,fieldname2">c:myCSVexport.csv

Notes:

- "cmd /c" invokes the windows command line interpreter and tells it to quit when done

- echo ... wells echoes what follows literally

- ">c:..." redirects the output to a file instead of to the screen

Then loop through each record and for each one calc an statement like this:

cmd /c echo "data1,data2,data3">>c:myCSVexport.csv

Notes:

- the redirect command is ">>" this time. That one appends to the existing file instead of creating a new file.

The syntax is pretty much the same on OSX since it's Unix.

  • Author

Wow,

Thanks for the reply. I definitely would never have thought of that.

Unfortunately, that still doesn't seem to append the name of the export with the current date automatically. Also, I don't think I would be able to write once, then use on both platforms.

Very interesting tho.

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.