Have problems sending data from one repeating table to another. - InfoPath Dev
in

InfoPath Dev

Have problems sending data from one repeating table to another.

Last post 05-31-2013 02:21 PM by Hilary Stoupa. 42 replies.
Page 3 of 3 (43 items) < Previous 1 2 3
Sort Posts: Previous Next
  • 05-28-2013 12:24 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    Sorry, I am running debug now, just getting a little excited to see this  get closer to the end..  This is the new error:

    Dim PartNumb As String = rows.Current.SelectSingleNode("PartNumb", NamespaceManager).Value

  • 05-28-2013 12:36 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    Okay - so for whatever reason, this:

    rows.Current.SelectSingleNode("PartNumb", NamespaceManager)

    Is not returning a node.

    My guess would be that you actually want my:PartNumb. If you copy the XPath to the field PartNumb, what is the XPath?

    Hilary Stoupa

  • 05-28-2013 12:52 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    You were right, once again.  New error: Object reference not set to the instance of an object. - Debug does not show the error.

  • 05-28-2013 02:02 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    Hilary ,

    Thank you very much for your step-by-step assistance, it is very much appreciated.  - Chad

  • 05-28-2013 02:03 PM In reply to

    Re: Have problems sending data from one repeating table to another.

     Put a break point at the beginning of the code and walk through it, checking to see which object is null.

    Hilary Stoupa

  • 05-29-2013 12:44 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    Hilary,

    It looks like I have everything nailed down except for the 'Delete Nil Node'.  The code cycles through without problems but does not write to the table below.  -Chad

  • 05-29-2013 01:07 PM In reply to

    Re: Have problems sending data from one repeating table to another.

     So, is "node" null when you get to the DeleteNil(node) line in your code?

    Hilary Stoupa

  • 05-29-2013 01:41 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    Yes.  I am using this to try an delete the nil:

     Private Sub DeleteNil(ByVal node As XPathNavigator)
                If (node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance")) Then
                    node.DeleteSelf()
                End If
            End Sub

     Then I have:

     While rows.MoveNext()

             
                    Dim PartDesc As String = rows.Current.SelectSingleNode("my:PartDesc", NamespaceManager).Value

                 Try

                        Dim node As XPathNavigator = Me.MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields/POG_MasterList_InfoPath", NamespaceManager)

                        DeleteNil(node)  THIS IS MY HANG UP: If I comment out this line, I can make it all the way through the code.

                        Dim myNamespace As String = NamespaceManager.LookupNamespace("my")

                        Using writer As XmlWriter = MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields", NamespaceManager).AppendChild()

                            writer.WriteStartElement("POG_MasterList_InfoPath", myNamespace)
                          
                            writer.WriteElementString("PartDesc", myNamespace, PartDesc)

  • 05-29-2013 02:45 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    I actually don't understand what you are doing here:

                        Dim node As XPathNavigator = Me.MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields/POG_MasterList_InfoPath", NamespaceManager)

                        DeleteNil(node)

    Do you use the node variable again later in your code?

    Hilary Stoupa

  • 05-29-2013 05:50 PM In reply to

    Re: Have problems sending data from one repeating table to another.

    Hilary, here is that complete portion of the code:

           Public Sub CTRL1334_9_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

                Dim Nav As XPathNavigator = Me.MainDataSource.CreateNavigator()
                Dim rows As XPathNodeIterator = Nav.Select("/dfs:myFields/my:Contain/my:PartsListUpdate", NamespaceManager)

                While rows.MoveNext()

                     Dim PartDesc As String = rows.Current.SelectSingleNode("my:PartDesc", NamespaceManager).Value
                   
                    Try

                        Dim node As XPathNavigator = Me.MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields/POG_MasterList_InfoPath", NamespaceManager)

                        DeleteNil(node)

                        Dim myNamespace As String = NamespaceManager.LookupNamespace("my")

                        Using writer As XmlWriter = MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields", NamespaceManager).AppendChild()

                            writer.WriteStartElement("POG_MasterList_InfoPath", myNamespace)
                            writer.WriteElementString("PartDesc", myNamespace, PartDesc)
                            writer.WriteEndElement()
                            writer.Close()
                        End Using

                    Catch ex As Exception
                    End Try
                End While
                MessageBox.Show("END")
            End Sub

  • 05-30-2013 07:06 AM In reply to

    Re: Have problems sending data from one repeating table to another.

     Yeah - I don't know why you are doing this:

                        Dim node As XPathNavigator = Me.MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields/POG_MasterList_InfoPath", NamespaceManager)

                        DeleteNil(node)

    I also don't understand what your current results are. Is dataFields repeating in your form?

    Hilary Stoupa

  • 05-30-2013 08:12 AM In reply to

    Re: Have problems sending data from one repeating table to another.

    I found this code through research and am trying to adapt it to my needs.  I have attached a picture to hopefully relay my end goal.   

     


  • 05-31-2013 02:21 PM In reply to

    Re: Have problems sending data from one repeating table to another.

     Looking again at your code:

    Try

                        Dim node As XPathNavigator = Me.MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields/POG_MasterList_InfoPath", NamespaceManager)

                        DeleteNil(node)

                        Dim myNamespace As String = NamespaceManager.LookupNamespace("my")

                        Using writer As XmlWriter = MainDataSource.CreateNavigator().SelectSingleNode( _
                        "/dfs:myFields/dfs:dataFields", NamespaceManager).AppendChild()

                            writer.WriteStartElement("POG_MasterList_InfoPath", myNamespace)
                            writer.WriteElementString("PartDesc", myNamespace, PartDesc)
                            writer.WriteEndElement()
                            writer.Close()
                        End Using

     I'd delete the bold items - I think the XPath is incorrect on the field you are trying to delete nil on and I think that it is unnecessary. I also think the italicized line below is incorrect - because I'm guessing that PartDesc and so on are in the "my" namespace. I'm guessing this is a database bound form, and that those may even be attributes. You may want to right click one in the data source task pane and copy the XPath so you can see the XPath for the field?

    Hilary Stoupa

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