<?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: Accessing the fields of a repeating table through code</title><link>https://www.infopathdev.com:443/forums/thread/25056.aspx</link><pubDate>Tue, 11 Dec 2007 13:10:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25056</guid><dc:creator>zeroecho</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25056.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=25056</wfw:commentRss><description>&lt;p&gt;I&amp;#39;ve got a similar problem in that I&amp;#39;ve got a repeating table and whilst I can go through the while loop for each of the Rows in the table, the values don&amp;#39;t change.&lt;/p&gt;
&lt;p&gt;i.e. I&amp;#39;m trying to pull a list of activities and break them down into individual items to post to a sharepoint list for each day spent on that activity. e.g. InfoPath development is done Mon-Sunday for 2hours each day, and then SharePoint development is done Mon-Sun 4hours a day, there should be 14 items in the sharepoint list, 7 for infopah dev listing the breakdown for each day and 7 for sharepoint dev for each day. What I actually get is 14 items, but those 14 would be the infopath dev row repeated twice and no sharepoint dev at all. Here&amp;#39;s my code &lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;Thanks for any help I can get with this. I feel so close to getting it sorted, just stuck on this tiny bit!&lt;/p&gt;
&lt;p&gt;First I look at the MainDataSource and then create an XPathNodeIterator which points to my repeating table&lt;/p&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; domNav = MainDataSource.CreateNavigator();&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;XPathNodeIterator&lt;/font&gt;&lt;font size="2"&gt; activity = domNav.Select(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting/my:PerActivity&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My current method of collecting the node information is using this style of line&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;string taskActivity = activity.Current.SelectSingleNode(perActivity + &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:TaskActivity&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value; (where perActivity = the path to my repeating table)&lt;/font&gt; 
&lt;p&gt;&lt;font size="2"&gt;The problem with this method is that it only selects the first node. If I call activity.Current.Value; the value is incrementing using the while(activity.MoveNext()) command, but actually selecting the children of my repeating node doesn&amp;#39;t work.&lt;br /&gt;&lt;br /&gt;If I try to change the xpath in selectsinglenode to something like&lt;/font&gt;&lt;font size="2"&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;string location = activity.Current.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:Location&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;or&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;string location = activity.Current.SelectSingleNode(&lt;font color="#a31515" size="2"&gt;&amp;quot;/@my:Location&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;I get a &amp;quot;System.NullReferenceException: Object reference not set to an instance of an object.&amp;quot; so it doesn&amp;#39;t like that xpath.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;The actual full&amp;nbsp;xpath for the fields I am trying to query is &amp;quot;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting/my:PerActivity/my:Location&amp;quot; where PerActivity is the repeating table in my form I am trying to iterate through.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;I am thinking that maybe activity.Current.SelectChildren or .SelectDescendants is the correct way of what I&amp;#39;m trying to do but that just pulls another NodeIterator out rather than the data I need.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Accessing the fields of a repeating table through code</title><link>https://www.infopathdev.com:443/forums/thread/24828.aspx</link><pubDate>Fri, 30 Nov 2007 22:57:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24828</guid><dc:creator>anotherchrisberry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24828.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=24828</wfw:commentRss><description>&lt;p&gt;I&amp;#39;d guess the problem is that your xpath selects the attribute field. If dfs:Risk_Actions is your repeating field, don&amp;#39;t include &amp;quot;/@Situation&amp;quot; in your xpath; otherwise, the returned node set will contain the Situation attribute of the first node.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Accessing the fields of a repeating table through code</title><link>https://www.infopathdev.com:443/forums/thread/24781.aspx</link><pubDate>Thu, 29 Nov 2007 04:11:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24781</guid><dc:creator>itzzme</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24781.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=24781</wfw:commentRss><description>&lt;p&gt;sorry..I mis -typed the XPath in the post.&lt;/p&gt;
&lt;p&gt;The Xpath is &amp;quot;/dfs:myFields/dfs:dataFields/dfs:Risk_Actions/@Situation&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kindly help&lt;/p&gt;</description></item><item><title>Accessing the fields of a repeating table through code</title><link>https://www.infopathdev.com:443/forums/thread/24749.aspx</link><pubDate>Wed, 28 Nov 2007 13:41:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24749</guid><dc:creator>itzzme</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24749.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=24749</wfw:commentRss><description>&lt;p&gt;I have a repeating table which is bound to a SharePoint list.&lt;/p&gt;
&lt;p&gt;I need to access the loop through the records in the table through a code.(This action is required to be performed in a button_Click handler)&lt;/p&gt;
&lt;p&gt;The XPath of the repeating table field is&amp;nbsp; (&amp;quot;/dfs:myFields/dfsataFields/dfs:Risk_Actions/@Situation.&lt;/p&gt;
&lt;p&gt;The code i&amp;#39;m trying to use is &lt;/p&gt;
&lt;p&gt;&lt;em&gt;XPathNodeIterator actSituation = MainDataSource.CreateNavigator().Select(&amp;quot;/dfs:myFields/dfsataFields/dfs:Risk_Actions/@Situation&amp;quot;, NamespaceManager);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;while (actSituation.MoveNext())&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;{&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;}&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The control does not get into the while loop.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Kindly help!!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks&lt;/p&gt;</description></item></channel></rss>