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.

Export to structured plain text

Featured Replies

Hi Everybody,

 

I have a FM database with 3 fields: FieldA, FieldB and FieldC. I would like to export the records to a plain text file but with this structure:

 

FieldA_1 [space] FieldB_1 [carriage return]

FieldC_1 [carriage return]

[carriage return]

FieldA_2 [space] FieldB_2 [carriage return]

FieldC_2 [carriage return]

[carriage return]

FieldA_3 [space] FieldB_3 [carriage return]

FieldC_3[carriage return]

[carriage return]

.....

 

Is it possible to export the data with this scheme? Could anyone help me?

 

Thank you very much,

Wardiam

The way to do this is to export as XML and specify a custom stylesheet to be applied during the export, such as this one:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult">

<xsl:output method="text" encoding="utf-8"/>

<xsl:template match="/">
    <xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">
        <xsl:value-of select="concat(fmp:COL[1], ' ',fmp:COL[2], '&#13;', fmp:COL[3], '&#13;&#13;')"/>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Note that the field order specified in the export is important.

  • Author

Thank you very much comment, this is exactly what I wanted. Could you tell where I could learn more about XML export from Filemaker? I don't understand too much the scheme and I would like to customize the template to other databases.

 

I suppose that after if I want to import the exported file I cannot use the same XSL template, can I? How could I do it?

 

Thanks,

Wardiam

First, the w3schools.com tutorial is probably the best place to get a start on XSLT in general:

http://www.w3schools.com/xsl/

 

I am afraid there are not that many resources on XSLT as applied to Filemaker specifically. However, you can find quite a few examples right here on the forums, in both this (Importing & Exporting) and the XML/XSL sub-forums - mostly posted by Fenton and by me.

 

I suppose that after if I want to import the exported file I cannot use the same XSL template, can I?

 

No. Actually, there is no XSLT stylesheet that can process the output, because it's not an XML file. The only way you can import it back into Filemaker is as a tab-delimited file into a temporary table (where you will get three records for each original one), then use a script to parse the data out into "real" records in the target table. IOW, you don't want to go there.

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.