<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: what am i doing wrong with this calculation? in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1282025#M48846</link>
    <description>&lt;P&gt;If JavaScript isn't an option, a repeat would be a good alternative.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example of what you seem to be using now:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_0-1682363322024.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68930i77DFD5599F196137/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_0-1682363322024.png" alt="abureaux_0-1682363322024.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the same idea, but in a repeat:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_1-1682363397276.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68931iAB78976C30A329BC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_1-1682363397276.png" alt="abureaux_1-1682363397276.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The repeat will work for as many instances of DBH as you need, all while taking considerably less nested IF statements (aka, none)!&lt;/P&gt;</description>
    <pubDate>Mon, 24 Apr 2023 19:12:29 GMT</pubDate>
    <dc:creator>abureaux</dc:creator>
    <dc:date>2023-04-24T19:12:29Z</dc:date>
    <item>
      <title>what am i doing wrong with this calculation?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1281427#M48801</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Its suppose to perform the square root of the sum of squares depending on how many inputs are selected&lt;BR /&gt;if(selected(${DBH}, '1'), (sqrt(pow(${DBH1}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '2'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '3'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2))),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '4'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '5'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2) + pow(${DBH5}, 2))),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '6'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2) + pow(${DBH5}, 2) + pow(${DBH6}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '7'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2) + pow(${DBH5}, 2) + pow(${DBH6}, 2) + pow(${DBH7}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '8'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2) + pow(${DBH5}, 2) + pow(${DBH6}, 2) + pow(${DBH7}, 2) + pow(${DBH8}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (selected(${DBH}, '9'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2) + pow(${DBH5}, 2) + pow(${DBH6}, 2) + pow(${DBH7}, 2) + pow(${DBH8}, 2) + pow(${DBH9}, 2))), &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if(selected(${DBH}, '10'), (sqrt(pow(${DBH1}, 2) + pow(${DBH2}, 2) + pow(${DBH3}, 2) + pow(${DBH4}, 2) + pow(${DBH5}, 2) + pow(${DBH6}, 2) + pow(${DBH7}, 2) + pow(${DBH8}, 2) + pow(${DBH9}, 2) + pow(${DBH10}, 2))))))))))))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 18:58:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1281427#M48801</guid>
      <dc:creator>EvanDarpini</dc:creator>
      <dc:date>2023-04-21T18:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: what am i doing wrong with this calculation?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1281630#M48810</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/665514"&gt;@EvanDarpini&lt;/a&gt;&amp;nbsp; I think a JavaScript function will be perfect for this. For example:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function squareRootOfSumOfSquares(nums) {
  let sumOfSquares = 0;
  let numsArray = nums.split(',');
  for (let i = 0; i &amp;lt; numsArray.length; i++) {
    sumOfSquares += numsArray[i] ** 2;
  }
  const squareRoot = Math.sqrt(sumOfSquares);
  return sumOfSquares;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function takes a comma separated list of numbers, squares them all one by one and calculates the sum. Then it returns the square root of the sum.&lt;/P&gt;&lt;P&gt;You can generate a comma separated list of numbers in different ways.&amp;nbsp;Below is an animation showing the test I did with all of this. I created three experiences to enter the data. One using a single text question, a series of questions and a repeat. Just for fun.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Squares.gif" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68829iF1DF4CFCDACC04E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Squares.gif" alt="Squares.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Attaching a the XLSForm illustrating the concept.&amp;nbsp; If you are not familiar with JS functions check out this &lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/extending-survey123-smart-forms-with-custom-js/ba-p/898782" target="_blank" rel="noopener"&gt;blog&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Apr 2023 16:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1281630#M48810</guid>
      <dc:creator>IsmaelChivite</dc:creator>
      <dc:date>2023-04-22T16:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: what am i doing wrong with this calculation?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1282025#M48846</link>
      <description>&lt;P&gt;If JavaScript isn't an option, a repeat would be a good alternative.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example of what you seem to be using now:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_0-1682363322024.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68930i77DFD5599F196137/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_0-1682363322024.png" alt="abureaux_0-1682363322024.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the same idea, but in a repeat:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_1-1682363397276.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/68931iAB78976C30A329BC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_1-1682363397276.png" alt="abureaux_1-1682363397276.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The repeat will work for as many instances of DBH as you need, all while taking considerably less nested IF statements (aka, none)!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 19:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/what-am-i-doing-wrong-with-this-calculation/m-p/1282025#M48846</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-04-24T19:12:29Z</dc:date>
    </item>
  </channel>
</rss>

