<?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: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31695.aspx</link><pubDate>Tue, 26 Aug 2008 07:33:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31695</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31695.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31695</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Here is the code you have to write in your onClick Event,&lt;/p&gt;
&lt;p&gt;IXMLDOMDocument2 sampleDataDom = (IXMLDOMDocument2)thisXDocument.CreateDOM();&lt;/p&gt;
&lt;p&gt;sampleDataDom.async = false;&lt;/p&gt;
&lt;p&gt;sampleDataDom.validateOnParse = false;&lt;/p&gt;
&lt;p&gt;sampleDataDom.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;namespace of your form&amp;quot;);&lt;/p&gt;
&lt;p&gt;sampleDataDom.load(&amp;quot;sampledata.xml&amp;quot;);&lt;/p&gt;
&lt;p&gt;IXMLDOMNode perActivityNodeFromSampledata = sampleDataDom.selectSingleNode(&amp;quot;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting/my:PerActivity&amp;quot;).cloneNode(true);&lt;/p&gt;
&lt;p&gt;IXMLDOMNode timeReportingNode = thisXDocument.DOM.selectSingleNode(&amp;quot;(&amp;quot;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting &amp;quot;);&lt;/p&gt;
&lt;p&gt;//Inserting the sample node at first position.&lt;/p&gt;
&lt;p&gt;timeReportingNode.parentNode.insertBefore(perActivityNodeFromSampledata, timeReportingNode);&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31664.aspx</link><pubDate>Mon, 25 Aug 2008 01:13:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31664</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31664.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31664</wfw:commentRss><description>&lt;p&gt;Well -- I&amp;#39;m afraid it took me quite a bit longer to get back to this, but so that it is posted somewhere, here is a sample that gets sampledata.xml using the 2007 object model:&lt;/p&gt;
&lt;blockquote&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;
&lt;p&gt;XPathDocument&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sampleData = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathDocument&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Template.OpenFileFromPackage(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;sampledata.xml&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;));&lt;br /&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; newGroup = sampleData.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myFields/my:topGroup/my:repeatingGroup&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Clone();&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;Note the OpenFileFromPackage method -- it took me a bit to find it, but I can already see it is going to be &lt;strong&gt;*very*&lt;/strong&gt; handy...&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;br /&gt;After I revisted this, I discovered that XPathDocument is read-only! So, if you clone from it, you&amp;#39;ll not be able to set values in your new group. Use this instead:&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 sampledata&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;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31443.aspx</link><pubDate>Wed, 13 Aug 2008 18:41:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31443</guid><dc:creator>zeroecho</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31443.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31443</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hilary sorted my problem out for those who may find themselves with a similar problem. e.Source.Clone() was what I was after for the entire row :)&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31400.aspx</link><pubDate>Tue, 12 Aug 2008 22:48:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31400</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31400.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31400</wfw:commentRss><description>&lt;p&gt;Hi, Catharine:&lt;/p&gt;
&lt;p&gt;I have not been able to run code using rules that changes the main DOM of the form -- which is what you&amp;#39;d be doing if you called that code from a rule. I know of one series of posts on this where they worked around it by changing a hidden field&amp;#39;s value in a rule and then putting the code in the Changed event for that field, which I thought was rather clever.&lt;/p&gt;
&lt;p&gt;Here is some sample code for getting info from the Sample.xml. I&amp;#39;m sorry -- it is in C# and uses the 2003 object model, but I don&amp;#39;t have time today to work up a 2007 sample -- if I get a chance tomorrow, I&amp;#39;ll post again. This may at least give you an idea, however:&lt;/p&gt;
&lt;blockquote&gt;&lt;font size="2"&gt;IXMLDOMDocument2 sampleData;&lt;br /&gt;&lt;font size="2"&gt;sampleData = (IXMLDOMDocument2)thisXDocument.CreateDOM();&lt;br /&gt;sampleData.async = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;;&lt;br /&gt;sampleData.validateOnParse = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;false;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;sampleData.setProperty(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;SelectionNamespaces&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;xmlns:xsi=\&amp;quot;http://www.w3.org/2001/XMLSchema-instance\&amp;quot; xmlns:dfs=\&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\&amp;quot;&amp;nbsp;xmlns:my=\&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-07-06T22:11:15\&amp;quot; xmlns:xd=\&amp;quot;http://schemas.microsoft.com/office/infopath/2003\&amp;quot;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;sampleData.load(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;sampledata.xml&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;
&lt;p&gt;IXMLDOMNode&amp;nbsp;newGroup = sampleData.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/my:myFields/my:Group1/my:Group2/my:Field1&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;).cloneNode(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;true&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;You&amp;#39;ll want to replace the namespaces in sampleData.setProperty with the ones from your sample.xml&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31399.aspx</link><pubDate>Tue, 12 Aug 2008 20:59:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31399</guid><dc:creator>Catharine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31399.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31399</wfw:commentRss><description>&lt;p&gt;Hi, Thank you for your reply...&lt;/p&gt;
&lt;p&gt;I have altered the code and it is now working.&amp;nbsp;&amp;nbsp;&amp;nbsp; Instead of running this code from a button I would like to be able to call it from rules as described&amp;nbsp;&amp;nbsp;in &lt;a href="http://blogs.msdn.com/infopath/archive/2005/06/17/430347.aspx"&gt;http://blogs.msdn.com/infopath/archive/2005/06/17/430347.aspx&lt;/a&gt;&amp;nbsp;- do you think this is feasible?&lt;/p&gt;
&lt;p&gt;You mentioned copying the from the Sample.xml&amp;nbsp; How do you do that ?&lt;/p&gt;
&lt;p&gt;Catharine&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31395.aspx</link><pubDate>Tue, 12 Aug 2008 19:24:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31395</guid><dc:creator>zeroecho</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31395.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31395</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi Hilary, &lt;/p&gt;&lt;p&gt;Thanks again for your reply.&lt;/p&gt;&lt;p&gt;I tried what you said, basically the button is the last row in a repeating table called PerActivity of which there contains a whole bunch of information. So then I press Copy I want the whole PerActivity repeating group to be copied.&lt;/p&gt;&lt;p&gt;When I try without the entire XPath and just put the group name &amp;quot;my:PerActivity&amp;quot; it fails saying &amp;quot;XpathNavigator newGroup = oldGroup.Clone()&amp;#39; Object reference not set to an instance of an object&amp;quot;&lt;/p&gt;&lt;p&gt;When I select any field from within PerActivity such as&amp;nbsp; &lt;/p&gt;&lt;p&gt;public void CTRL244_5_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; string xpath = 
&amp;quot;/myLocation&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 oldGroup = 
e.Source.SelectSingleNode(xpath,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; XPathNavigator 
newGroup = oldGroup.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; 
oldGroup.InsertBefore(newGroup);&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;I get&amp;nbsp; Object reference not set to an instance of an object&lt;/p&gt;&lt;p&gt;When I try a field from within PerActivity and have the full xpath I get &amp;quot;Schema validation found non-date type errors&amp;quot;&lt;/p&gt;&lt;p&gt;When I try&amp;nbsp; a group within PerActivity &amp;quot;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting/my:PerActivity/my:HoursPerDay&amp;quot; I get Object reference not set to an instance of an object (for both just /my:HoursPerDay and for the whole path)&lt;/p&gt;&lt;p&gt;When adding a button in a repeating row theres nothing particularly special you have to do do you?&lt;/p&gt;&lt;p&gt;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting/my:PerActivity/my:HoursPerDay/my:Mon is the full xpath of the lowest field in my schema where PerActivity and EmployeeInformation are the only repeating groups.&lt;/p&gt;&lt;p&gt;Frokm what you&amp;#39;ve said about redirecting back to the root and selecting from there it would seem that by doing e.Source(&amp;quot;/my:RepeatingTable&amp;quot;, NameSpaceManager) would do the trick, so either my button is being added/linked incorrectly or I&amp;#39;m getting the wrong end of the stick with the XPath query!&lt;/p&gt;&lt;p&gt;Thanks again for your help, feel like I&amp;#39;m almost there and just a syntax error holding me back I hope :D &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31385.aspx</link><pubDate>Tue, 12 Aug 2008 17:19:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31385</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31385.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31385</wfw:commentRss><description>&lt;p&gt;Hi, Catharine:&lt;/p&gt;
&lt;p&gt;I suspect your xpath in that line does not point to a valid node. Given your data structure, I would expect &amp;quot;my:Name1&amp;quot; for the first line and &amp;quot;my:Comment1&amp;quot; for the second.&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31384.aspx</link><pubDate>Tue, 12 Aug 2008 17:17:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31384</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31384.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31384</wfw:commentRss><description>&lt;p&gt;Hi, zeroecho:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problem is your XPath. You are redirecting back to the root and selecting from there (which gives you the first one....) Let&amp;#39;s say that your button is in a table connected to &amp;quot;my:TimeReporting&amp;quot;. You would want e.Source.SelectSingleNode(&amp;quot;my:PerActivity&amp;quot;, NamespaceManager). e.Source will get you the correct &amp;quot;my:TimeReporting&amp;quot; row that the button is in.&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31382.aspx</link><pubDate>Tue, 12 Aug 2008 17:08:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31382</guid><dc:creator>zeroecho</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31382.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31382</wfw:commentRss><description>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CTRL244_5_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; string xpath = &amp;quot;/my:TimesheetDetails/my:EmployeeInformation/my:TimeReporting/my:PerActivity&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 oldGroup = e.Source.SelectSingleNode(xpath,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; XPathNavigator newGroup = oldGroup.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; oldGroup.InsertBefore(newGroup);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;p&gt;PerActivity is a group containing multiple fields I am trying to copy depending on which row the user presses the &amp;quot;Copy&amp;quot; button on.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;When I use e.Source.SelectSingleNode and press the Copy&amp;nbsp; button, it simply copies the top node only. It doesn&amp;#39;t copy the current field. As far as I was aware, the Button wasn&amp;#39;t aware of any XML structure, as it&amp;#39;s just a button because that was the first thing I tried but it didn&amp;#39;t work.&lt;/p&gt;&lt;p&gt;Thanks for the help so far by the way. I&amp;#39;ve uploaded the last() version for the time being but am hoping I can figure this one out soon.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31379.aspx</link><pubDate>Tue, 12 Aug 2008 16:47:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31379</guid><dc:creator>dlocc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31379.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31379</wfw:commentRss><description>&lt;p&gt;Thanks, I actually would prefer to use VB as well.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I just tested the C# code in a new form and it DOES NOT change all the values in the field.&amp;nbsp; I&amp;#39;m clueless as to why my other form went whacko on me.&amp;nbsp; Anyways, thanks for all the input everyone! &lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31378.aspx</link><pubDate>Tue, 12 Aug 2008 16:44:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31378</guid><dc:creator>Catharine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31378.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31378</wfw:commentRss><description>&lt;p&gt;Hi I am following this code as well - but I only know VB (and that not very well)&lt;/p&gt;
&lt;p&gt;My Xml looks like this&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;my:History1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;my:Name1&amp;gt;&amp;lt;/my:Name1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;my:Comment1&amp;gt;&amp;lt;/my:Comment1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/my:History1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;my:text1&amp;gt;&amp;lt;/my:text1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;my:text2&amp;gt;&amp;lt;/my:text2&amp;gt;&lt;/p&gt;
&lt;p&gt;I have converted the code to VB&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;get values from a couple of fields&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; xpath &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/font&gt;&lt;font size="2"&gt; = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:text1&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; field1 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;xpath = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:text2&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; field2 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;clone last repeating table row&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;xpath = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:History1[last()]&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; oldGroup &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; newGroup &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = oldGroup.Clone()&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;insert the new group&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;oldGroup.InsertBefore(newGroup)&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;set the values of the fields&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;newGroup.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;name1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue(field1.Value)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;newGroup.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;comment1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue(field2.Value)&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;I am trying to debug and I get&lt;/p&gt;
&lt;p&gt;System.NullReferenceException was unhandled by user code&lt;br /&gt;&amp;nbsp; Message=&amp;quot;Object reference not set to an instance of an object.&amp;quot;&lt;br /&gt;&amp;nbsp; Source=&amp;quot;TestInsertRow&amp;quot;&lt;br /&gt;&amp;nbsp; StackTrace:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at TestInsertRow.FormCode.Insert_Clicked(Object sender, ClickedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)&lt;/p&gt;
&lt;p&gt;When I try the newGroup.SelectSingleNode(&lt;font color="#800000" size="2"&gt;&amp;quot;name1&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue(field1.Value) line.&amp;nbsp; What have I done wrong in my conversion ? &lt;/font&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31377.aspx</link><pubDate>Tue, 12 Aug 2008 16:42:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31377</guid><dc:creator>dlocc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31377.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31377</wfw:commentRss><description>&lt;p&gt;There&amp;#39;s no rules set,&amp;nbsp;&amp;nbsp;All the values for once column change.&amp;nbsp;&amp;nbsp; I have a drop down list field, a date box, and a button.&amp;nbsp; The date field works just fine, but the drop down list is changing all the values when the button clicks.&amp;nbsp; No idea why this is happening as the date column is working properly.&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31376.aspx</link><pubDate>Tue, 12 Aug 2008 16:34:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31376</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31376.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31376</wfw:commentRss><description>&lt;p&gt;Hey, zeroecho:&lt;/p&gt;
&lt;p&gt;If you have a button in a repeating table, it knows where it is -- look at &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.clickedeventargs_members.aspx"&gt;this&lt;/a&gt; on ClickedEventArgs memebers&amp;nbsp;at MSDN. So, instead of using MainDataSource.CreateNavigator(), you&amp;#39;d use:&lt;/p&gt;
&lt;blockquote&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;
&lt;p&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; field4 = e.Source.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;my:field4&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;br /&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;MessageBox&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Show(field4.Value);&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;to pop up the row&amp;#39;s field4 value in a message box, for demonstration purposes.&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31375.aspx</link><pubDate>Tue, 12 Aug 2008 16:26:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31375</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31375.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31375</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;All&lt;/strong&gt; the values for &lt;strong&gt;one&lt;/strong&gt; column change, but not&amp;nbsp;the other?&amp;nbsp;Do you have a rule set somewhere that may be running and setting all the values for that column?&lt;/p&gt;</description></item><item><title>Re: Add a field's value to a Repeating Table field programically.</title><link>https://www.infopathdev.com:443/forums/thread/31373.aspx</link><pubDate>Tue, 12 Aug 2008 15:42:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31373</guid><dc:creator>dlocc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31373.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31373</wfw:commentRss><description>&lt;p&gt;Hello Hilary,&lt;/p&gt;
&lt;p&gt;I used your code to clone the repeating table row:&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;//get values from a couple of fields&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; xpath = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:Actions&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; Actions = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);&lt;/p&gt;xpath = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:ActionDate&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ActionDate = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;//clone last repeating table row&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;xpath = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:myFields/my:group1/my:group2[last()]&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; oldGroup = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);&lt;/p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; newGroup = oldGroup.Clone();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;//insert the new group&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;oldGroup.InsertBefore(newGroup);&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;//set the values of the fields&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;newGroup.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;my:field1&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue(Actions.Value);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;newGroup.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;my:field2&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).SetValue(ActionDate.Value);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;But the code is still changing all of the&amp;nbsp;values for column 1...&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>