<?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: DeleteSelf() method does not trigger on an InfoPath Form</title><link>https://www.infopathdev.com:443/forums/thread/68363.aspx</link><pubDate>Wed, 13 Jul 2011 09:29:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:68363</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/68363.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=68363</wfw:commentRss><description>&lt;p&gt;There is a semantic problem with your code.&amp;nbsp; As you iterate through and delete nodes, their positions will change, and the node that was previously at position [2] will now be at position [1] and you will skip over it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The typical way to approach deleting nodes is to add all the ones you want to delete to an array, then iterate throught the array and call DeleteSelf() on them.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I also suggest walking through your code to figure out just what is going on, and it also looks like you&amp;#39;re never setting the modified XML back to your list item at any point.&lt;/p&gt;</description></item><item><title>Re: DeleteSelf() method does not trigger on an InfoPath Form</title><link>https://www.infopathdev.com:443/forums/thread/68343.aspx</link><pubDate>Tue, 12 Jul 2011 19:01:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:68343</guid><dc:creator>IP_Help</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/68343.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=68343</wfw:commentRss><description>Here is the full code: &lt;br /&gt;&lt;br /&gt;
XmlDocument xml = new XmlDocument();&lt;br /&gt;
&lt;br /&gt;
using (Stream s = workflowProperties.Item.File.OpenBinaryStream())&lt;br /&gt;
{&lt;br /&gt;
    xml.Load(s);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
XmlNamespaceManager man = new XmlNamespaceManager(xml.NameTable);&lt;br /&gt;
man.AddNamespace(&amp;quot;xsi&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;);&lt;br /&gt;
man.AddNamespace(&amp;quot;xhtml&amp;quot;, &amp;quot;http://www.w3.org/1999/xhtml&amp;quot;);&lt;br /&gt;
man.AddNamespace(&amp;quot;xd&amp;quot;, &amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-09T15:29:07&amp;quot;);&lt;br /&gt;
man.AddNamespace(&amp;quot;my&amp;quot;, &amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-09T15:29:07&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
root = xml.CreateNavigator();&lt;br /&gt;
&lt;br /&gt;
XPathNodeIterator iter = root.Select(&amp;quot;/my:myFields/my:grpRequest&amp;quot;, man);&lt;br /&gt;
int nodesCount = iter.Count;&lt;br /&gt;
&lt;br /&gt;
string app = GetSubstring(workflowProperties.Item[&amp;quot;Title&amp;quot;].ToString(), &amp;quot;_&amp;quot;, &amp;quot;.xml&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
for (int i = 1; i (lessthanequals) nodesCount; i++) --- The sematics for &amp;quot;lessthanequals&amp;quot; cannot be used in a post here&lt;br /&gt;
{&lt;br /&gt;
	XPathNavigator currentNodeItem = root.SelectSingleNode(&amp;quot;/my:myFields/my:grpRequest[&amp;quot; + i + &amp;quot;]/my:strApplication&amp;quot;, man);          &lt;br /&gt;          
	XPathNavigator currentNodeItem1 = root.SelectSingleNode(&amp;quot;/my:myFields/my:grpRequest[&amp;quot; + i + &amp;quot;]&amp;quot;, man);&lt;br /&gt;
    if (currentNodeItem1 != null)&lt;br /&gt;
    {&lt;br /&gt;
        string appName = currentNodeItem.Value;&lt;br /&gt;
        string tet = currentNodeItem1.Value;&lt;br /&gt;
        if (appName != app)&lt;br /&gt;
        {&lt;br /&gt;
            currentNodeItem1.DeleteSelf();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
workflowProperties.Item.SystemUpdate(false);&lt;br /&gt;</description></item><item><title>Re: DeleteSelf() method does not trigger on an InfoPath Form</title><link>https://www.infopathdev.com:443/forums/thread/68337.aspx</link><pubDate>Tue, 12 Jul 2011 18:29:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:68337</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/68337.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=68337</wfw:commentRss><description>&lt;p&gt;Looks like your code was cut off.&lt;/p&gt;</description></item><item><title>DeleteSelf() method does not trigger on an InfoPath Form</title><link>https://www.infopathdev.com:443/forums/thread/68332.aspx</link><pubDate>Tue, 12 Jul 2011 16:38:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:68332</guid><dc:creator>IP_Help</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/68332.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=68332</wfw:commentRss><description>I am trying to trigger a WF on an InfoPath form to delete a row from a Repeating Table within the form, when a certain condition is met.
The DeleteSelf() method does not throw any error/Exception, but does not execute as well. When I view the form after the WF completes (no exceptions again), all the rows in the repeating table are still there.

Note: The WF is being manually started, for testing purposes.

Am I missing something here?

Here is the code:

**************************************************************************************************

XmlDocument xml = new XmlDocument();

using (Stream s = workflowProperties.Item.File.OpenBinaryStream())
{
    xml.Load(s);
}

XmlNamespaceManager man = new XmlNamespaceManager(xml.NameTable);
man.AddNamespace(&amp;quot;xsi&amp;quot;, &amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;);
man.AddNamespace(&amp;quot;xhtml&amp;quot;, &amp;quot;http://www.w3.org/1999/xhtml&amp;quot;);
man.AddNamespace(&amp;quot;xd&amp;quot;, &amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-09T15:29:07&amp;quot;);
man.AddNamespace(&amp;quot;my&amp;quot;, &amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-09T15:29:07&amp;quot;);

root = xml.CreateNavigator();

XPathNodeIterator iter = root.Select(&amp;quot;/my:myFields/my:grpRequest&amp;quot;, man);
int nodesCount = iter.Count;

string app = GetSubstring(workflowProperties.Item[&amp;quot;Title&amp;quot;].ToString(), &amp;quot;_&amp;quot;, &amp;quot;.xml&amp;quot;);

for (int i = 1; i</description></item></channel></rss>