<?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: Calculation Doesn't Fire Inside Repeat in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/1085402#M36285</link>
    <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1213"&gt;@JamesTedrick&lt;/a&gt;&amp;nbsp;I was searching how to do Standard Deviation in Survey 123 and found this post, thought I would tag it too with the answer. Appreciate&amp;nbsp;all the good help you give James! This post helped me find what I was looking for. I was just trying to do live calculating Standard Deviation for samples in a repeat. I found an example in the "Samples" in Survey123 Connect called JavaScript Examples. This used JavaScript to calculate the SD for a "sample" (u-1) if you needed population it would need to adjust the formula. There is not a lot out there explaining this, would be nice if some of the s123 documentation was updated, SD seems like a pretty valuable tool.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 16:55:57 GMT</pubDate>
    <dc:creator>JosephGrossman</dc:creator>
    <dc:date>2021-08-03T16:55:57Z</dc:date>
    <item>
      <title>Calculation Doesn't Fire Inside Repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/802149#M11078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef; height: 25px;"&gt;&lt;TH style="width: 11.7794%; height: 25px;"&gt;type&lt;/TH&gt;&lt;TH style="width: 15.1629%; height: 25px;"&gt;name&lt;/TH&gt;&lt;TH style="width: 22.4311%; height: 25px;"&gt;label&lt;/TH&gt;&lt;TH style="width: 33.3333%; height: 25px;"&gt;calculation&lt;/TH&gt;&lt;TH style="width: 10.0251%; height: 25px;"&gt;default&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;integer&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;total_repeats&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Number Repeats&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;count(${dummy_counter}) &lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;decimal&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;mean_veg&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Average&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;round(sum(${num_veg}) div ${total_repeats},2)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;begin repeat&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;quads&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Quad Data Entry&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;hidden&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;dummy_counter&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;incraments repeat count&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;integer&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;num_veg&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;# Vegetative&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;decimal&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;num_veg_sqdif&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;Sq Difference Veg&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;pow((${num_veg} - ${mean_veg}),2)&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 11.7794%; height: 25px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;end repeat&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="width: 15.1629%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 22.4311%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 33.3333%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 10.0251%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A portion of the XLS form is above, the problem is that the num_veg_sqdif doesn't automatically re-calculate after new repeat records are added. Notice how the calculation uses the mean of all values inside the repeat. This mean value changes when a new repeat is added, thus all previously calculated num_veg_sqdif values need to be re-calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way to do that is to manually page back through the repeat records and hit the arrow button (looks like the recycle symbol) on the num_veg_sqdif field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;A href="https://doc.arcgis.com/en/survey123/desktop/create-surveys/prepopulateanswers.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;survey123 docs&lt;/A&gt; say this: "&lt;EM&gt;Unlike the &lt;SPAN class=""&gt;default&lt;/SPAN&gt; column, which is evaluated only when the survey is opened or the question becomes relevant, calculations are evaluated every time answers in your survey that are inputs to the calculation change or become relevant."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Why isn't the re-calculation happening inside the repeat, is this expected behavior?&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW: this entire post would be a moot point if there were&amp;nbsp; a few more aggregation functions that work with repeats, submitted idea here: &lt;A href="https://community.esri.com/ideas/16449" target="_blank"&gt;https://community.esri.com/ideas/16449&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jun 2021 08:47:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/802149#M11078</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2021-06-22T08:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Doesn't Fire Inside Repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/802150#M11079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regard to the form you have,&amp;nbsp;the issue is that the average updates, but the square difference calculations for the repeats not currently in focus do not update. &amp;nbsp;This is expected behavior for Survey123. &amp;nbsp;We are working on supporting more complex calculations such as standard deviation through javascript functions that can use a repeat's entries as input parameters; expect to see information in the Early Adopter Community soon on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for additional aggregation functions, we are limited in our inclusion by the XLSForm specification -&amp;nbsp;&lt;A class="link-titled" href="https://opendatakit.github.io/xforms-spec/#fn:Number-Functions" title="https://opendatakit.github.io/xforms-spec/#fn:Number-Functions"&gt;ODK XForms Specification&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2019 21:24:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/802150#M11079</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2019-04-01T21:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Doesn't Fire Inside Repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/1085402#M36285</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1213"&gt;@JamesTedrick&lt;/a&gt;&amp;nbsp;I was searching how to do Standard Deviation in Survey 123 and found this post, thought I would tag it too with the answer. Appreciate&amp;nbsp;all the good help you give James! This post helped me find what I was looking for. I was just trying to do live calculating Standard Deviation for samples in a repeat. I found an example in the "Samples" in Survey123 Connect called JavaScript Examples. This used JavaScript to calculate the SD for a "sample" (u-1) if you needed population it would need to adjust the formula. There is not a lot out there explaining this, would be nice if some of the s123 documentation was updated, SD seems like a pretty valuable tool.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 16:55:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculation-doesn-t-fire-inside-repeat/m-p/1085402#M36285</guid>
      <dc:creator>JosephGrossman</dc:creator>
      <dc:date>2021-08-03T16:55:57Z</dc:date>
    </item>
  </channel>
</rss>

