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

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

Recommended Posts

Posted

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

Posted

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.

Posted

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

Posted

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.

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