dynamically change the filelocation for a xml file secondary data connection - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

dynamically change the filelocation for a xml file secondary data connection

Last post 11-05-2010 05:16 AM by Patrick Halstead. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 10-15-2010 03:23 AM

    dynamically change the filelocation for a xml file secondary data connection

    I would like to change the URL for a secondary Datasource that connects a xml-file (infopath-file). I would think it would be very easy for Qdabra to bring this feature.
    I need it, so I can open a form and load another form into cache and then copy certain nodes from that old form. The user expects to be able to use an older Report, that he is just choosing from an dropdown list as a template for the new report and then I need to get certain values out of it.  How else would I achieve this?


  • 10-15-2010 10:38 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Thanks for the suggestion! We'll be sure to consider it for a future version of qRules.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 10-18-2010 11:55 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Hi Michael,

    How soon do you need these features? We can work on them next week and drop you a beta for testing. If you agree to beta test them, we will give you a free version of qRules. Interested?

    Patrick Halstead
    Project Manager at Qdabra
  • 10-19-2010 05:22 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Hi Patrick,

    that would be quite wonderful, to say the least. The Project is set to end this year at the latest, although I kind of want it of my back. But if this feature works as I wish, I am more than happy to wait and push this position through to the projectowner, since all other approaches would take me longer.

    So Yeah! please try and code and I will more than happy to beta-test it. Under one Condition. I will do it for free :-) (plus we already have the assurance for the product, but thank you very much for the offer, i appreaciate it) You guys don't realize, how great this product is for me. I already told Ted about it.

    Thanks again. Now I haven't thought this feature all through to the end, so maybe I should explain the very concrete use case of mine?

    Best regards Michael.

  • 10-21-2010 12:35 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Hi Michael,

    Thanks for not charging us! :) This forum is free too. We're happy you purchased qRules and think more people can help us support this forum with qRules purchases in the future. Your positive testimonial will help. Thank you!

    If you can detail your use case that would be good. It would ensure that we implement the right feature! :) Please describe your use case in as much detail as you have.

    Assuming this is ~2 hours of work, we'll schedule the work for next week....

    Patrick Halstead
    Project Manager at Qdabra
  • 10-22-2010 09:20 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Hallo Patrick,

    great, I will try to explain.

    The form in this case deals with Product Test Reports. The test and the results are described by the user, as he fills out the form. For instance, what happens, if I let a product fall from one Meter off the table, and so on. Over the months and years we developed the form template further to meet the needs for the R&D-Department, so I am currently developing version 6 of the form template. Very often these test are the same or very similar, so the User saves time. In some way the form would present the users with possible older test reports, he selects one and the new routine would get him the data and save the NEW form. I used to have this function in a way, where I would open the older form with InfoPath and just give it a new unique id and filename and save it, but we had to disable this function, because it only works, if the xml-Schema hasn't changed with the new version. Also bugfixes and new functions do not nesseccarily apply.

    This is why I came up with the idea to go from the new version "back in time" and retrieve the old data and copy it into my new/changed Schema. Of course the new form can know what xpath to look on in the old forms and of course the old cannot know about the later version schema.

    The user basically provides an ID, that the form can resolve to a filepath. All old forms are stored at known formlibrary that serves somewhat as an archive for this matter.
    Qrules would take this filepath and paste it at the FileDataConnection.
    Then I would  Query this dataconnection and have the old form accessable.
    I must then know what version the old form is based on, so I would need to be able to read the solutionversion number and I think I need to read this href-attribute, that references the template. The template is somewhat more accurate for me, because sometimes I forgot to increase the main version number. I would extraxt the "v1" for instance out of the URL.

    Example XML Header for version 1
    <?xml version="1.0"?><?mso-infoPathSolution productVersion="11.0.8034" PIVersion="" href="http://intranet.weinmann.com/FormServerTemplates/Versuchsbericht%20v1.xsn" name="urn:schemas-microsoft-com:office:infopath:Versuchsberichte:-myXSD-2006-07-19T05-45-18" solutionVersion="" ?><?mso-application progid="InfoPath.Document"?><?MicrosoftWindowsSharePointServices ContentTypeID="0x0101010041703ADC4E294E468EDFA6E7C3F3AF6100AF98C44E75D75F4DAE463F64D90F8683"?>

    Example XML Header for version 5
    <?xml version="1.0"?><?mso-infoPathSolution productVersion="12.0.0" PIVersion="" href="http://intranet.weinmann.com/FormServerTemplates/Versuchsbericht%20v5.xsn" name="urn:schemas-microsoft-com:office:infopath:Versuchsbericht-v5:-myXSD-2008-05-30T12-44-41" solutionVersion="" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?><?MicrosoftWindowsSharePointServices ContentTypeID="0x01010100EA10D9D32CF7C14BBDD1779D99B21DA100C8138EAB883DB242ABD47A1E476948D4"?>

    When I know which template I am dealing with, I know the xpaths and can access with absolute accurance and finally copy them.
    A lot of it is Rich Text, so I need to accurately copy the InnerXML. At this point I need to rely on your expertise, because I cannot explain very well. The old richtextField contains usually pictures, links, formatting, tables. All of this I need to copy!

    Attachments the old form has I also would like to be able to copy.
    Most of the old forms are digitally signed, but I think that does'nt matter, does it. The signature should be just annother field with a hashcode or something. I DO NOT need to copy the old signature info, it would be broken anyway.

    So, I think this is about it. Maybe you have further ideas, when you abstract my feature wish and make it more general?

    If you have any more questions, please let me know. I am really looking forward to this.

    Best regards

  • 11-02-2010 11:10 PM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Hi Michael,

    Thanks for the detailed response. Sounds like you have a very cool InfoPath solution. :)

    And you have a very interesting versioning problem too! :)

    Well, here are the possible solutions:

    • Merge Forms. This is an out-of-box feature in InfoPath. It requires the user pick File->Merge Forms and specify the XML. You have to make sure the template has an XSD and XSL in it for each of the old versions. The XSD is what Merge Forms uses to match the incoming XML. The XSL tells it what to import (i.e. you don't have to import the entire schema, just parts). This is detailed in the InfoPath 2003 SDK and it is a relatively undocumented feature.
      • Pros: you can do it without qRules and without code.
      • Cons: hard to debug the XSL and may require namespace changes between versions.
    • SharePoint Lists. Use qRules to map your forms to SharePoint lists. Copy data from SharePoint lists into new forms based on ID.
      • Pros: don't need to worry about xpath and sub version info. All templates map to the same SharePoint list. Works with rich text but we would have to verify images.
      • Cons: you have to add qRules to all previous versions of the form template and open and resave all previous XMLs. To maintain old form templates, you will need to keep them in separate form libraries for older versions or using content types (see Jo-Anne's recent blog on the latter).
    • SQL Database. Map all old forms from old form templates to a SQL database table (for example, using DBXL). Then, pull the data from SQL into your forms to auto-populate.
      • Pros: doesn't require injecting qRules into old form templates. DBXL handles mapping based on schema. Easy to import old data. Works with rich text. Also, DBXL supports converting XML from old templates to new ones.
      • Cons: you would likely need a Basic license of DBXL. Free trial would prove concept. We can give you a discount on Basic since you bought qRules already.

    Since you have digital signatures on the old forms, injecting qRules into the form templates and resaving is probably not a great solution (it will take time and injecting qRules requires a schema addition which won't work if your forms have their entire data source signed). I think you should try the DBXL option for now since it will be less time to set up and can import/extract from digisig forms without a problem.

    Bottom line: you don't need a new feature for this. Our tools have solutions that you can use today. Let us know if you'd like to discuss further.

    Patrick Halstead
    Project Manager at Qdabra
  • 11-05-2010 03:59 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Hallo Patrick,

    thank you for your time for looking into this. I solved it with code now, so I can load the xml-Files.

    FileQueryConnection q = (FileQueryConnection)this.DataConnections["VorlageVersuchsbericht"];q.FileLocation = MainDataSource.CreateNavigator().SelectSingleNode("/my:versuchsbericht/my:administration/my:template/my:templateFilepath", NamespaceManager).ToString();


    After that I copy the fields with qrules. It says in the manual "CopyRichtextfield". Can you copy other fields as well? But I will work it out.

    Yeah, I am not quite sure, why the merging doesn't work. I thought maybe it is because I have optional sections in my form. So the Microsoft feature cannot merge a section with a non-existant section.

    Thanks again

    Filed under:
  • 11-05-2010 05:16 AM In reply to

    Re: dynamically change the filelocation for a xml file secondary data connection

    Yes, you can copy other fields. Jo-Anne Alfafara wrote a blog post recently that shows you to copy using the Insert command. CopyTable is less work for tables when the schema is the same.

    Merge should support ability to add optional XML fragments but I can't remember actually doing that. 

    Please let us know if you need more help. 

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.