<?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>Function 'xdMath:Avg()' has failed in Infopath 2010 with SharePoint 2010</title><link>https://www.infopathdev.com:443/forums/thread/84847.aspx</link><pubDate>Wed, 28 Nov 2012 18:21:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:84847</guid><dc:creator>Shaif G</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/84847.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=84847</wfw:commentRss><description>&lt;div class="body"&gt;
&lt;p&gt;I have a Infopath Form with Code base. &lt;/p&gt;
&lt;p&gt;While deleting a repeating section, it gives the error.&lt;/p&gt;
&lt;p&gt;In the logs, I got the error below: &lt;/p&gt;
&lt;p&gt;There was a form postback error. (User:&amp;nbsp; Form Name:&amp;nbsp; IP: , Request:&amp;nbsp; Form ID: urn:schemas-microsoft-com:office:infopath:CLW-Optimization-6:-myXSD-2011-04-13T13-18-14, Type: XPathException, Exception Message: Function &amp;#39;xdMath:Avg()&amp;#39; has failed. Unable to cast object of type &amp;#39;Microsoft.Office.InfoPath.Server.Xml.XPath.InfoPathXmlElement&amp;#39; to type &amp;#39;System.Xml.XmlDocument&amp;#39;.)&amp;nbsp;edebf1c8-a1a3-4369-a8a8-573ed5a3b61c&lt;/p&gt;
&lt;p&gt;I am using the Infopath fields and the calculated values as a&amp;nbsp;column&amp;nbsp;in the repeating table, which is having the formula:&lt;/p&gt;
&lt;p&gt;((avg(WkndFnlAmb) * AmbPer) + (avg(WkndFnlFrzn) * FrznPer) + (avg(WkndFnlBatFrzn) * BatFrznPer) + (avg(WkndFnlCombo) * ComboPer) + (avg(WkndFnlCld) * CoolPer))&lt;/p&gt;
&lt;p&gt;When I am deleting the other repeating section, it will cause these values WkndFnlAmb, WkndFnlFrzn etc to be null which cause these &amp;#39;xdMath:Avg() functions to get failed and cause the error.&lt;/p&gt;
&lt;p&gt;Please let em know how can I handle these exception by rules so that these Avg Functions did not throw any exception.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Shaif&lt;/p&gt;&lt;/div&gt;</description></item></channel></rss>