Repeating table with 2 data sources. - InfoPath Dev
in

InfoPath Dev

Repeating table with 2 data sources.

Last post 08-28-2012 09:40 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-28-2012 08:01 AM

    • SP Tom
    • Not Ranked
    • Joined on 08-28-2012
    • Posts 3

    Repeating table with 2 data sources.

    Any help would be appreciated So here is the error: System.NullReferenceException Object reference not set to an instance of an object. at repeating_table_to_list.FormCode.CTRL70_5_Clicked(Object sender, ClickedEventArgs e) at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent) The code: //Connect to secondary data source DataSource ds = DataSources["RE_Tasks"]; XPathNavigator domNav = ds.CreateNavigator(); XPathNodeIterator rows = domNav.Select("/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW", NamespaceManager); //Loop through secondary data source and populate the repeating table while (rows.MoveNext()) { string Title = rows.Current.SelectSingleNode("Title", NamespaceManager).Value.ToString(); string ID = rows.Current.SelectSingleNode("ID",NamespaceManager).Value.ToString(); string Closing = rows.Current.SelectSingleNode("Closing", NamespaceManager).Value.ToString(); using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode("/my:MainDataSource/my:group4", NamespaceManager).AppendChild()) { writer.WriteStartElement("group5", myNamespace); writer.WriteElementString("Closing",myNamespace ,Closing); writer.WriteElementString("Title", myNamespace, Title); writer.WriteElementString("ID", myNamespace, ID); writer.WriteEndElement(); writer.Close(); }
  • 08-28-2012 09:40 AM In reply to

    Re: Repeating table with 2 data sources.

    Run in debug to find out what's null - here's a blog post with info on how to run your code in debug.

    Hilary Stoupa

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