<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Adding first row to repeating table</title><link>https://www.infopathdev.com:443/forums/thread/14818.aspx</link><pubDate>Fri, 06 Oct 2006 16:39:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14818</guid><dc:creator>BhailDa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14818.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14818</wfw:commentRss><description>I has a simialr problem within InfoPath 2007 Managed code. Code solution:&lt;br /&gt;&lt;br /&gt;            // Now Create a new row&lt;br /&gt;            // Find first Instance of repeat nodes and create entry before.&lt;br /&gt;            xNode = xNavigator.SelectSingleNode("//History", this.NamespaceManager);&lt;br /&gt;            string sNewRow = string.Format("&amp;lt;History&amp;gt;&amp;lt;User&amp;gt;{0}&amp;lt;/User&amp;gt;&amp;lt;ChangeType&amp;gt;{1}&amp;lt;/ChangeType&amp;gt;&amp;lt;CreateDate&amp;gt;{2}&amp;lt;/CreateDate&amp;gt;&amp;lt;/History&amp;gt;", sUser, sChangeType, sCreateDate);&lt;br /&gt;            xNode.InsertBefore(sNewRow);</description></item><item><title>Re: Adding first row to repeating table</title><link>https://www.infopathdev.com:443/forums/thread/14817.aspx</link><pubDate>Tue, 03 Oct 2006 16:19:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14817</guid><dc:creator>LaurieAPMarsh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14817.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14817</wfw:commentRss><description>In fact last night I got your first option working and this morning your second option.  It still seems like creating the node should work but I sure don't see the mistake.  &lt;br /&gt;&lt;br /&gt;Thank you for your reply.</description></item><item><title>Re: Adding first row to repeating table</title><link>https://www.infopathdev.com:443/forums/thread/14816.aspx</link><pubDate>Tue, 03 Oct 2006 16:14:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14816</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14816.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14816</wfw:commentRss><description>I think the problem with appendChild is that you are making some kind of mistake when you call thisXDocument.DOM.createNode().  There might be some kind of problem with the namespace or something, but this should work if everything is done correctly.&lt;br /&gt;&lt;br /&gt;However, there are a couple of ways to solve this problem:&lt;br /&gt;&lt;br /&gt;1. Create a global IXMLDOMNode variable to hold the clone of the QF129 node, and populate this variable in Onload.  This way you will have the clone before it is removed and you will have it for the life of the code since it is a global variable.&lt;br /&gt;&lt;br /&gt;2. Create a temporary DOM and load the xml from the template.xml file.&lt;br /&gt;&lt;br /&gt;Personally, I think the first method is cleaner and easier.&lt;br /&gt;&lt;br /&gt;I hope this helps - good luck!</description></item><item><title>Adding first row to repeating table</title><link>https://www.infopathdev.com:443/forums/thread/12954.aspx</link><pubDate>Mon, 02 Oct 2006 14:23:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12954</guid><dc:creator>LaurieAPMarsh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12954.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12954</wfw:commentRss><description>I have a main connection that looks like:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;myFields&lt;br /&gt;  dataFields&lt;br /&gt;    d:COE_Employees&lt;br /&gt;      -- some stuff --&lt;br /&gt;      Comments&lt;br /&gt;        -- some attributes --&lt;br /&gt;      QF129&lt;br /&gt;        -- some attributes--&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;both Comments and QF129 are repeating.  Here is the template.xml view:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;dfs:dataFields&amp;gt;&lt;br /&gt;    &amp;lt;d:COE_Employees EmployeeKey="" Name=""&amp;gt;&lt;br /&gt;-- other stuff --&lt;br /&gt;       &amp;lt;d:Comments CommentKey="" Engineer="" Date=""  &lt;br /&gt;                   Comment=""&amp;gt;&amp;lt;/d:Comments&amp;gt;&lt;br /&gt;       &amp;lt;d:QF129 Employee="" Date=""&amp;gt;&amp;lt;/d:QF129&amp;gt;&lt;br /&gt;    &amp;lt;/d:COE_Employees&amp;gt;&lt;br /&gt;&amp;lt;/dfs:dataFields&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After the query is issued, there are no QF129 items in the DOM.  During the lifetime of the form, I want to add them programmatically but cannot use the cloning method since there aren't any to clone from.  Here is the code I have to create the new node and add it to the DOM:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;IXMLDOMNode rootNode = thisXDocument.DOM.selectSingleNode&lt;br /&gt;                   ("/dfs:myFields/dfs:dataFields/d:COE_Employees");&lt;br /&gt;IXMLDOMNode QF129Node = thisXDocument.DOM.createNode(&lt;br /&gt;                 DOMNodeType.NODE_ELEMENT, "d:QF129",&lt;br /&gt; "http://schemas.microsoft.com/office/infopath/2003/ado/datafields");&lt;br /&gt;IXMLDOMAttribute attr = thisXDocument.DOM.createAttribute&lt;br /&gt;                                         ("Employee");&lt;br /&gt;attr.value = rootNode.selectSingleNode("@EmployeeKey").text;&lt;br /&gt;QF129Node.attributes.setNamedItem(attr);&lt;br /&gt;attr = thisXDocument.DOM.createAttribute("Date");&lt;br /&gt;attr.value = thisXDocument.DOM.selectSingleNode&lt;br /&gt;                               ("/dfs:myFields/my:WeekEnding").text;&lt;br /&gt;QF129Node.attributes.setNamedItem(attr);&lt;br /&gt;rootNode.appendChild(QF129Node);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The problem is that the call to appendChild fails with an error saying:&lt;br /&gt;&lt;br /&gt;Element '&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/ado/datafields}QF129'&gt;http://schemas.microsoft.com/office/infopath/2003/ado/datafields}QF129'&lt;/a&gt; is unexpected according to content model of parent element '&lt;a target="_blank" href=http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}COE_Employees'.&gt;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}COE_Employees'.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So, how do I add the first item for a repeating element programmatically?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item></channel></rss>