<?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>Controls</title><link>https://www.infopathdev.com:443/forums/43.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How to pre-populate a summed field in an Infopath repeating table</title><link>https://www.infopathdev.com:443/forums/thread/48168.aspx</link><pubDate>Thu, 22 Oct 2009 21:08:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:48168</guid><dc:creator>vcohen</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/48168.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=48168</wfw:commentRss><description>&lt;p&gt;That seems to do the trick -- thanks very much! You used an interesting technique in the formula for the default value in YearlyCost -- I&amp;#39;d never have thought to multiply it against the boolean value returned by testing if Remaining &amp;gt; 0.&lt;/p&gt;&lt;p&gt;Thanks again!&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: How to pre-populate a summed field in an Infopath repeating table</title><link>https://www.infopathdev.com:443/forums/thread/48142.aspx</link><pubDate>Thu, 22 Oct 2009 12:50:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:48142</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/48142.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=48142</wfw:commentRss><description>&lt;p&gt;Please inspect the attached XSN, which should be a simple mock-up of what you described, though all in one view.&amp;nbsp; The logic in this form is contained in:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The rule on the CurrentFYSpend field&lt;/li&gt;&lt;li&gt;The default values on YearlyCost, RunningTotal, and Remaining (Note that the &amp;quot;Recalculate this value&amp;quot; box is unchecked for YearlyCost)&lt;/li&gt;&lt;/ul&gt;</description></item><item><title>How to pre-populate a summed field in an Infopath repeating table</title><link>https://www.infopathdev.com:443/forums/thread/48011.aspx</link><pubDate>Tue, 20 Oct 2009 00:37:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:48011</guid><dc:creator>vcohen</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/48011.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=48011</wfw:commentRss><description>&lt;p&gt;I posted this question on StackOverflow at &lt;a href="http://stackoverflow.com/questions/1590703/how-to-pre-populate-a-summed-field-in-an-infopath-repeating-table"&gt;http://stackoverflow.com/questions/1590703/how-to-pre-populate-a-summed-field-in-an-infopath-repeating-table&lt;/a&gt; , but haven&amp;#39;t received any responses; apparently not many InfoPath experts hang out there. Then I found this forum; hopefully someone here can weigh in (or go over to StackOverflow; the InfoPath tag could use some love).&lt;/p&gt;

&lt;p&gt;I have an Infopath 2007 form with several views, meant to be used in a browser. I&amp;#39;m having trouble pre-populating a field in a repeating table, starting with a given value and then using a formula-derived default value.&lt;br /&gt;
&lt;br /&gt;
On the &lt;code&gt;Summary&lt;/code&gt; view, I ask for a project&amp;#39;s &lt;code&gt;TotalCost&lt;/code&gt; and the current fiscal year&amp;#39;s projected spending (`CurrentFYSpend`):
&lt;br /&gt;

