<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Remove Duplicates from XPathNodeIterator</title><link>https://www.infopathdev.com:443/forums/thread/107248.aspx</link><pubDate>Thu, 30 Jun 2016 19:27:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:107248</guid><dc:creator>ISUGraber</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/107248.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=107248</wfw:commentRss><description>Thanks for the reply.  Is there a way I can get my code to come out in non-paragraph ways?  I found the answer in the meantime or at least a workaround.  

This command gets rid of duplicates.  
// Selecting the multi box that contains all of the reports I want.
                                XPathNodeIterator multirpt = root.Select(&amp;quot;//my:Report_Name[not(. = preceding-sibling::item)]&amp;quot;,
                                 NamespaceManager);  //Report Name needs to reset each time a new facility is added.  //[@Report_Name = preceding-sibling::image/@Report_Name]



// Create a List to manage

                                List multirptList = new List();


//Make sure said node is filled in .
                                while (multirpt.MoveNext())
                                {

                                    string Rpt = multirpt.Current.Value;
// add reports to list from above.
                                    multirptList.Add(Rpt);

                                }


// Finally get the Unique records.
List unique = multirptList.Distinct().ToList();</description></item><item><title>Re: Remove Duplicates from XPathNodeIterator</title><link>https://www.infopathdev.com:443/forums/thread/107145.aspx</link><pubDate>Thu, 23 Jun 2016 20:54:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:107145</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/107145.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=107145</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I&amp;#39;m guessing your code may have gotten cut off when you posted - can you try again, and maybe use IE for posting? Other browsers seem to cause formatting problems in posts. I generally use a foreach loop to go through repeating nodes - code samples can be found &lt;a href="http://stackoverflow.com/questions/12953874/xpathnodeiterator-access-child-nodes-from-iterated-data"&gt;here&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Remove Duplicates from XPathNodeIterator</title><link>https://www.infopathdev.com:443/forums/thread/107135.aspx</link><pubDate>Wed, 22 Jun 2016 14:28:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:107135</guid><dc:creator>ISUGraber</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/107135.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=107135</wfw:commentRss><description>I am creating an InfoPath 2013 form with C# to pull data from and upload data to SQL Server.  As part of the process I had to create a &amp;quot;Select All&amp;quot; Checkbox for my reports list.  However, if I use the &amp;quot;Select All&amp;quot; option and then commit the code I get a duplicate record entered.  If I manually select all checkboxes I don&amp;#39;t get any duplicates.  I am brand new to InfoPath and C#.  So please let me know if I&amp;#39;m missing anything.  

I am doing this with XPathNodeIterator.  

Is there a way to find and remove duplicates with xPath?  

This is where I&amp;#39;m grabbing the reports from the Multi Selection Box:
                            XPathNodeIterator multirpt = root.Select(&amp;quot;//my:Report_Name&amp;quot;,
                             NamespaceManager);  //Report Name needs to reset each time a new facility is added.

                            while (multirpt.MoveNext())  //multirpt is to loop through the selected reports to add them to the access table.
                            {</description></item></channel></rss>