XML files as a secondary data connection - InfoPath Dev
in

InfoPath Dev

XML files as a secondary data connection

Last post 07-25-2006 10:10 AM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-23-2006 06:26 AM

    XML files as a secondary data connection

    Hello,

    I have a big problem with XML files as a secondary data source and I hope that someone can point me to the right direction.

    I´ve written a VB.Net application which exports a XML file. This happens on demand. The XML file is saved on a shared network drive.
    Now I want to show the content of this XML file in a repeated table of an infopath form.

    If I choose this XML file as a secondary data connection I have to decide if I want to store the XML file as a ressource file in the infopath template or not.

    If I choose "Yes" at this point the XML file will be stored as a ressource file in the template. My problem with this is that I can´t update the XML file during runtime so that the newest data will be show in the form if anyone open a new form based on this template.

    Even if I explicitly load the XML file in the Onload event the file will not updated and the form still shows the 'old' data.


    On the other side if I choose "No" then the XML won´t store as a ressource file and the form always shows the actual data. But the problem here is that the data in the secondary data source will not save if the user saves the form after filling out some additional information because as far as I know only data from the primary data connection will be save in the 'form.xml' file --- am I right with this? But I need both (primary AND secondary) data in the saved infopath forms.

    And at this point I need help what I should do best in my situation.

    Hope that anyone can point me in the right direction.
    Karsten
  • 07-24-2006 04:05 PM In reply to

    Re: XML files as a secondary data connection

    Loading the file during OnLoad is certainly a valid option, only you need to write code to copy the values from the file you loaded to your DOM. But you must also be aware of any changes to the file and handle those yourself (i.e. rows added/removed, etc).
  • 07-25-2006 01:00 AM In reply to

    Re: XML files as a secondary data connection

    Hi Greg,

    thanks for your advice to copy the values of my file during the onLoad event to my DOM. Unfortunately I´m a relativ beginner with infopath programming and have not got much experience with programming the DOM by now.

    Would it be possible for you that you can publish a few code lines where I can see the necessary commands.

    Thank you very much for your efforts.
    Karsten
  • 07-25-2006 10:10 AM In reply to

    Re: XML files as a secondary data connection

    Sorry I don't have any code snippets to go along with this, but in general, it's a basic matter of getting a value (from the loaded DOM) and setting that value (to the main DOM).

    It sounds as if both schemas are identical. If so, this should make things much easier.

    You need to walk through the hierarchy of your loaded DOM, getting each node's value, and then set the value on the corresponding node in the main DOM.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.