Reading Repeating Table Values

K

kb at donovanhill

Hi,

I am using InfoPath 2007 with VB.net and would like to write all the field
values entered within a forms repeating table to a sharepoint list. Submit to
sharepoint is fine, I just need some sample code that loops through table
values, any help would be greatly appreciated.

Thanks
 
K

K.Ramana Reddy(GGK Tech)

Hi,

Use below code.

//To get all nodes in a repeating table.
Dim NodeList = thisXDocument.DOM.selectNodes("Xpath of your repeating table
parent node")

//iterate through all nodes in repeating table.
for(var i = 0; i< NodeList.length; i++)
{
//if you want to do any thing here, you can write code }
 
K

kb at donovanhill

Hi,

Thanks for your reply, unfortunately 'thisXDocument.DOM.selectnodes' is now
legacy in InfoPath2007, so I could not get this to work, although your
suggestion prompted me to try other solutions, the vb.net code below works,
but may not be the best solution.

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

Dim navigator As XPathNavigator = Me.CreateNavigator()
Dim nodes As XPathNodeIterator =
navigator.Select("/my:myFields/my:group1/my:group2", NamespaceManager)
Dim nodesNavigator As XPathNavigator = nodes.Current
Dim NodeValue As String

Dim nodestext As XPathNodeIterator =
nodesNavigator.SelectDescendants(XPathNodeType.Text, False)

While nodestext.MoveNext()
NodeValue = nodestext.Current.Value
MessageBox.Show(nodestext.Current.Value)
End While

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top