Datasource selection - InfoPath Dev
in

InfoPath Dev

Datasource selection

Last post 05-05-2006 06:52 AM by videneev. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-09-2005 02:47 AM

    Datasource selection

    Hi All,

    I am trying to build something where the end-user will be able to select the datasource from the published infopath doc. And then from there make changes etc. to the content. The idea is that the infopath doc is used as a template and that the datasource is supplied via an export program which creates uniquelynamed xml files.

    So far I have this:

    XDocument.QueryAdapter.FileURL = sNewFilePath
    XDocument.QueryAdapter.Query();

    The problem comes when actually allowing the user to browse for the specified file source.

    Have anybody done something similiar?

    Any help is greatly appreciated!!!!

  • 09-09-2005 07:11 AM In reply to

    I'm pretty sure that the code that you have listed trys to change the base data source of the form you're working with, which is really going to work dynamically. You're going to have to set up a secondary data source, also is the schema for all of the exported xml files the same? It would have to be unless you were trying to make some sort of generic xml-editor, which there are probably some out there already.

    Anyway, here's what I would do:
    *Set up a secondary data source based off of the schema of one of the exported xml files (easiest way to do this is just import one of the files with a lot of blank fields)
    *Set up controls and bind them to the secondary data source fields
    *Write the code to pull in one of your exported xml's and merge it to the existing (blank) secondary data source

    Take a look at this:

    XDocument.DataObjects("name_of_your_secondary_ds").ImportFile("URI_of_your_file.xml");

    Also, be sure that the URI is in relation to where the infopath form is being run/published (mainly comes into play when running forms over a network). Also make sure that when you set up the secondary data source that it is the structure only and no "" nodes otherwise every time you import an xml and then save again you'll append some "" nodes b/c the ImportFile() simply performs the "merge form" function programatically.

    Hope this helps.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 09-09-2005 07:26 AM In reply to

    Just learned this:

    But at the last screen of the wizard [when adding a secondary data source] uncheck "autmatically retreive..."

    This would solve the problem of appending blank nodes when importing your own xml files.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-05-2006 06:52 AM In reply to

    • videneev
    • Not Ranked
    • Joined on 05-05-2006
    • Germany
    • Posts 9
    Hello Matt!

    You wrote:

    Take a look at this:

    XDocument.DataObjects("name_of_your_secondary_ds").ImportFile("URI_of_your_file.xml");

    -------
    So, what are you meaning with "name_of_your_secondary_ds". Must it exist? Or can I write here any name?

    Evgeny
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.