LoneReaper Posted March 21, 2004 Posted March 21, 2004 anybody have a trick on how to export a header with the tab files?
Reed Posted March 21, 2004 Posted March 21, 2004 How about having a script create a record with the field names in it, having the found set sort so that the "header" record is first, and then exporting. The script could then delete the header record.
cjaeger Posted March 22, 2004 Posted March 22, 2004 - 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 "	" > <!ENTITY CR " " > ]> <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>
Recommended Posts
This topic is 7552 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 accountSign in
Already have an account? Sign in here.
Sign In Now