&lt;/p&gt;
&lt;pre&gt;+------------------------------+&lt;br /&gt;|  Project Summary             |&lt;br /&gt;+------------------------------+&lt;br /&gt;|  Total Cost:       $100,000  |  -- TotalCost&lt;br /&gt;|  Current FY Spend: $ 25,000  |  -- CurrentFYSpend&lt;br /&gt;+------------------------------+&lt;/pre&gt;
On the next (&lt;code&gt;Detail&lt;/code&gt;) view, I have a repeating table &lt;code&gt;FYSpending&lt;/code&gt; where the user needs to break out the project&amp;#39;s  &lt;code&gt;TotalCost&lt;/code&gt; over an arbitrary number of fiscal years. The &lt;code&gt;FYSpending&lt;/code&gt; table has a &lt;code&gt;YearlyCost&lt;/code&gt; field which holds that year&amp;#39;s estimated spending. Under the repeating table I have &lt;code&gt;RunningTotal&lt;/code&gt; and &lt;code&gt;Remaining&lt;/code&gt; fields. &lt;code&gt;RunningTotal&lt;/code&gt; has a Default Value of &lt;code&gt;sum(YearlyCost)&lt;/code&gt;; &lt;code&gt;Remaining&lt;/code&gt; has a Default Value of &lt;code&gt;TotalCost - sum(YearlyCost)&lt;/code&gt; ; together they show the user how much of the total has already been accounted for, and how much they still need to break out into a Fiscal Year row.&lt;br /&gt;
&lt;br /&gt;
When we first enter the &lt;code&gt;Detail&lt;/code&gt; view, the &lt;code&gt;YearlyCost&lt;/code&gt; field of the first row of the &lt;code&gt;FYSpending&lt;/code&gt; repeating table should be populated with the &lt;code&gt;CurrentFYSpend&lt;/code&gt; value:&lt;br /&gt;
&lt;pre&gt;+--------------------------------+&lt;br /&gt;|  Project Detail                |&lt;br /&gt;+--------------------------------+&lt;br /&gt;|  Total Cost:        $100,000   |  &amp;lt;- TotalCost&lt;br /&gt;|                                |&lt;br /&gt;|  Fiscal Year Spending:         |&lt;br /&gt;|  +---------------------------+ |  &amp;lt;- FYSpending repeating table&lt;br /&gt;|  |  FY  |        Yearly Cost | &lt;br /&gt;|  +---------------------------+ |  &amp;lt;- FYSpending repeating table&lt;br /&gt;|  | 2009 |           $ 25,000 | |  &amp;lt;- YearlyCost[1], from Summary CurrentFYSpend&lt;br /&gt;|  +---------------------------+ |&lt;br /&gt;|  | Add Fiscal Year |           |&lt;br /&gt;|  +-----------------+           |&lt;br /&gt;|                                |&lt;br /&gt;|  Running Total:     $ 25,000   |&lt;br /&gt;|  Remaining:         $ 75,000   |  &amp;lt;- TotalCost - sum(YearlyCost)&lt;br /&gt;+--------------------------------+&lt;/pre&gt;When the user adds a new Fiscal Year row, I want the default value of the new row&amp;#39;s &lt;code&gt;YearlyCost&lt;/code&gt; field to be calculated as the remaining amount: &lt;code&gt;YearlyCost[n] = TotalCost - sum(YearlyCost)&lt;/code&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;+--------------------------------+&lt;br /&gt;|  Project Detail                |&lt;br /&gt;+--------------------------------+&lt;br /&gt;|  Total Cost:        $100,000   |&lt;br /&gt;|                                |&lt;br /&gt;|  Fiscal Year Spending:         |&lt;br /&gt;|  +---------------------------+ | &lt;br /&gt;|  |  FY  |        Yearly Cost | |&lt;br /&gt;|  +---------------------------+ |&lt;br /&gt;|  | 2009 |           $ 25,000 | |&lt;br /&gt;|  | 2010 |           $ 50,000 | |  -- YearlyCost[2], calc&amp;#39;d by rule on Add Row  &lt;br /&gt;|  +---------------------------+ |&lt;br /&gt;|  | Add Fiscal Year |           |&lt;br /&gt;|  +-----------------+           |&lt;br /&gt;|                                |&lt;br /&gt;|  Running Total:     $ 75,000   |&lt;br /&gt;|  Remaining:         $ 25,000   |&lt;br /&gt;+--------------------------------+&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;

I&amp;#39;m having trouble because the two pre-populating actions conflict with one another and appear to be creating a race condition. I tried to set a Rule on the &lt;code&gt;Summary&lt;/code&gt;&amp;#39;s &lt;code&gt;CurrentFYSpend&lt;/code&gt; field to set the value of &lt;code&gt;FYSpending&lt;/code&gt;&amp;#39;s &lt;code&gt;YearlyCost&lt;/code&gt;, then set a Default Value on the &lt;code&gt;YearlyCost&lt;/code&gt; field to set &lt;code&gt;Value: TotalCost - sum(YearlyCost)&lt;/code&gt;. When I save the form, I get the following error:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;An error occurred in the form&amp;#39;s code. The number of calls to the Changed  event for a single update in the data exceeded the maximum limit.&lt;/blockquote&gt;
&lt;br /&gt;
(Thanks, InfoPath, for such specific error message! How much do I need to pay to get the name of the object that fired the event, or that you tried to update?)&lt;br /&gt;
&lt;br /&gt;
Anyway, can anyone describe a technique for accomplishing this? In summary, &lt;br /&gt;
&lt;br /&gt;
 1. populate first row&amp;#39;s &lt;code&gt;YearlyCost&lt;/code&gt; from the previous view&amp;#39;s &lt;code&gt;CurrentFYSpend&lt;/code&gt;&lt;br /&gt;
 2. allow overriding the first row&amp;#39;s &lt;code&gt;YearlyCost&lt;/code&gt;, and populate subsequently-added rows&amp;#39; &lt;code&gt;YearlyCost&lt;/code&gt; default value to &lt;code&gt;TotalCost - sum(YearlyCost)&lt;/code&gt; &lt;br /&gt;
&lt;br /&gt;
Many thanks!</description></item></channel></rss>