JohnnyZ Posted August 8, 2014 Posted August 8, 2014 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?
comment Posted August 8, 2014 Posted August 8, 2014 (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 August 8, 2014 by comment
Ocean West Posted August 10, 2014 Posted August 10, 2014 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.
fmbiz.net Posted October 15, 2014 Posted October 15, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now