<?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: LAST()</title><link>https://www.infopathdev.com:443/forums/thread/50732.aspx</link><pubDate>Tue, 19 Jan 2010 13:31:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50732</guid><dc:creator>Qazi Anis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50732.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=50732</wfw:commentRss><description>&lt;p&gt;default values are set once a field is created so when you say default value to be riskstbl[last()]. infopath&amp;nbsp;refers to the last row(i.e. the one you just created)&lt;/p&gt;</description></item><item><title>Re: LAST()</title><link>https://www.infopathdev.com:443/forums/thread/50731.aspx</link><pubDate>Tue, 19 Jan 2010 13:25:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50731</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50731.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=50731</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Could it be that you don&amp;#39;t have the &amp;quot;Update this field when the value changes&amp;quot; box checked?&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: LAST()</title><link>https://www.infopathdev.com:443/forums/thread/50730.aspx</link><pubDate>Tue, 19 Jan 2010 13:05:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50730</guid><dc:creator>juliecal73</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50730.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=50730</wfw:commentRss><description>&lt;p&gt;Thanks for the reply Jimmy, that made sense.&lt;/p&gt;
&lt;p&gt;Following that then, I used the expression: &lt;font size="3"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;RisksTbl[last()]/ProjectName which was accepted no problem. However, if I set the field default value to this, and insert a new line, the value is not defaulted to the last value... Would this be because the new node is already created, so Last would be looking at empty values? I tried to use last() - 1, but that gave a blank.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: LAST()</title><link>https://www.infopathdev.com:443/forums/thread/50728.aspx</link><pubDate>Tue, 19 Jan 2010 12:07:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50728</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50728.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=50728</wfw:commentRss><description>&lt;p&gt;In essence, last() evaluates to the number of nodes that match a certain XPath pattern, up to the point where last() appears, so if I had this XML:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;lt;animals&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cat&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;Felix&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/cat&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dog&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;Fido&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dog&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;cat&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;Paws&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/cat&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dog&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;Fido&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dog&amp;gt;&lt;br /&gt;&amp;lt;/animals&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;In the expression&lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;/animals/cat[last()]/name&lt;/blockquote&gt;&lt;p&gt;last() would evaluate to &lt;b&gt;2&lt;/b&gt; (because there are two nodes that match the pattern /animals/cat), and the XPath above would select the &amp;lt;name&amp;gt; node with the value &lt;b&gt;Paws&lt;/b&gt;.&lt;/p&gt;&lt;p&gt;For this reason, &lt;b&gt;.[last()]&lt;/b&gt; doesn&amp;#39;t make a lot of sense, because &lt;b&gt;.&lt;/b&gt; is always the current node, and only the current node.&lt;/p&gt;&lt;p&gt;If you want to select the last sibling of a certain node, try going one step up the tree and back down again:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;../my:&lt;i&gt;&lt;u&gt;&lt;b&gt;nodeName&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;[last()]&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;or using the following-sibling axis:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;following-sibling::my:&lt;i&gt;&lt;u&gt;&lt;b&gt;nodeName&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;[last()] &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>LAST()</title><link>https://www.infopathdev.com:443/forums/thread/50724.aspx</link><pubDate>Tue, 19 Jan 2010 11:10:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:50724</guid><dc:creator>juliecal73</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/50724.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=50724</wfw:commentRss><description>&lt;p&gt;Hi, this is a very very noob question, but I cannot seem to find anything at all on just the basics of using the last() function through Default Value and Rules.&lt;/p&gt;
&lt;p&gt;I have a repeating table, and my first field is ProjectName. When I insert a new line, I would like to default ProjectName in the new line to the same value in the above line. I am not using any coding on my form, so just though f(x). I am able to put &lt;u&gt;OtherField[last()]&lt;/u&gt; which is accepted, but if I am using the current field, it defaults to &amp;#39;.&amp;#39; and &lt;u&gt;.[last()]&lt;/u&gt; is not accepted.&lt;/p&gt;
&lt;p&gt;This is very frustrating, please help.&lt;/p&gt;
&lt;p&gt;J&lt;/p&gt;</description></item></channel></rss>