Jump to content
Sign in to follow this  
eyepro

XML export

Recommended Posts

I'm very very very newbie on xml.

What I need to understand is if it's possibile export in this way.

I use a xsl stylesheet to export from FM.

 

I was able to use the <xsl:for-each to export details in the way I want:

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">
        <Details>
            <Code><xsl:value-of select="fmp:COL[2]/fmp:DATA"/></Code>
            <WTN><xsl:value-of select="fmp:COL[3]/fmp:DATA"/></WTN>
            <Date><xsl:value-of select="fmp:COL[4]/fmp:DATA"/></Date>
            

result:

<Details>
<Code>0280c1</Code>
<WTN>1</WTN>
<Date>10/04/2018</Date>
</Details>
<Details>
<Code>0280c2</Code>
<WTN>2</WTN>
<Date>10/04/2018</Date>
</Details>
<Details>
<Code>0280c3</Code>
<WTN>3</WTN>
<Date>10/04/2018</Date>
</Details>

what i need to know is how put the fmp:COL[1] above the <xsl:for-each to get this:

<CUSTOMER>ABC</CUSTOMER>

<INVOICE>01</INVOICE>

<Details>
<PrimaryKey>0280c1</PrimaryKey>
<WTN>1</WTN>
<Date>10/04/2018</Date>
<Colours/>
</Details>
<Details>
<PrimaryKey>0280c2</PrimaryKey>
<WTN>2</WTN>
<Date>10/04/2018</Date>
<Colours/>
</Details>
<Details>
<PrimaryKey>0280c3</PrimaryKey>
<WTN>3</WTN>
<Date>10/04/2018</Date>
<Colours/>
</Details>

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Your question is not entirely clear (mostly because you have omitted the parts that would enable to see the context).  I suspect you simply want to put:

<CUSTOMER>
	<xsl:value-of select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW[1]/fmp:COL[1]/fmp:DATA"/>
</CUSTOMER>

right before:

<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">

This will take the data from the first field in the first record and place it inside the CUSTOMER element (I take it that the customer is the same for all records being exported, as is the invoice). I don't know where the invoice number is, but the process should be the same.

 

Share this post


Link to post
Share on other sites

Yes it is and works like a charm!!!:waytogo::waytogo:

Thanks for your prompt reply.

:beer:

Edited by eyepro

Share this post


Link to post
Share on other sites

I have a issue: not all fields above xsl:for each are exported, some rows stays blank.

If I export without stylesheet (using just FMPXMLRESULT) every row is exported correctly, but in wrong format.

Where I'm wrong?

I have discovered that the export changes according to the form where I am.

If I'm on invoices some field are exported and some not, if I'm on Invoice details some exported and some not...possible?

 

Thanks

Share this post


Link to post
Share on other sites

I am afraid you're not being entirely clear. You determine which fields are exported, by selecting them in the export dialog. You can also select fields from a related table. However, you must pay attention which layout you are on when exporting, because that will affect the structure of your export - and your stylesheet would normally be designed for a specific structure.

For example, if you export from Invoices, then each ROW will be an invoice. If you export from Lineitems, then each ROW will be a line item - and if your stylesheet was designed to create an invoice for each ROW, it will no longer work as expected. 

If that's your issue (and even if it's not), I would suggest you script your export, and start the script by going to a layout of the table from which you want to export.

Share this post


Link to post
Share on other sites

Thanks.

You mean that can't export from different related tables?

What can't understand is why exporting without stylesheet works fine and with stylesheet no, exporting fields are the same.

There is something wrong in stylesheet (attached)?

Concerning the script is possible going from layout to layout and then append data to the xml?

stylesheet.xsl

Share this post


Link to post
Share on other sites
1 hour ago, eyepro said:

You mean that can't export from different related tables?

No, I mean that the XML exported from the parent table is structured differently from XML exported from the child table. They contain the same information - but a stylesheet written to process one cannot be used to process the other. 

 

1 hour ago, eyepro said:

