<?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>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Query SharePoint list column and return calculated sum</title><link>https://www.infopathdev.com:443/forums/thread/95805.aspx</link><pubDate>Wed, 12 Feb 2014 04:27:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:95805</guid><dc:creator>RaYvA</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/95805.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=95805</wfw:commentRss><description>&lt;p&gt;Hi, Yes you can do this from a list form.&lt;/p&gt;
&lt;p&gt;If you have data connections to the list you can use count() and sum() functions to obtain the answer from the data&amp;nbsp;connection once you have queried it.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For example, after querying the &amp;#39;Commercial&amp;nbsp;Owners&amp;#39; data&amp;nbsp;connection this formula returns the count of the commercial owners:&amp;nbsp;&lt;br /&gt;&lt;strong&gt;count(xdXDocument:GetDOM(&amp;quot;Commercial Owners&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Commercial_x0020_Owner)&lt;br /&gt;&lt;/strong&gt;Another example, after querying the &amp;#39;Costs&amp;#39; data connection this formula returns the sum of the costs:&amp;nbsp;&lt;br /&gt;&lt;strong&gt;sum(xdXDocument:GetDOM(&amp;quot;Costs&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Amount)&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You can use these formulas in rules to update fields in your schema or you can use them in Calculated Values. Easier to use the &amp;#39;Edit Formula&amp;#39; (Fx) button to help you. You coulds then also filter the return based on other selected fields in on your form or explicit filters:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Example, after querying the &amp;#39;Costs&amp;#39; data connection this formula returns the sum of the costs ONLY for the &amp;#39;Commercial Owner&amp;#39; who&amp;#39;s values is &amp;#39;RaYvA&amp;#39;:&lt;br /&gt;&lt;strong&gt;sum(xdXDocument:GetDOM(&amp;quot;Costs&amp;quot;)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Amount[../d:Commercial_x0020_Owner = &amp;quot;RaYvA&amp;quot;]&lt;/strong&gt;)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Hope this helps?&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;</description></item><item><title>Query SharePoint list column and return calculated sum</title><link>https://www.infopathdev.com:443/forums/thread/95432.aspx</link><pubDate>Sat, 25 Jan 2014 20:51:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:95432</guid><dc:creator>BrynC</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/95432.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=95432</wfw:commentRss><description>&lt;p&gt;Hi there,&lt;/p&gt;&lt;p&gt;I submitted this post under general, and never got a response - hopefully I&amp;#39;m not breaking any &amp;quot;forum&amp;quot; rules by re-posting in the Data Connections section - any help someone can point me to is greatly appreciated!&lt;/p&gt;&lt;p&gt;I&amp;#39;m working on an InfoPath / SharePoint List solution for my team that enables &amp;quot;portfolio management&amp;quot; of our projects.&amp;nbsp;&amp;nbsp;I did not originally set up the list form to enable repeating fields, because I wanted the additional functionality in my form, and I also wanted to limit one-to-many entries to keep things as simple as possible.&amp;nbsp; Unfortunately, I think now I&amp;#39;m stuck - because my form isn&amp;#39;t enabled for repeating fields, I can&amp;#39;t seem to query the existing SharePoint list in the way I want to in order to return some data I&amp;#39;d like.&lt;/p&gt;&lt;p&gt;All&amp;nbsp;data from form submissions and updates&amp;nbsp;post to the same SP list, with views/perms set up in SP to hide &amp;quot;admin&amp;quot; fields from project managers.  The form also queries this SharePoint list, where needed, to allow folks to select existing list items as appropriate (example - &amp;quot;related&amp;quot; projects are available in a multi-select list box that queries all the active projects already submitted).  Where I&amp;#39;m stuck, though, is here:&lt;/p&gt;&lt;p&gt;I&amp;#39;m looking for a way to enable one of the admin forms to query the existing SP list and calculate all the project hours submitted (i.e. when an admin opens a newly-submitted project request form, the Total Project Hours field queries the existing SP list upon form load, adds up all the line items in the Project Hours SharePoint List Column, and returns a calculated total to the Total Project Hours form field so that admins can see how many project hours are currently being accounted for before approving and resourcing the newly submitted project).&amp;nbsp; Short and sweet example (the actual form has about 150 fields across 8 different form views as the workflow I&amp;#39;m trying to manage is quite extensive, but hopefully the below gives a sense of what I&amp;#39;m trying to accomplish):&amp;nbsp;&lt;/p&gt;&lt;p&gt;Project Managers submit the following in the request form:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Project Manager&amp;nbsp;| Project Name | Estimated Hours&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Anne Smith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;Anne&amp;#39;s Project&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40&lt;/p&gt;&lt;p&gt;Bob Jones&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bob&amp;#39;s Project&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/p&gt;&lt;p&gt;Ty Johnson&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Ty&amp;#39;s Project&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;After&amp;nbsp;posting to the list, an&amp;nbsp;Admin&amp;#39;s view would look something like this:&lt;/p&gt;&lt;p&gt;&lt;b&gt;Projects Submitted&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total Hours allotted&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#39;ve done this before using repeating tables in a form, but try as&amp;nbsp;I might I can&amp;#39;t figure out a&amp;nbsp;way to accomplish the same thing in a non-repeating list form.&amp;nbsp; Is there any&amp;nbsp;way to use a data connection to query a SharePoint list column, add up all the hours&amp;nbsp;associated to each line item, and calculate&amp;nbsp;and return a total back to the form (preferably a non-code solution, as I&amp;#39;m&amp;nbsp;trying to keep this as out-of-the-box as possible, though I&amp;#39;m willing to customize with code if that&amp;#39;s my only option)?&amp;nbsp; Anyone have any ideas?&amp;nbsp; I&amp;#39;ve searched on forums, how-to&amp;#39;s, etc. until my fingers are numb - seems like something that would be an obvious option, but either it&amp;#39;s so simple I&amp;#39;m completely missing it or it&amp;#39;s just not possible because I didn&amp;#39;t&amp;nbsp;set things up the right way.&amp;nbsp; &lt;/p&gt;&lt;p&gt;IF my only option is to use a form that allows repeating items/tables, is there any way to &amp;quot;convert&amp;quot; my list to do so without having to start over?&amp;nbsp; I&amp;#39;m happy to do that instead, if at all possible - but don&amp;#39;t want to have to&amp;nbsp;re-do the roughly 80 man-hours of work I&amp;#39;ve put into this solution over the last 3 months.&amp;nbsp; I&amp;#39;m also happy to provide additional context or details as needed - I appreciate&amp;nbsp;the time!&amp;nbsp; Thanks! - BrynC&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>