Newbies cfunn Posted July 11, 2005 Newbies Posted July 11, 2005 I need to export some data from my FMP7 database. It needs to be in an XML format so I can upload it to a web based data base(my E-Commerce web Site) The only data I need is the Product ID, and the on hand count. The XML need to look like this: <BVC2004> <Products> <Product> <ID>99-1V</ID> <InventoryAvailableQty>0</InventoryAvailableQty> </Product> </Products> </BVC2004> The only data is the <id>= my produnt part number and <InventoryAvailableQty> = my on hand count. I will need to export many records at once. Thanks, cfunn
Wim Decorte Posted July 11, 2005 Posted July 11, 2005 2 options: 1- export the data to XML format (this will put the data in an FileMaker XML grammar), and in the Export script step specify the XSLT tranformation style sheet that will transform the FM XML grammar into the needed format 2- or, create a mega calc that will add the tags to your data. I would not recommend #2 unless you can't make the XSLT and can't find someone to do it for you.
beverly Posted July 11, 2005 Posted July 11, 2005 snippet of XSLT (using FMPXMLRESULT and ID is first field & Qty is second field) .. <BVC2004> <Products> <xsl:for-each select="fm:ROW"> <Product> <ID><xsl:value-of select="./fm:COL[1]/fm:DATA /></ID> <InventoryAvailableQty><xsl:value-of select="./fm:COL[2]/fm:DATA /></InventoryAvailableQty> </Product> </xsl:for-each </Products> ... If you are exporting and NOT pre-summarizing, that's possible in the XSLT, too!
Newbies cfunn Posted July 12, 2005 Author Newbies Posted July 12, 2005 Am I getting close?? <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> <BVC2004> <Products> <xsl:for-each select="fm:ROW"> <Product> <ID>xsl:value-of select="./fm:COL[1]/fm:DATA /></ID> <InventoryAvailableQty>xsl:value-of select="./fm:COL[2]/fm:DATA /></InventoryAvailableQty> </Product> </xsl:for-each select="fm:ROW"> </Products> </BVC2004> </xsl:stylesheet>
beverly Posted July 13, 2005 Posted July 13, 2005 Does it work? You need to specify a template, the xmlns of your source XML and the path to the ROW element: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fm="http://www.filemaker.com/FMPXMLRESULT" exclude-result-prefixes="fm"> <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/> <xsl:template match="/"> <BVC2004> <Products> <xsl:for-each select="fm:FMXMLRESULT/fm:RESULTSET/fm:ROW"> <Product> <ID>xsl:value-of select="./fm:COL[1]/fm:DATA /></ID> <InventoryAvailableQty><xsl:value-of select="./fm:COL[2]/fm:DATA /></InventoryAvailableQty> </Product> </xsl:for-each select="fm:ROW"> </Products> </BVC2004> </xsl:template> </xsl:stylesheet>
Recommended Posts
This topic is 7074 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