<?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: Calculations on an unknown number of fields in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792103#M8483</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jürgen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The max() and min() functions can work as you want. &amp;nbsp;The issue is sum() and count() - they are defined in the XLSForm spec to only work with repeats. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Nov 2018 22:45:08 GMT</pubDate>
    <dc:creator>JamesTedrick</dc:creator>
    <dc:date>2018-11-30T22:45:08Z</dc:date>
    <item>
      <title>Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792100#M8480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a survey for a number of measurements, in total 32. The measurements compose a matrix of 4 by 8 (4 different heights, 8 different wind directions). Not all points must be measured, it is up to the field guy which measurements he/she takes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All possible measurement points are represented by an integer question in my survey. For various reasons I am not using repeats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I want to make some calculations like max(), min(), sum(), avg(), but only for those measurement points that do have a value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have a tip how I can tackle this task (efficiently) in Survey123?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much, best regards,&lt;/P&gt;&lt;P&gt;Jürgen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2018 14:18:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792100#M8480</guid>
      <dc:creator>JürgenBiendara1</dc:creator>
      <dc:date>2018-11-29T14:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792101#M8481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jürgen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a couple of ways to do this:&lt;/P&gt;&lt;P&gt;- if you have a few calculations, you can use the coalesce() function to provide an alternative value if a question is not answered (null) - coalesce(${q1}, 0) will return the value in q1 when present, 0 otherwise&lt;/P&gt;&lt;P&gt;- an alternate formula to coalesce would be: if(string-length(${q1}) = 0, 0, ${q1})&lt;/P&gt;&lt;P&gt;- If you have a large number of calculations, you can add a calculate question after each measurement to store the coalesce or if/string-length function (likely making the bind:esri:fieldType null to not add fields to the table) and use the calculate questions' values instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Nov 2018 20:20:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792101#M8481</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2018-11-29T20:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792102#M8482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for replying to my question. The&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;coalesce() function&amp;nbsp;is new to me and I think it can be helpful in the future. Nevertheless, I hoped that there would be an easier way to achieve the calculation results I am looking for. Right now and with regards to what you are writing may solution would be as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; For each edited field of the 32 fields - calculate, if it is the maximum and set the maximum question&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; For each edited field of the 32 fields - calculate, if it is the maximum and set the minimum question&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; Sum up all edited fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; Find out how many fields have been edited&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; Calculate the average value of all edited fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Since I can only do one calculation per question I would need a lot of calculation questions to accomplish the task.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;My hope was that I can kind of tag all fields that were edited. Then, the calculations would be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; max(all tagged fields)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; min(all tagged fields)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;-&amp;gt; sum(all tagged fileds) div count (all tagged fields)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Jürgen&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2018 08:53:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792102#M8482</guid>
      <dc:creator>JürgenBiendara1</dc:creator>
      <dc:date>2018-11-30T08:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792103#M8483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jürgen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The max() and min() functions can work as you want. &amp;nbsp;The issue is sum() and count() - they are defined in the XLSForm spec to only work with repeats. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2018 22:45:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792103#M8483</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2018-11-30T22:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792104#M8484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There seems to be a problem with the max() and min() functions in nested repeats. Please see the attached example. Here, the max() function does not work. But, as soon as you delete the outer repeat, the max() function works as expected. Any chance to get around this problem or to fix it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the average function: I found a solution in an older thread here in GeoNet -&amp;gt;&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/message/793394-re-how-to-implement-this-formula-in-excel-form-survey123?commentID=793394#comment-793394"&gt;How to implement this formula in Excel Form (Survey123)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But, in my case with 32 questions to be averaged, this solution seems to be very cumbersome. Can you think of an easier way to do this? (Please also see the attached survey which has only 8 integer questions. The intended structure is the same but with four groups of eight integer questions each.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much, best regards,&lt;/P&gt;&lt;P&gt;Jürgen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2018 12:52:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792104#M8484</guid>
      <dc:creator>JürgenBiendara1</dc:creator>
      <dc:date>2018-12-03T12:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792105#M8485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jürgen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for bringing this example. &amp;nbsp;Support for aggregation functions is still be examined.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2018 18:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792105#M8485</guid>
      <dc:creator>JamesTedrick</dc:creator>
      <dc:date>2018-12-03T18:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations on an unknown number of fields</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792106#M8486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Meanwhile I found ways to calculate min(), max(), and avg() for my fields. But now I see other problems.&amp;nbsp;I have up to eight measurements for one object. For these measurements I calculate&amp;nbsp;&lt;SPAN&gt;min(), max(), and avg(). The object is in a repeat, i. e. I can have more than one object. I want to calculate&amp;nbsp;min(), max(), and avg() individually for each object.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. The calculation of&amp;nbsp;min(), max(), and avg() for the first object is working perfectly. But when I create the second object,&amp;nbsp;min() and max() of the first object are retained (here with four measurements).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG __jive_id="431092" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/431092_pastedImage_2.jpg" /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG __jive_id="431102" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/431102_pastedImage_3.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Although I set "allowUpdates=true query=’1=1’" in column "bind::esri:parameters" for this repeat, some of the values are not loaded down to the surveys in my inbox.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am using note questions to display the calculated values since it does not work with integer or decimal questions.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Maybe these observations help to narrow down the problem with calculations in a repeat.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jürgen&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2018 09:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/calculations-on-an-unknown-number-of-fields/m-p/792106#M8486</guid>
      <dc:creator>JürgenBiendara1</dc:creator>
      <dc:date>2018-12-07T09:44:05Z</dc:date>
    </item>
  </channel>
</rss>

