3 Replies Latest reply on Nov 19, 2010 7:41 AM by ChristopherNewton

    Tab Separated Text and Column Headers

    craig5005

      Title

      Tab Separated Text and Column Headers

      Post

      Has anyone been able to get field names exported in a tab separated export?

      Background: I am working on a project for an old employer and I am trying to match their existing data output.  It is tab separated with field names followed by the data.  You can see an example in the attached screenshot.  The database they were previously using was a specialized piece of software called EpiData.  You will notice the field names have quotation marks around them, that is a result of the export and not the naming of the fields.

      screenshot.jpg

        • 1. Re: Tab Separated Text and Column Headers
          FentonJones

          FileMaker does not have the option to "include field names as header" with tab-separated export. You would think they would.

          There is a way to do it, via XML. It sounds mysterious, and it is a bit different, but it is not that hard to use. Not really that hard to understand. You just do an Export, with the type XML; then you get a 2nd dialog, where you specify the path to the XSL file (which is basically a text file, written in xsl syntax). XSL is pretty flexible, and you can arrange things in many ways.

          In this example file the xsl file is specified, in the script, as a relative path (in the same folder and level as the database file itself, in a single-user environment). For a network path you'd need to put the xsl file somewhere universally available. This could be either an http path, such as to a web page, or a fixed path on a shared file server, or a known path on each client machine, such as in the active FileMaker application folder.

          The xsl file has a section to read the field names of the exported fields from the "metadata" section, where FileMaker exports the field names. Hence they will be exactly the FileMaker field names. If you want different, you can just stick straight text into the xsl.

          This is purely Tab separated (no quotes; you could add them if you wanted, more work though). It will work with any FileMaker file, any fields exported, in whatever order you export.

          Export_tab_wField_Names_XML.zip

          P.S. The xsl file is commented, so you can learn how it does what it does. Many of the lines are there so it does NOT have a Tab at the end of the line, but a linefeed instead, and so it doesn't put an extra linefeed at the end (which doesn't always matter, but sometimes does). XSL has some useful functions like: position() which is the number of the node you're on (compared to your "siblings" at that level), and: last() the last one (duh :-)

          • 2. Re: Tab Separated Text and Column Headers
            ChristopherNewton

            You could export as a merge type file which will include the header in a comma separated format and then substitute the comma for a tab using word or notepad.

            • 3. Re: Tab Separated Text and Column Headers
              ChristopherNewton

              Or you could write a script that created a new record and set the fields in the new record equal to the field names sorted the record into the first slot, exported your records and them deleted the dummy record.