There is something wrong in stylesheet (attached)?

I don't see the source XML, and I don't know what your expected result is, so it's hard for me to say. What I do see is that your stylesheet creates a DettaglioLinee for each ROW. That means it is written for XML exported from a table where each detail line is an individual record. It will not work as expected if you export from Invoices or from Clients - even if you export exactly the same combination of fields from these tables.

 

1 hour ago, eyepro said:

Concerning the script is possible going from layout to layout and then append data to the xml?

I see no reason why you should ever need to do such thing. 

Share this post


Link to post
Share on other sites

BTW, this caught my eye at the last moment before closing your file. You have:

<CodiceDestinatario><xsl:value-of select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW[2]/fmp:COL[2]/fmp:DATA"/></CodiceDestinatario> 
<PECDestinatario><xsl:value-of select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW[3]/fmp:COL[3]/fmp:DATA"/></PECDestinatario> 

I think this should be:

<CodiceDestinatario><xsl:value-of select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW[1]/fmp:COL[2]/fmp:DATA"/></CodiceDestinatario> 
<PECDestinatario><xsl:value-of select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW[1]/fmp:COL[3]/fmp:DATA"/></PECDestinatario> 

i.e. ROW[1] instead of ROW[2] and ROW[3]. And the same goes for the rest of your header fields - they should all be getting their values from the first ROW - otherwise they will be empty if you ever export an invoice with fewer items.

 

Edited by comment

Share this post


Link to post
Share on other sites
3 hours ago, comment said:

i.e. ROW[1] instead of ROW[2] and ROW[3].

it's working :worship::worship::worship:

By the way do you know ho to remove spaces between lines.

When open the xml with notepad++ i get this:

 

2018-11-08_16-14-17.jpg.f76acade83e1570a07d8808bcc1553b5.jpg

 

