How to remove existing rows from repeating table and add one back in - InfoPath Dev
in

InfoPath Dev

How to remove existing rows from repeating table and add one back in

Last post 03-29-2012 09:42 AM by Anson Hidajat. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-27-2012 10:21 AM

    • MStick
    • Not Ranked
    • Joined on 03-16-2012
    • Posts 2

    How to remove existing rows from repeating table and add one back in

    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 "empty" 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("/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup", NamespaceManager); if (myLabelParent.Count > 0) { XPathNavigator first = myNavigator.SelectSingleNode("/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup[1]", NamespaceManager); XPathNavigator last = myNavigator.SelectSingleNode("/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup[position()=last()]", NamespaceManager); first.DeleteRange(last); } XPathNavigator addOne = myNavigator.SelectSingleNode("/my:myFields/my:TestSection/my:LabelDataTable/my:LabelGroup", NamespaceManager); XPathNavigator newRow = addOne.Clone(); newRow.InsertAfter(addOne); Thanks !
    Filed under:
  • 03-29-2012 09:42 AM In reply to

    Re: How to remove existing rows from repeating table and add one back in

    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.

    More info: http://www.qdabra.com/en/products/qRules_new.aspx

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.