I have a Infopath Form with Code base.
While deleting a repeating section, it gives the error.
In the logs, I got the error below:
There was a form postback error. (User: Form Name: IP: , Request: Form ID: urn:schemas-microsoft-com:office:infopath:CLW-Optimization-6:-myXSD-2011-04-13T13-18-14, Type: XPathException, Exception Message: Function 'xdMath:Avg()' has failed. Unable to cast object of type 'Microsoft.Office.InfoPath.Server.Xml.XPath.InfoPathXmlElement' to type 'System.Xml.XmlDocument'.) edebf1c8-a1a3-4369-a8a8-573ed5a3b61c
I am using the Infopath fields and the calculated values as a column in the repeating table, which is having the formula:
((avg(WkndFnlAmb) * AmbPer) + (avg(WkndFnlFrzn) * FrznPer) + (avg(WkndFnlBatFrzn) * BatFrznPer) + (avg(WkndFnlCombo) * ComboPer) + (avg(WkndFnlCld) * CoolPer))
When I am deleting the other repeating section, it will cause these values WkndFnlAmb, WkndFnlFrzn etc to be null which cause these 'xdMath:Avg() functions to get failed and cause the error.
Please let em know how can I handle these exception by rules so that these Avg Functions did not throw any exception.