<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/81873.aspx</link><pubDate>Wed, 22 Aug 2012 14:46:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81873</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81873.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81873</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t generally advocate using code when you don&amp;#39;t understand how it works, but this thread has a completely codeless square root implementation.&amp;nbsp; Once it finishes, you can copy the Result value to Field1, and Result * 3 to Field2.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.infopathdev.com/forums/p/21041/72904.aspx#72904"&gt;http://www.infopathdev.com/forums/p/21041/72904.aspx#72904&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/81866.aspx</link><pubDate>Wed, 22 Aug 2012 12:18:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:81866</guid><dc:creator>Fidzl</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/81866.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=81866</wfw:commentRss><description>&lt;p&gt;Hello there,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;i still have a problem with this sqrt-stuff.&lt;/p&gt;
&lt;p&gt;i used the posted code and it works, but not totally how i needed ist. with this code, both fields have the data-type text(string). i would like to keep on working with the squareroots.&lt;/p&gt;
&lt;p&gt;For example Field1 = sqrt of x and Field2 = Field1 * 3&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Is this possible to realize?&lt;/p&gt;
&lt;p&gt;Thank you very much!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14678.aspx</link><pubDate>Fri, 07 Jul 2006 18:24:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14678</guid><dc:creator>slcuster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14678.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14678</wfw:commentRss><description>Thank you so much!!!</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14677.aspx</link><pubDate>Fri, 07 Jul 2006 16:08:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14677</guid><dc:creator>skaaal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14677.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14677</wfw:commentRss><description>Here it is:&lt;br /&gt;&lt;br /&gt;function msoxd_my_&amp;lt;yourFieldName&amp;gt;::OnAfterChange(eventObj)&lt;br /&gt;{&lt;br /&gt;// some Infopath-generated comment&lt;br /&gt;&lt;br /&gt;if (eventObj.IsUndoRedo)&lt;br /&gt;{&lt;br /&gt;    // some Infopath-generated comment&lt;br /&gt;    return;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// some Infopath-generated comment&lt;br /&gt;&lt;br /&gt;// **** CODE STARTS HERE ****&lt;br /&gt;var varNodo = XDocument.DOM.selectSingleNode("//my:&amp;lt;yourfieldname&amp;gt;").text;&lt;br /&gt;if (varNodo != "")&lt;br /&gt;{&lt;br /&gt;   XDocument.DOM.selectSingleNode("//my:Sqrt&amp;lt;yourfieldname&amp;gt;").text =   Math.sqrt(varNodo);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;XDocument.DOM.selectSingleNode("//my:Sqrt&amp;lt;yourfieldname&amp;gt;").text = "";&lt;br /&gt;}&lt;br /&gt;// **** CODE ENDS HERE ****&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;_________________&lt;br /&gt;</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14676.aspx</link><pubDate>Thu, 06 Jul 2006 13:07:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14676</guid><dc:creator>slcuster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14676.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14676</wfw:commentRss><description>This looks great, but can anyone translate this to English for me?  Thanks.</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14675.aspx</link><pubDate>Thu, 06 Jul 2006 12:36:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14675</guid><dc:creator>skaaal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14675.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14675</wfw:commentRss><description>XdMath has no sqrt support but Javascript does, so I use the following workaround:&lt;br /&gt;- create a new field called "sqrt&amp;lt;originalfield&amp;gt;" as double.&lt;br /&gt;- on the validation rules for the original field, click to add an OnAfterChange event&lt;br /&gt;- add the final part of the code below to your script ; this JS code will populate the sqrt field with the square root value.&lt;br /&gt;- use the sqrt&amp;lt;originalfield&amp;gt; in your computations.&lt;br /&gt;&lt;br /&gt;I hope it helps,&lt;br /&gt;Pascal.&lt;br /&gt;&lt;br /&gt;------------&lt;br /&gt;&lt;br /&gt;function msoxd_my_PortataVentilatore::OnAfterChange(eventObj)&lt;br /&gt;{&lt;br /&gt;// Codice per il ripristino dello stato globale.&lt;br /&gt;&lt;br /&gt;	if (eventObj.IsUndoRedo)&lt;br /&gt;		{&lt;br /&gt;			// È stata eseguita un'operazione Annulla o Ripeti e il modello DOM è in sola lettura.&lt;br /&gt;			return;&lt;br /&gt;		}&lt;br /&gt;&lt;br /&gt;// Un campo è stato modificato e il modello DOM è in scrittura. Inserire il codice di risposta per le modifiche.&lt;br /&gt;	var varNodo = XDocument.DOM.selectSingleNode("//my:PortataVentilatore").text;&lt;br /&gt;	if (varNodo != "")&lt;br /&gt;	{	&lt;br /&gt;		XDocument.DOM.selectSingleNode("//my:SqrtPortataVentilatore").text = Math.round(Math.sqrt(varNodo));&lt;br /&gt;	}&lt;br /&gt;	else&lt;br /&gt;	{	&lt;br /&gt;		XDocument.DOM.selectSingleNode("//my:SqrtPortataVentilatore").text = "";&lt;br /&gt;	}	&lt;br /&gt;}&lt;br /&gt;</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14674.aspx</link><pubDate>Thu, 22 Jun 2006 13:54:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14674</guid><dc:creator>slcuster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14674.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14674</wfw:commentRss><description>Okay, one problem I forgot to mention.  If I were having the user fill out this form in Infopath, I'd add a button and put the square root code behind it.  However, my company has developed an app which the customer uses to populate my Infopath form.  Instead of the app calculating the square root of various fields, then putting the values on my form, I'd like to have Infopath do all the calculations.  Is there any way to use this code to have Infopath calculate the square root of fields on my form?  Thanks.</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14673.aspx</link><pubDate>Wed, 21 Jun 2006 12:08:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14673</guid><dc:creator>slcuster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14673.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14673</wfw:commentRss><description>That's exactly what I need.  Thanks!</description></item><item><title>Re: Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/14672.aspx</link><pubDate>Wed, 21 Jun 2006 07:12:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14672</guid><dc:creator>madhuri</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14672.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14672</wfw:commentRss><description>Hi&lt;br /&gt;Check out this link. I hope this will help.&lt;br /&gt;&lt;br /&lt;a target="_blank" href=http://msdn2.microsoft.com/en-us/library/system.math.sqrt.aspx&gt;http://msdn2.microsoft.com/en-us/library/system.math.sqrt.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Code for Calculating Square Root</title><link>https://www.infopathdev.com:443/forums/thread/12904.aspx</link><pubDate>Tue, 20 Jun 2006 17:26:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12904</guid><dc:creator>slcuster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12904.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12904</wfw:commentRss><description>I have several fields on my form which require, as part of the calculation, to calculate the square root of another field.  Since square root isn't one of the basic functions shown in the insert function window, I assume I'm going to need to write some code to do this.  Does anyone know how I would go about this?  Thanks.&lt;br /&gt;Sandy</description></item></channel></rss>