July 11, 200520 yr Newbies 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
July 11, 200520 yr 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.
July 11, 200520 yr 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!
July 12, 200520 yr Author Newbies 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>
July 13, 200520 yr 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>
Create an account or sign in to comment