shivapshankar

Hi,

Can any one let me know on how to add / update data in to a repeating table in a custom list progrmmatically.

Regards,

Shiva



Re: SharePoint - InfoPath Forms Services Adding & updating data in the repeating table in InfoPath 2007 browser enabled form

The Brebinator

Hi there,

I am eager to work this one out as well. I would like to populate a repeating table with information from a CSV file.

Had any progress

Brebo





Re: SharePoint - InfoPath Forms Services Adding & updating data in the repeating table in InfoPath 2007 browser enabled form

David Dean

You can do this using the managed code object model to manipulate the XML for the form. A repeating table or section is represented in the XML as a repeating element, so to add a row to a repeating table you would generate an XML fragment for the repeating element and its child nodes and append it to the parent XML node that represents the parent section on the form.

The VB code to add a child element might look something like this:

Code Snippet

' Move to the root element of the document

Dim root As XPathNavigator = Me.MainDataSource.CreateNavigator()

root.MoveToFollowing(XPathNodeType.Element)

' Get an XPathNavigator pointing to the parent node where the repeating elements will be added

Dim sectionNode As XPathNavigator = root.SelectSingleNode("/my:myFields/my:Customers", Me.NamespaceManager)

Dim ns As String = sectionNode.NamespaceURI

' Add the XML tree for the child element

Using writer As XmlWriter = sectionNode.AppendChild()

writer.WriteStartElement("my", "Customer", ns)

writer.WriteElementString("my", "CustomerID", ns, customerID)

writer.WriteElementString("my", "CustomerName", ns, customerName)

writer.WriteEndElement()

End Using

To add multiple rows to the table, simply add a loop around the Using block. The XML must conform to the document schema or you will get a SchemaValidationException at the end of the Using block.






Re: SharePoint - InfoPath Forms Services Adding & updating data in the repeating table in InfoPath 2007 browser enabled form

nstorandt

Hey David,

thanks for this post. You save me a lot of time. But if I try to use this code snippet i get a Schema validation found non-data type errors. Error.

I have read another post about a nil value and tried this but with no luck.

Do you have a resolution for this






Re: SharePoint - InfoPath Forms Services Adding & updating data in the repeating table in InfoPath 2007 browser enabled form

GCrawford

Hi Nadine

This blog explains it and gives a solution. It worked when i came across the the problem.

http://blogs.msdn.com/infopath/archive/2006/11/28/the-xsi-nil-attribute.aspx

Graham