Remove Row From Repeating Table - InfoPath Dev
in

InfoPath Dev

Remove Row From Repeating Table

Last post 03-24-2007 07:52 AM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-22-2007 04:19 PM

    • YoungSC
    • Not Ranked
    • Joined on 03-01-2007
    • Australia
    • Posts 13

    Remove Row From Repeating Table

    After being able to add a row, I realised I would need to be able to remove a row.

    Here is some code to remove the last row, you could modify it to remove a selected row.

    Dim parent As XPathNavigator = MainDataSource.CreateNavigator.SelectSingleNode("/my:myFields/my:group3", NamespaceManager)
    Dim lastchild As XPathNavigator = parent.SelectSingleNode("child::*[position() = last()]", NamespaceManager)
    Dim rownav As XPathNavigator = MainDataSource.CreateNavigator.SelectSingleNode("/my:myFields/my:group3/my:group4", NamespaceManager)
    Dim parentchildcount As Integer = parent.SelectChildren(XPathNodeType.Element).Count
    If parentchildcount > 1 Then
    rownav.MoveTo(lastchild)
    rownav.DeleteRange(lastchild)
    End If
  • 03-24-2007 07:52 AM In reply to

    Re: Remove Row From Repeating Table

    Hi Simon,

    Thanks for this code sample! It is especially useful since it uses the InfoPath 2007 OM, which not a lot of people have experience with (including me, sadly!)
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.