stefanshotton Posted December 11, 2004 Posted December 11, 2004 I have a program that automatically imports details from a .txt file when it opens, Im looking to export a range of fields from a single record. When trying to export the file extentions do not include .txt have tried the other extentions and the host program does not recognise this format. The information must be laid out as follows. Everything upto and including the equals is the target programs fields, everything after needs to be generated automatically from fields. USERS_SIGN= Fred Brown LIFE1_TITL= Mr LIFE1_SURN= Case LIFE1_FORE= Test LIFE1_LONG= Mr Test Case LIFE1_DOBT= 19/05/1956 LIFE1_CAGE= 40 1. How do i get the infornation into a .txt file without manually changing it after an export, and keep the target field name layout 2. If i set up a new table with the target programs field names as fmp7 field names can i set up a script to copy the data from my database fields.(also bear in mind the new fields have an equals sign in, this may bugger up calculated fields?) Not a programmer im a mortgage adviser so please if you can help it would be appreciated, do understand a little though :-)
RalphL Posted December 11, 2004 Posted December 11, 2004 Make set of calculated text fields, i.e., "USERS_SIGN= " & User "LIFE1_TITL= " & Title "LIFE1_SURN= " & Surname User, Title & Surname are the field names I assumed for this example. Use the real fields from your database. On the date field you may have to use the Get as text function. Export these fields to the text file.
stefanshotton Posted December 12, 2004 Author Posted December 12, 2004 Thanks sussed ou this bit however when i export the file the fields are tab separated and I need each field on a new line any ideas? Have been messing around with the carriage return function in the calculation but have had no joy, Yet!
RalphL Posted December 12, 2004 Posted December 12, 2004 FileMaker uses the return as the end of a record. It will not export returns. You need to process the output file to convert the taps to returns. This may require a plug-in. Check the Troi File plug-in. http://www.troi.com Or the Filemaker website for others.
comment Posted December 12, 2004 Posted December 12, 2004 Put all your data in a single calculated text field, with carriage return: "USERS_SIGN= " & User & "
stefanshotton Posted December 12, 2004 Author Posted December 12, 2004 Just about to the post the same(have been messing around with it this morning), also you need to export as xml file but with .txt as the file extension. The XSL style sheet needs to be set up with the following <?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/fmpdsoresult"> <xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/> <xsl:template match="/"> <xsl:for-each select="fmp:FMPDSORESULT/fmp:ROW"> <xsl:for-each select="./*"> <xsl:value-of select="." /> <xsl:text>
</xsl:text> </xsl:for-each> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> 
 is the coding that recognises the carriage return. Thought id post this in case anyone has similar problem. Thanks For all of your help!
Fenton Posted December 12, 2004 Posted December 12, 2004 FileMaker cannot export each field as a separate line. But it can export XML, and an XSL file can transform the data into that shape. Save the text below as an .xsl text file. Export from FileMaker using FMPDSORESULT as the XML type. Point the xsl choice to the text file. Best to put them in the same folder, so it can always find it (it is not network compatible there, but that's another story). The xsl could be modified to use FMPXMLRESULT, but this is what I've got on hand :-). Export only the fields you want, 'cause otherwise it will do all fields. It has a Unicode line feed between the lines, (2 at the end of a record), so choose that as the text type to use for opening with your text application (even WordPad supports Unicode). It should work cross-platform. Or change the line endings (to ) and the output method encoding (to encoding="iso-8859-1"). I'm on a Mac. [Don't change the xml encoding, it stays UTF-8] ---- Text file is below this line ------- <?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/fmpdsoresult"> <xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/> <xsl:template match="/"> <xsl:for-each select="fmp:FMPDSORESULT/fmp:ROW"> <xsl:for-each select="./*"> <xsl:value-of select="."/> <xsl:text> </xsl:text> </xsl:for-each> <xsl:text> </xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Recommended Posts
This topic is 7286 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