Jump to content

exporting a header for tab files


LoneReaper
 Share

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

Recommended Posts

- make new record

set serial number (or sort field) to -1

go to field (first field on layout)

loop

insert calculated result, Status(CurrentFieldName)

go to next field

exit loop if Status(CurrentFieldName) = (Nameof lastField on Layout)

end loop

sort records

export records

search for serial# =-1

delete record

show all records ...

If you export calculated fields, modify the calc as follwows:

if(serial#=-1, "Fieldname"; your calculation ...)

ForDate, Number and Time fields, you may have to create a text calc

if(serial#=-1, "Fieldname"; Date2Text(your date field) ...)

However, I'd rather do it more elegantly with XML.

You cannot export repeating fields with XML because the Character ASCII 29 is not allowed in XML.

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

<!DOCTYPE stylesheet

[

<!ENTITY TAB "&#09;" >

<!ENTITY CR "&#13;" >

]>

<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'

xmlns:fmp="http://www.filemaker.com/fmpxmlresult"

exclude-result-prefixes="fmp">

<xsl:output method='text' version='1.0' encoding='iso-8859-1' indent='no'/>

<xsl:strip-space elements="*"/>

<xsl:template match ="/">

<xsl:apply-templates select="//fmp:FIELD" />

<xsl:text>&CR;</xsl:text>

<xsl:apply-templates select="//fmp:ROW" />

</xsl:template>

<xsl:template match="fmp:FIELD">

<xsl:if test="not(position() = 1)">

<xsl:text>&TAB;</xsl:text></xsl:if>

<xsl:value-of select="@NAME"/>

</xsl:template>

<xsl:template match="fmp:ROW">

<xsl:apply-templates select="fmp:COL" />

<xsl:text>&CR;</xsl:text>

</xsl:template>

<xsl:template match="fmp:COL">

<xsl:if test="not(position() = 1)">

<xsl:text>&TAB;</xsl:text></xsl:if>

<xsl:apply-templates select="fmp:DATA"/>

</xsl:template>

<xsl:template match="fmp:DATA">

<xsl:if test="not(position() = 1)">

<xsl:text><![CDATA[|]]></xsl:text></xsl:if>

<!-- repeating field separator ASCII 29 is not allowed! -->

<xsl:value-of select="."/>

</xsl:template>

<xsl:template match="text()"/>

</xsl:stylesheet>

Link to comment
Share on other sites

This topic is 6516 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.