manoj´ssharepointblog

SharePoint Blog

Retrieving data from InfoPath repeating tables

3 Comments

Programmatically We can retrive the values from an repeating table in a infopath form, In some cases we might need to retrive the content from an repeating table and save the content to SharePoint list.

For Example, below is the screen short of the fields I have in the repeating table.

fields

Source Code to read the values from a repeating table for the above fields and saving it to a SharePoint List

SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPList rList = web.Lists.TryGetList(“MyListName”);
if (rList != null)
{
 XPathNavigator xNavigation = this.MainDataSource.CreateNavigator();
 XPathNodeIterator xNodeIterator = xNavigation.Select(“/my:myFields/my:group1/my:group2”, this.NamespaceManager);
    while (xNodeIterator.MoveNext())
 {  
   SPListItem item = rList.AddItem();
   item[“County”] = xNodeIterator.Current.SelectSingleNode(“my:County”, this.NamespaceManager).Value;
   item[“Road Name”] = xNodeIterator.Current.SelectSingleNode(“my:RoadName”, this.NamespaceManager).Value;         
   item.Update();     
 }
}

In the next post I am going to explain how to use Repeating Table in Infopath to Add and Delete Rows Programmatically.

Advertisements

3 thoughts on “Retrieving data from InfoPath repeating tables

  1. hi manoj,

    thanks the article was really helpful to me,
    I am wondering can I use the same technique to save data from InfoPath repeating table and populate it in another form???
    in other words i have a case were I need to pass a repeating table from one form to another, I tried using Nintex workflow but with no luck so far… so I am trying to find alternatives…

    thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s