Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3691 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

What is the simplest way to export a found set of related records as a CSV file (using Export Field Contents script step) that includes a custom header row?

Posted (edited)

What exactly is included in "custom header row"?

 

---

Actually, upon re-reading your question, I find I don't understand it at all. There is no such thing as "a found set of related records". You always export records in the found set of the current table - and you can optionally include fields from related records in the export. And what does the Export Field Contents script step have to do with exporting a set of records?

Edited by comment
Posted

With FM 13 you can use a calculation field and then new List Of Summary function and to generate a quoted and comma separated list then export the contents of this field.

 

You can also use Execute SQL to populate a global field to export out and add in the column header row and all the contents - (however Execute SQL, may require a bit more to isolate your found set - or rather your query may need to isolate your records - as SQL has no concept of found sets )

 

Just be aware that using Export Field Contents will encode the file as UTF-16 where as standard exports as CSV will export as UTF-8. So there could be some issues if you are uploading this file to a third party.

 

Another thing you can do is to use a variable to export records as MERGE FILE FORMAT and just append the ".csv" extension this will allow you to include the column headers (field names)

 

The other option is to use ScriptMaster (plugin) to allow you to write a file to the desktop where you can get data written out from a field or variable and will allow you to keep the encoding as UTF-8.

  • 2 months later...
Posted

This request is actually more common than you would think. FileMaker always exports field names as the column headers for exported data. This is also true when records are saved as Excel. This is inconvenient for any developer that uses a field naming convention that is not easily understood by the users of the solution.

 

I currently use FileMaker's ExecuteSQL script step to first generate the data set with a custom header row and then export the data to a .csv file.  Opening the resulting data file in MS Excel is a simple 3-click process. This developer must define the header row and append the query result to the custom header row.

 

Refer to FileMaker's SQL Guide for information on how to properly build an SQL Query within your database solution.

 

- Charlie

This topic is 3691 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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