<?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: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/40269.aspx</link><pubDate>Thu, 02 Apr 2009 22:34:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40269</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40269.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40269</wfw:commentRss><description>&lt;p&gt;Hi -- can you give me some more information about what you are trying to do and what is going wrong? &lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/40241.aspx</link><pubDate>Wed, 01 Apr 2009 22:57:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40241</guid><dc:creator>bcowley</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40241.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40241</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hilary, I am having a very similar problem and hope you can help me.&amp;nbsp; I am also very new to C# and XPath!!!&lt;/p&gt;
&lt;p&gt;I am trying to copy results from a secondary datasource to a repeating table in my form.&amp;nbsp; The repeating table is setup as follows&lt;/p&gt;
&lt;div&gt;/my:myFields&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice/my:ItemNo&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice/my:Description&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice/my:UnitPrice&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice/my:UnitOfMeasureCode&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice/my:PriceIncludesVAT&lt;/div&gt;
&lt;div&gt;/my:myFields/my:GasPrices/my:GasPrice/my:MonthEndDate&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;and my secondary datasource as follows...&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1/ns1:Item_x0020_No_&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1/ns1:Description&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1/ns1:Unit_x0020_Price&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1/ns1:Unit_x0020_of_x0020_Measure_x0020_Code&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1/ns1:Price_x0020_Includes_x0020_VAT&lt;/div&gt;
&lt;div&gt;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1/ns1:Month_x0020_End_x0020_Date&lt;/div&gt;&amp;nbsp; 
&lt;p&gt;Here is the code behind that I am using...&lt;/p&gt;
&lt;p&gt;public void CTRL9_5_Clicked(object sender, ClickedEventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Access the main data source&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator myForm = MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator myRows = myForm.SelectSingleNode(&amp;quot;/my:myFields/my:GasPrices/my:GasPrice&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator parent = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/my:myFields/my:GasPrices&amp;quot;, NamespaceManager);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Delete the first row in the destination repeating group if it is empty&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator myRow = myForm.SelectSingleNode(&amp;quot;/my:myFields/my:GasPrices/my:GasPrice[1]&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (myRow != null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myRow.DeleteSelf();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Select the field&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator mySecDS = DataSources[&amp;quot;GetGasPriceROI&amp;quot;].CreateNavigator();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator nodes = mySecDS.Select(&amp;quot;/dfs:myFields/dfs:dataFields/s0:GetGasPriceROIResponse/s0:GetGasPriceROIResult/ns1:SqlRowSet1/ns1:row1&amp;quot;, NamespaceManager);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (XPathNavigator node in nodes)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator newNode = mySecDS.Clone();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;my:ItemNo&amp;quot;, NamespaceManager).SetValue(mySecDS.SelectSingleNode(&amp;quot;/ns1:Item_x0020_No_&amp;quot;, NamespaceManager).Value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;my:Description&amp;quot;, NamespaceManager).SetValue(mySecDS.SelectSingleNode(&amp;quot;/ns1:Description&amp;quot;, NamespaceManager).Value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;my:UnitPrice&amp;quot;, NamespaceManager).SetValue(mySecDS.SelectSingleNode(&amp;quot;/ns1:Unit_x0020_Price&amp;quot;, NamespaceManager).Value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;my:UnitOfMeasureCode&amp;quot;, NamespaceManager).SetValue(mySecDS.SelectSingleNode(&amp;quot;/ns1:Unit_x0020_Of_x0020_Measure_x0020_Code&amp;quot;, NamespaceManager).Value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;my:PriceIncludesVAT&amp;quot;, NamespaceManager).SetValue(mySecDS.SelectSingleNode(&amp;quot;/ns1:Price_x0020_Includes_x0020_VAT&amp;quot;, NamespaceManager).Value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;my:MonthEndDate&amp;quot;, NamespaceManager).SetValue(mySecDS.SelectSingleNode(&amp;quot;/ns1:Month_x0020_End_x0020_Date&amp;quot;, NamespaceManager).Value);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parent.AppendChild(newNode);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any help you can give me would be very much appreciated!&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Brian &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/40000.aspx</link><pubDate>Wed, 25 Mar 2009 20:22:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:40000</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/40000.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=40000</wfw:commentRss><description>&lt;p&gt;Post back with questions as they arise. Understanding what the code is doing is the first step to writing your own!&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39999.aspx</link><pubDate>Wed, 25 Mar 2009 20:00:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39999</guid><dc:creator>cjg1979</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39999.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39999</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You&amp;#39;re a genius!&amp;nbsp; That worked exactly like you&amp;#39;d expect it to.&amp;nbsp; Now I need to sit down and study your code, and see if I can wrap my head around it enough to put it into VB so that I can reuse the concepts.&amp;nbsp; Thank you so much!&amp;nbsp; You&amp;#39;ve taught me an invaluable amount of information.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39998.aspx</link><pubDate>Wed, 25 Mar 2009 19:20:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39998</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39998.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39998</wfw:commentRss><description>&lt;p&gt;Well, let&amp;#39;s try this -- append the cloned node, then, since that will be the new last node in the ApplicationAccess group, we&amp;#39;ll grab that and set the value. So this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;newNode.SelectSingleNode(&amp;quot;@Applications&amp;quot;, this.NamespaceManager).SetValue(auxDomNode.Value);&lt;br /&gt;parent.AppendChild(newNode);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;parent.AppendChild(newNode);&lt;br /&gt;parent.SelectSingleNode(&amp;quot;d:ApplicationAccess[last()]/@Applications&amp;quot;, this.NamespaceManager).SetValue(auxDomNode.Value);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;When I tried something like&amp;nbsp;this on my test form, my rules fired correctly....&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39997.aspx</link><pubDate>Wed, 25 Mar 2009 18:28:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39997</guid><dc:creator>cjg1979</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39997.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39997</wfw:commentRss><description>&lt;p&gt;The field, in comparison to the @Applications field, would be @Officer, @Backup_Officer, @Officer_Email, @Backup_Email.&amp;nbsp; LOL&amp;nbsp; All of those fields are filling automatically when I select from the drop down, just can&amp;#39;t for the life of me get them to fire when the code is applied.&amp;nbsp; &lt;/p&gt;&lt;p&gt;I have a custom submit button (because I submit to database, change views, and email the form), and tried to use it to apply the same rule, but to no avail.&amp;nbsp; There are secondary data sources for the officers and the officer emails that the data comes from. &amp;nbsp;&lt;/p&gt;&lt;p&gt;The more I learn about this the more I see that this is probably more complicated than need be, but it is my first go round with a form with this much automation built in. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39996.aspx</link><pubDate>Wed, 25 Mar 2009 18:21:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39996</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39996.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39996</wfw:commentRss><description>&lt;p&gt;That is kind of annoying -- this is something I&amp;#39;ve done in IP 2003 Object Model, and my rules fire when I append first. In the test form I was using for the original code I posted, the behavior is as you report, which would mean a change between IP 2003 and 2007.&lt;/p&gt;
&lt;p&gt;Where is your field that is being set located in your data structure? Do you want to just set the value in the foreach loop when you set the other value?&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39995.aspx</link><pubDate>Wed, 25 Mar 2009 17:59:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39995</guid><dc:creator>cjg1979</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39995.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39995</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Which is exactly what I thought.&amp;nbsp; The result, however, was unexpected.&amp;nbsp; It gives me a blank first line and does not fire the rule.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39994.aspx</link><pubDate>Wed, 25 Mar 2009 17:52:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39994</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39994.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39994</wfw:commentRss><description>&lt;p&gt;Okay, so I see:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;newNode.SelectSingleNode(&amp;quot;@Applications&amp;quot;, this.NamespaceManager).SetValue(auxDomNode.Value);&lt;br /&gt;parent.AppendChild(newNode);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;But to have your rule fire, I&amp;#39;d want to see:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;parent.AppendChild(newNode);&amp;nbsp;&lt;br /&gt;newNode.SelectSingleNode(&amp;quot;@Applications&amp;quot;, this.NamespaceManager).SetValue(auxDomNode.Value);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;So that the new node had been added to the main dom prior to having the value set.....&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39993.aspx</link><pubDate>Wed, 25 Mar 2009 17:49:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39993</guid><dc:creator>cjg1979</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39993.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39993</wfw:commentRss><description>&lt;p&gt;Yes, the rule is set on @Applications node of the data being filled in with this code.&amp;nbsp; The rule is to set the Officer field filtered with @Application=current(). &amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CTRL66_7_Clicked(object sender, ClickedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get the nodelist from the secondary data source -- replace the data source name and xpath with your data source and xpath to the repeating group from your secondary data source&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator auxDomNodes = this.DataSources[&amp;quot;AppList&amp;quot;].CreateNavigator().Select(&amp;quot;/dfs:myFields/dfs:dataFields/s0:AppListResponse/s0:AppListResult/sqlresultstream:SqlRowSet/ns1:SqlRowSet1/ns1:row/ns1:Application&amp;quot;, this.NamespaceManager);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //get a main data source node from sampledata.xml --replace the xpath with the xpath to the repeating group from your main data source&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlDocument sampleData = new XmlDocument();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sampleData.Load(this.Template.OpenFileFromPackage(&amp;quot;sampledata.xml&amp;quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator mainDomNode = sampleData.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Employee/d:ApplicationAccess&amp;quot;, this.NamespaceManager);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //remove any existing nodes in the main data source&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator parent = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Employee&amp;quot;, this.NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator children = parent.Select(&amp;quot;d:ApplicationAccess&amp;quot;, this.NamespaceManager);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (XPathNavigator child in children)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; child.DeleteSelf();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //create new nodes with the new data and append&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (XPathNavigator auxDomNode in auxDomNodes)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator newNode = mainDomNode.Clone();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newNode.SelectSingleNode(&amp;quot;@Applications&amp;quot;, this.NamespaceManager).SetValue(auxDomNode.Value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parent.AppendChild(newNode);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39992.aspx</link><pubDate>Wed, 25 Mar 2009 17:28:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39992</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39992.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39992</wfw:commentRss><description>&lt;p&gt;Just to verify -- the rule is set on the field you wish to populate via this code? Can you paste your code again so we have the latest?&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39990.aspx</link><pubDate>Wed, 25 Mar 2009 16:36:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39990</guid><dc:creator>cjg1979</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39990.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39990</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Dang you guys are good.&amp;nbsp; :)&amp;nbsp; Jimmy, I used your solution for the first line, solved like a charm.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hillary, I made the change you suggested, and it gives me a blank first line again, but does not fire the rule.&amp;nbsp; Maybe I simply need to apply the rule to something else...although I can&amp;#39;t figure out what...since the field it all depends on we are now filling.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39988.aspx</link><pubDate>Wed, 25 Mar 2009 16:28:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39988</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39988.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39988</wfw:commentRss><description>&lt;p&gt;For the duplicated first line issue, this line is the problem:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;XPathNodeIterator children = parent.Select(&amp;quot;/d:ApplicationAccess&amp;quot;, this.NamespaceManager);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Please try changing it to&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;XPathNodeIterator children = parent.Select(&amp;quot;d:ApplicationAccess&amp;quot;, this.NamespaceManager);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;(forward slash removed) or&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;XPathNodeIterator children = parent.Select(&amp;quot;&lt;strong&gt;*&lt;/strong&gt;&amp;quot;, this.NamespaceManager);&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39987.aspx</link><pubDate>Wed, 25 Mar 2009 16:28:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39987</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39987.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39987</wfw:commentRss><description>&lt;p&gt;The rule isn&amp;#39;t firing because we are filling the values, then appending the node. You can switch the lines in the for each loop so that the line:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;parent.AppendChild(newNode);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Comes before the line that starts with:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;newNode.SelectSingleNode&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This way the newNode has been attached to the main dom BEFORE the value is set.....and your rule should fire.&lt;/p&gt;</description></item><item><title>Re: Iterate through repeating table with complex SQL query</title><link>https://www.infopathdev.com:443/forums/thread/39986.aspx</link><pubDate>Wed, 25 Mar 2009 16:23:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39986</guid><dc:creator>cjg1979</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39986.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=39986</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yay, both options work.&amp;nbsp; But the first line is simply blank, which I thought the &lt;b&gt;child.DeleteSelf() &lt;/b&gt;would take care of..(odd), and the rule that is applied to the field being set to a value isn&amp;#39;t firing.&amp;nbsp; If you have some quick ideas, I&amp;#39;d be appreciative, but you&amp;#39;ve both done more than I could imagine.&amp;nbsp; :)&amp;nbsp; Thanks guys.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>