Populating a repeating table from a Sharepoint List. Part 2. - InfoPath Dev
in

InfoPath Dev

Populating a repeating table from a Sharepoint List. Part 2.

Last post 04-06-2012 03:50 PM by esb1922. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 04-06-2012 03:50 PM

    Populating a repeating table from a Sharepoint List. Part 2.

    There are multiple examples how to populate a repeating table from a Sharepoint List, so that's not the problem, but let me change scenario a bit.
    I'd like to have a repeating section with a dropdown list and repeating table. Let's say I have Sharepoint List with 3 columns: Department, FirstName, LastName.
    I want to populate the dropdown list with Departments and when an item is selected, to populate the repeating table with Names.

    That all works fine but only in the first section. When I click on Insert new section and then select from the dropdown, nothing happens.

    I guess the problem is in the AddItem code. Do I have to specify a current section's index and if yes, then how?

    Private Sub AddItem(ByVal FName As String, ByVal LName As String)
    Dim doc As XmlDocument = New XmlDocument()
    Dim group As XmlNode = doc.CreateElement("Names", NamespaceManager.LookupNamespace("my"))
    Dim field As XmlNode = doc.CreateElement("FirstName", NamespaceManager.LookupNamespace("my"))
    Dim node As XmlNode = group.AppendChild(field)
    node.InnerText = FName
    field = doc.CreateElement(
    "ListName", NamespaceManager.LookupNamespace("my"))
    node = group.AppendChild(field)
    node.InnerText = LName
    doc.AppendChild(group)
    MainDataSource.CreateNavigator().SelectSingleNode(
    "/my:myFields/my:Section/my:Group1/my:Group2", NamespaceManager).AppendChild(doc.DocumentElement.CreateNavigator())
    End Sub

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