How to Programatically add a New Row to an Existing Repeating Table in Infopath RRS feed

  • Question

  •  I have a repeating table in Infopath 2007.

    I want to be able to progrmaticclly add a row to it.

    In this scenario I have a table of Drugs: grpRX;


    Dim i As Integer

    'grap a pointer to the maindatsource

    Dim RXnav As XPathNavigator = MainDataSource.CreateNavigator()

    'instantiate a node iterator for a repeating group

    'iterate the number of rows...


    Dim RxRows As XPathNodeIterator = RXnav.Select("/my:myFields/my:Exam/my:grpRXHeader/my:grpRX", NamespaceManager)

    i = 0


    While RxRows.MoveNext()

    i = i + 1


    End While



    'point to the last row in the table


    Dim RxRow As XPathNavigator = RXnav.SelectSingleNode("/my:myFields/my:Exam/my:grpRXHeader/my:grpRX[ " & i.ToString & "]", NamespaceManager)

    'set some value on the first field in the table

    Dim Rxfield As XPathNavigator = RxRow.SelectSingleNode("./my:cboDrug", NamespaceManager)


    'OK HERE is where i want to put in a new row ...but this does not work.


    Friday, November 11, 2011 6:10 PM