<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>using sum with xpath returns 0 when I know there are records</title><link>https://www.infopathdev.com:443/forums/thread/94590.aspx</link><pubDate>Tue, 03 Dec 2013 00:20:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:94590</guid><dc:creator>lrhone</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/94590.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=94590</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have two sharepoint lists&lt;/p&gt;&lt;p&gt;1. Automation - this list has a whole bunch of fields, but the main ones involved in my issue now are: ID, Title, totalScore&lt;/p&gt;&lt;p&gt;2. Automation-Score - this list has a bunch of fields, but the main ones involved in my issue are: ID, AutomationID (number field), user, score (number field)&lt;/p&gt;&lt;p&gt;I am working on the form for the Automation list. I have a secondary data connection to Automation-Score. I have added Automation-Score fields into the Automation InfoPath form as a repeating table, and I&amp;#39;d like to sum all of the scores up in the footer row, into the field totalScore. I need to only show Automation-Score lines where AutomationID = ID from the Automation list item&lt;/p&gt;&lt;p&gt;I managed to filter out the lines where automationid &amp;lt;&amp;gt; the ID in the automation list by using rules, but the sum still shows the sum of all records in the list, regardless of automation ID, so I got buried in the fabulous world of xpath.&lt;/p&gt;&lt;p&gt;I am using Automation item #59 as my test item, so I put 3 items in the automation-score list and set their AutomationID to 59. The rule to hide the non-59 ones works beautifully. However, I can&amp;#39;t seem to get my xpath formula to play nice!&lt;/p&gt;&lt;p&gt;Here are some of the formula&amp;#39;s I&amp;#39;ve tried in order to get the correct total to be calculated for totalScore&lt;/p&gt;&lt;p&gt;1. sum(xdXDocument:GetDOM(&amp;quot;Automation-Score&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:ID = /dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:ID]/d:Score) -&amp;gt; This always returns 0&lt;/p&gt;&lt;p&gt;2. sum(xdXDocument:GetDOM(&amp;quot;Automation-Score&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:ID = &amp;quot;59&amp;quot;]/d:Score) -&amp;gt; This returns the correct total for item #59, but obviously won&amp;#39;t work for the rest&lt;/p&gt;&lt;p&gt;3. sum(xdXDocument:GetDOM(&amp;quot;Automation-Score&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[number(d:ID)= number(/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:ID)]/d:Score) -&amp;gt; This always returns 0&lt;/p&gt;&lt;p&gt;4. sum(xdXDocument:GetDOM(&amp;quot;Automation-Score&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Score) -&amp;gt; returns the total for all items in Automation-Score (thought I might get lucky with my rules on the table. Sadly, no)&lt;/p&gt;&lt;p&gt;5. /dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:ID]/d:Score -&amp;gt; returns the number of the current Automation Item (as expected, more just wanted to check that piece of my formula)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any idea what I&amp;#39;m doing wrong?&lt;/p&gt;</description></item></channel></rss>