<?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: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63161.aspx</link><pubDate>Thu, 13 Jan 2011 21:35:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63161</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63161.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63161</wfw:commentRss><description>&lt;p&gt;Here is another example where I use very similar code... it&amp;nbsp;works for the first row in a repeating table, but then not after that.&amp;nbsp; It takes a hostname as input and does an nslookup for the IP by calling a function I found online &amp;quot;DNSLookup()&amp;quot;.&amp;nbsp; I&amp;#39;m still assuming that my issue is with how I am declaring/calling the [in this case the last] row of the repeating table.&amp;nbsp; Thanks again for the help!&lt;/p&gt;
&lt;p&gt;Sub msoxd_my_srcname_OnAfterChange(eventObj)&lt;/p&gt;
&lt;p&gt;&amp;#39; Write code here to restore the global state.&lt;/p&gt;
&lt;p&gt;dim test&lt;br /&gt;dim hostname &lt;br /&gt;dim oLastRow&lt;br /&gt;Set oLastRow = XDocument.DOM.selectSingleNode(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup[last()]&amp;quot;)&lt;br /&gt;hostname = oLastRow.selectSingleNode(&amp;quot;//my:srcname&amp;quot;).Text&lt;br /&gt;test = DNSLookup(hostname)&lt;br /&gt;oLastRow.selectSingleNode(&amp;quot;//my:addsrc&amp;quot;).Text = test&lt;br /&gt;If eventObj.IsUndoRedo Then&lt;br /&gt;&amp;nbsp;&amp;#39; An undo or redo operation has occurred and the DOM is read-only.&lt;br /&gt;&amp;nbsp;Exit Sub&lt;br /&gt;End If&lt;/p&gt;
&lt;p&gt;&amp;#39; A field change has occurred and the DOM is writable. Write code here to respond to the changes.&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63130.aspx</link><pubDate>Thu, 13 Jan 2011 16:16:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63130</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63130.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63130</wfw:commentRss><description>&lt;p&gt;Thanks!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;OK, so this stopped throwing the &amp;quot;Object Required&amp;quot; error, but it still doesn&amp;#39;t iterate through the rows in the table... it just reads the first row over and over...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I&amp;#39;ve also tried clearing the variables for src and srcaddr inside the loop (i.e. src = &amp;quot;&amp;quot;)&lt;/p&gt;
&lt;p&gt;I also noticed that my loop is for some reason skipping a=2.... it just jumps from a=1 to a=3... any thoughts on that?&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63127.aspx</link><pubDate>Thu, 13 Jan 2011 15:55:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63127</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63127.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63127</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;a&lt;/strong&gt; is a variable in your code, but selectSinbleNode() has no idea what &lt;strong&gt;a&lt;/strong&gt;&amp;nbsp;is.&amp;nbsp; If you want to use &lt;strong&gt;a&lt;/strong&gt; in your XPath, you have to concatenate it in:&lt;/p&gt;
&lt;p&gt;Set oLastRow = XDocument.DOM.selectSingleNode(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup/my:addruletable[&amp;quot; &amp;amp; a &amp;amp; &amp;quot;]&amp;quot;)&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63126.aspx</link><pubDate>Thu, 13 Jan 2011 15:37:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63126</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63126.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63126</wfw:commentRss><description>&lt;p&gt;and I changed the assignment of a to &amp;quot;a=1&amp;quot;...&lt;/p&gt;
&lt;p&gt;thanks for catching that, and your help!&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63124.aspx</link><pubDate>Thu, 13 Jan 2011 15:35:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63124</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63124.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63124</wfw:commentRss><description>&lt;p&gt;OK, gave your suggestion a try.&amp;nbsp; It yields a new error:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Object required: &amp;#39;oLastRow&amp;#39;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the code...&lt;/p&gt;
&lt;p&gt;for a = 1 to b+1&lt;br /&gt;&amp;nbsp;Dim oLastRow&lt;br /&gt;&amp;nbsp;Set oLastRow = XDocument.DOM.selectSingleNode(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup/my:addruletable[a]&amp;quot;)&lt;br /&gt;&amp;nbsp;src = oLastRow.selectSingleNode(&amp;quot;//my:srcname&amp;quot;).Text&lt;br /&gt;&amp;nbsp;srcaddr = oLastRow.selectSingleNode(&amp;quot;//my:addsrc&amp;quot;).Text&lt;br /&gt;&amp;nbsp;rowdata = src &amp;amp; &amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot; &amp;amp; srcaddr&amp;nbsp; &amp;amp; vbcrlf&lt;br /&gt;&amp;nbsp;psbody = psbody &amp;amp; rowdata&lt;br /&gt;&amp;nbsp;&amp;#39;msgbox(rowdata)&lt;br /&gt;&amp;nbsp;a = a + 1&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63099.aspx</link><pubDate>Wed, 12 Jan 2011 21:55:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63099</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63099.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63099</wfw:commentRss><description>&lt;p&gt;Set oLastRow = XDocument.DOM.selectNodes(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup/my:addruletable[a]&amp;quot;) &lt;/p&gt;&lt;p&gt;is selecting a set of nodes.&lt;/p&gt;&lt;p&gt;Perhaps this:&lt;/p&gt;&lt;p&gt;Set oLastRow = XDocument.DOM.selectSingleNode(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup/my:addruletable[a]&amp;quot;) &lt;/p&gt;&lt;p&gt;would work better, then follow Potemkine&amp;#39;s suggestion&amp;nbsp;-- although I&amp;#39;m perplexed where you are setting a = 0, then saying:&lt;/p&gt;&lt;p&gt;for a = 1 to b+1 &lt;/p&gt;&lt;p&gt;You&amp;#39;d never enter your for loop, would you?&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63098.aspx</link><pubDate>Wed, 12 Jan 2011 21:14:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63098</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63098.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63098</wfw:commentRss><description>&lt;p&gt;This is the error..&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Object doesn&amp;#39;t support this property or method: &amp;#39;oLastRow.selectSingleNode&amp;#39;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63095.aspx</link><pubDate>Wed, 12 Jan 2011 20:01:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63095</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63095.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63095</wfw:commentRss><description>&lt;p&gt;I actually tried that too, but I&amp;#39;m getting an error saying that &amp;quot;the&amp;nbsp;object is not available&amp;quot; or something like that..&lt;/p&gt;</description></item><item><title>Re: Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63094.aspx</link><pubDate>Wed, 12 Jan 2011 19:49:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63094</guid><dc:creator>Potemkine</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63094.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63094</wfw:commentRss><description>&lt;p&gt;Hi,&amp;nbsp;I think you have to replace XDocument.DOM for&amp;nbsp;oLastRow on your loop.&amp;nbsp; 
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt; 
&lt;p&gt;Set oLastRow = XDocument.DOM.selectNodes(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup/my:addruletable[a]&amp;quot;) &lt;/p&gt;
&lt;p&gt;src = oLastRow .selectSingleNode(&amp;quot;//my:srcname&amp;quot;).Text &lt;/p&gt;
&lt;p&gt;srcaddr = oLastRow .selectSingleNode(&amp;quot;//my:addsrc&amp;quot;).Text&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>Reading values of a repeating table and writing them to a string value...</title><link>https://www.infopathdev.com:443/forums/thread/63093.aspx</link><pubDate>Wed, 12 Jan 2011 18:24:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63093</guid><dc:creator>sheist</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63093.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63093</wfw:commentRss><description>&lt;p&gt;I am trying to use vbscript to generate an email based on the data collected from a form.&amp;nbsp; This email is text only and needs to read the information from a repeating table popluated by a user (hostname and IP address).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been able to figure out how to read the first row... but the for loop I thought would work doesn&amp;#39;t increment for me.&amp;nbsp; I&amp;#39;m a noob to both infopath and vbscript, so I&amp;#39;m hoping someone can help me out....&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the code:&lt;/p&gt;
&lt;p&gt;Dim oLastRow &lt;/p&gt;
&lt;p&gt;dim a &lt;/p&gt;
&lt;p&gt;a = 0 &lt;/p&gt;
&lt;p&gt;dim b &lt;/p&gt;
&lt;p&gt;b = XDocument.DOM.selectSingleNode(&amp;quot;//my:countrules&amp;quot;).Text&amp;nbsp; &amp;#39;hidden field to get the number of rows in the table&lt;/p&gt;
&lt;p&gt;for a = 1 to b+1 &lt;/p&gt;
&lt;p&gt;Set oLastRow = XDocument.DOM.selectNodes(&amp;quot;//my:myFields/my:Addrulegroup/my:addrulegroup/my:addruletable[a]&amp;quot;) &lt;/p&gt;
&lt;p&gt;src = XDocument.DOM.selectSingleNode(&amp;quot;//my:srcname&amp;quot;).Text &lt;/p&gt;
&lt;p&gt;srcaddr = XDocument.DOM.selectSingleNode(&amp;quot;//my:addsrc&amp;quot;).Text&amp;nbsp;&lt;/p&gt;
&lt;p&gt;rowdata = src &amp;amp; &amp;quot; &amp;quot; &amp;amp; srcaddr &amp;amp; vbcrlf &lt;/p&gt;
&lt;p&gt;psbody = psbody &amp;amp; rowdata&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;appends the row to the body of the email&lt;/p&gt;
&lt;p&gt;a = a + 1 &amp;#39;increments my counter (a)&lt;/p&gt;
&lt;p&gt;next&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maybe someone knows a better way... thanks in advance for the help.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>