Saving Secondary Data - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Saving Secondary Data

Last post 04-21-2008 05:04 AM by Brad87. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-10-2008 11:24 AM

    • Brad87
    • Not Ranked
    • Joined on 04-10-2008
    • Posts 5

    Saving Secondary Data

    Is there a way to populate data in an infopath 2007 form from a secondary datasource (in this case a sharepoint list) and then save the form so that the data is available when not connected to the datasource? The idea here is to create "snapshot" of the sharepoint list at a given point in time.

    Filed under:
  • 04-10-2008 12:04 PM In reply to

    Yes.

     The data you want just needs to be moved into your main data source from the secondary. The main is what gets saved in your XML file.

  • 04-11-2008 04:34 AM In reply to

    • Brad87
    • Not Ranked
    • Joined on 04-10-2008
    • Posts 5

     Is that easily done?

  • 04-11-2008 08:04 AM In reply to

    It depends on the complexity of the data but you can use rulesto set field values from one to the other.

    Sometimes code is used for large bulk moves.

  • 04-21-2008 05:04 AM In reply to

    • Brad87
    • Not Ranked
    • Joined on 04-10-2008
    • Posts 5

    I'm trying to copy data from a sharepoint list to a repeating table in an infopath form so that it can be viewed when not connected to the sharepoint list at the click of a button. I've never really done much with infopath before (none with 2007) so any pointers would be appreciated. The following is what I've tried so far. I'm having problems with the current view part. I get an error that says:

    "Either the combination of values for the View.SelectNodes call is an invalid selection, or the values are not defined for this view, defined for this view more than once, or not selectable in the view."

     Any idea how to fix or get around this?

     

    public void CTRL20_5_Clicked(object sender, ClickedEventArgs e)
            {
                // Write your code here.

                XPathNavigator rootMain = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group5", NamespaceManager);
                XPathNavigator rootSecondary = this.DataSources["Universities"].CreateNavigator().SelectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Universities", NamespaceManager);

                // Select nodes in specified XPathNavigator.
                CurrentView.SelectNodes(rootSecondary);


                XPathNodeIterator selectedNodes = CurrentView.GetSelectedNodes();

                XmlWriter writer = rootMain.SelectSingleNode("/my:myFields", NamespaceManager).AppendChild();

                string myNamespace = NamespaceManager.LookupNamespace("my");

                foreach (XPathNavigator selectedNode in selectedNodes)
                {
                    writer.WriteStartElement("group6", myNamespace);
                    writer.WriteElementString("field3", myNamespace, selectedNode.ToString());
                    writer.WriteEndElement();
                }

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