....sorry for dumb questions ;)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By Michael Stevens
      I have a parent table with 3 child tables.  In the child table, there can be many related fields.  I need to export only one row of data for each record in the parent table.  This would require that a new column be created for each of the many values related in the parent to the child.

      For Instance:
      Noah Justin has 3 Email Address NJ@Test.com, NJ2@Test.com, and NJ3@Test.com

      When I do an Excel Export from FM I get
      Column 1 .       Column 2
      Noah Justin    NJ@Test.com
                                NJ2@Test.com
                                NJ3@Test.com

      I need:
      Column 1 .     Column 2 .        Column 3 .          Column 4
      Noah Justin  NJ@Test.com  NJ2@Test.com  NJ3@Test.com

      I'm sure it's pretty common and there is an easy solution to this.  

      TIA
    • By troi
      Updated file management plug-in is compatible with FileMaker 18 and sets movie metadata.
      Alphen aan den Rijn, the Netherlands, May 22, 2019–Troi today announced the immediate availability of Troi File Plug-in 11.0 for FileMaker 18.
      What is Troi File Plug-in?
      Troi File Plug-in is a very powerful tool for getting access to information outside the FileMaker database. Any files or folders stored on the computer can be accessed through the functions of the plug-in. All from within FileMaker you can:
      get data from files that are on the disk of the computer into FileMaker create files anywhere on the hard disk and put data from FileMaker fields into them manipulate files and folders on the disk: this includes creating, deleting, copying, moving and modifying files and folders get the size on disk, creation and modification dates and much more launch and reveal files directly from FileMaker manage your images and movies, including reading and writing metadata What is new in version 11.0?
      Troi File Plug-in 11.0 has the following new functionality:
      Tested and made compatible with FileMaker Pro 18 and FileMaker Pro 17.0.6. Added new TrFile_ExportToFile function, which can save container data to disk. This function can also be used on FileMaker Server. Added a new TrFile_IsFree function, which can be used to determine if a file is in use by a different application (or locked). (macOS) Added a new Set MetaData of Movie script step and TrFile_SetMovieMetaData function, which can add metadata to movie files (like .mov and .mp4). It can add and change metadata like title, GPS and creation data. (macOS) Improved TrFile_CreateThumbnail function and the Create Thumbnail script step: you can now create thumbnails of movie files (like mov, mp4 etc). The plug-in creates a thumbnail of the first frame of the movie. (macOS) Prepared the plug-in for notarization: the plug-in can now be added to a runtime, to create a hardened FileMaker runtime app which can be notarized by Apple. Notarization gives users more confidence, as the runtime has been checked by Apple for malicious components. (Windows) Improved the TrFile_ExecuteShell function and the Execute Shell script step. If you use the switch “-Encoding=UTF8” the plug-in now indicates invalid UTF-8 characters with the string <INVALID UTF8>.Also Improved the ExecuteShell.fmp12 example file, you can now specify the encoding of the result of the command. In Troi File Plug-in 11.0 we also made the following changes and improvements:
      IMPORTANT (macOS only) The minimum supported FileMaker version is now FileMaker Pro 14. Also the minimum supported Mac OS version is now OS X 10.10 (Yosemite). You can keep using v10.2 for older versions of FileMaker Pro or Mac OS X. (macOS) The plug-in no longer has the 32-bit code included. Improved the initialization when installing the plug-in with the FileMaker Pro “Install Plug-In File” script step. Updated the EasyInstallTroiPlugins.fmp12 file, it can show additional error information from Get(LastExternalErrorDetail) when running on FileMaker Pro 18. The EasyInstallTroiPlugins.fmp12 file can also run a test registration script for a plug-in after you have installed it on FileMaker Server. Updated the example files for FileMaker Pro Advanced 18 and made small corrections to the user guide. Fixed bugs in several functions. More detailed information on all changes and improvements implemented in Troi File Plug-in 11.0 can be found on the File Plug-in page.
      Pricing & Availability
      A fully functional demo version of Troi File Plug-in 11.0 is available on the File Plug-in page.
      Licenses cost US$ 99 per user. Details on developer licenses and multi-user discounts can be found on the File Plug-in page. You can order licenses there or from our shop.
      Upgrade information
      Version 11.0 needs a new registration. The upgrade is free for users who bought a license for Troi File Plug-in on or after May 15, 2018. Eligible users will be sent a new registration. Contact us if you have not received yours after May 29, 2019.
      Upgrades from licenses bought before May 15, 2018, are available from US$ 59 per user. Upgrade prices for other licenses can be found on the File Plug-in web page or in the shop. You can order upgrades there.

       
    • By Laura Griffin Long
      I have an rss feed that returns data like this: 
      2009 LLCs, Corporations, & Business Legal Updates
      2009 Personal Finance Legal Updates
      2010 LLCs, Corporations, & Business Legal Updates
      2010 Personal Finance Legal Updates
      2011 Personal Finance Legal Updates
      2012 Wills, Trusts, and Estates Legal Updates 
      If I click on one of the links I can see the XML.  I need to import all of the XML into my database.  I have done XML/XSL imports before, but it is throwing me off because of the RSS List.  How do I go about this?  Right now I do a copy/paste on view source, put all of that into Notepad++ and then scrub the data.  I use that for an import into a Filemaker table to get the URL.  Then I do an insert by URL to get the XML into the table.  This seems like a lot, I am hoping there is an easier way.... 
    • By mbarrett65
      When I "Save Records as Excel" all the found set records are saved out of the system. However, when I "Export Records," only about two-thirds are exported. What would explain not all records being exported? Thanks.
    • By Gilles Plante
      Hi,
       
      I am running version 17.0.2 - in demo mode for not but we will a buy a licence today.
      In the bottom pane I have a list of fields for a table and would like to get that list inside a FileMaker file. When I right-click on the list - all items are selected - I get a choice Calle Copy for FIleMaker. What do I get when picking this menu choice, and how can I paste in FileMaler ?
      Thanks
       
  • Who Viewed the Topic

    4 members have viewed this topic:
    JF Fortier  sal88  NBS5000  Coloraten 
×
×
  • Create New...

Important Information

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