<?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: How to remove existing rows from repeating table and add one back in</title><link>https://www.infopathdev.com:443/forums/thread/77003.aspx</link><pubDate>Thu, 29 Mar 2012 16:42:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:77003</guid><dc:creator>Anson Hidajat</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/77003.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=77003</wfw:commentRss><description>&lt;p&gt;Have you considered using qRules? There is a Insert and Delete command that would make it very easy to remove repeating table nodes without having to write custom code.&lt;/p&gt;&lt;p&gt;More info: &lt;a href="http://www.qdabra.com/en/products/qRules_new.aspx"&gt;http://www.qdabra.com/en/products/qRules_new.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>How to remove existing rows from repeating table and add one back in</title><link>https://www.infopathdev.com:443/forums/thread/76904.aspx</link><pubDate>Tue, 27 Mar 2012 17:21:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:76904</guid><dc:creator>MStick</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/76904.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=76904</wfw:commentRss><description>from searching found code snippets to do each part but together do not seem to work.
Getting null exception - most likely due to nothing to clone - how do you get or set first &amp;quot;empty&amp;quot; row back in table?
whats wrong with this code?


 
           XPathNavigator myNavigator = this.MainDataSource.CreateNavigator();

            // remove data from previous label generation, add one back in

            XPathNodeIterator myLabelParent = myNavigator.Select(&amp;quot;/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup&amp;quot;, NamespaceManager);
            if (myLabelParent.Count &amp;gt; 0)
            {
                XPathNavigator first = myNavigator.SelectSingleNode(&amp;quot;/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup[1]&amp;quot;, NamespaceManager);
                XPathNavigator last = myNavigator.SelectSingleNode(&amp;quot;/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup[position()=last()]&amp;quot;, NamespaceManager);
                first.DeleteRange(last);
            }
            XPathNavigator addOne = myNavigator.SelectSingleNode(&amp;quot;/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup&amp;quot;, NamespaceManager);
            XPathNavigator newRow = addOne.Clone();
            newRow.InsertAfter(addOne);

Thanks !</description></item></channel></rss>