Jump to content
Server Maintenance This Week. ×

Export to tab-separated with column headers


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

Recommended Posts

Hi all,

Is there a straightforward way to export tab-separated values with field names becoming the first row, i.e., column headers? I only see this option available when "Saving As.." an Excel spreadsheet.

Thanks in advance!!!

Link to comment
Share on other sites

If you're willing to try an XML Export, with an XSL stylesheet, the following, as the xsl file, will produce a tab-separated text file, with a header line of the field names. The resulting line endings are Unix (ASCII 10), but usually work cross-platform.

<?xml version='1.0' encoding='utf-8'?>



exclude-result-prefixes="fmp" version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">



	

		

			

					

					

			

		

		

		

			

					

					

			

			

		

	

Link to comment
Share on other sites

Alternately, you could script adding a record to the found set that sorts at the top of the list, which contains the field names in that record. You could then export the data, and then delete that temporary record.

Link to comment
Share on other sites

Hi Reed,

Thanks for the reply. The way you suggested was one of the ways I'd thought of, but am trying to avoid. If I can get Fenton's way to work for me I'll be a happy camper.

Cheers!

Link to comment
Share on other sites

When you see an error with the 1st character of the file, it usually means some other character than the < which begins the xml declaration is the 1st character, which means either a character you can see, or else it's an encoding error. UTF-16 is often the culprit. In any case it's difficult to copy/paste off a web page sometimes.

So here is again, attached. Try that. Do not open or save with a word processor; use a text editor that can show you the encoding. If that doesn't work, I'll include it with a FileMaker file using it.

Field_Names_as_Header_xsl.zip

Link to comment
Share on other sites

Hi again, Fenton,

I opened the downloaded text with SuperEdi (on Windows) with UTF-8 as the default encoding, but I get the same results as before. I'd really appreciate it if I could take you up on your offer of the style sheet already in a FM file.

I haven't worked with XSL stylesheets before, but this seems like as good a time as any to get my feet wet.

Many thanks!

Link to comment
Share on other sites

Works like a charm when I set my solution up to follow your example. I'm wondering if I was doing something wrong before (probably). I wasn't referring to it as an external stylesheet, but rather as a calculation that got the content of the stylesheet from global field. I also tried exporting from the file menu, i.e. not using a script, by pasting the stylesheet's content in the field for HTTP Request in the dialog that appears.

Sorry if this was the cause of the failure. Any tips, comments, etc. over the "whys" and "how-tos" of working with XML and stylesheets are welcome.

Thanks a lot, Fenton! This is some cool stuff that's certainly piqued my interest...no turning back now.

Link to comment
Share on other sites

This topic is 6215 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.