<?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: Summarizing the responses of a repeat question in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875946#M29247</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Short answer: If you set the value of column &lt;EM&gt;bind::type&lt;/EM&gt; in row number 17 to &lt;EM&gt;int&lt;/EM&gt;, your &lt;EM&gt;sum&lt;/EM&gt; function in row 21 will return a &lt;EM&gt;sum&lt;/EM&gt; rather than a concatenation of strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Long answer: Working with &lt;EM&gt;calculate&lt;/EM&gt; and &lt;EM&gt;hidden&lt;/EM&gt; questions can get a bit tricky when working with functions like &lt;EM&gt;sum&lt;/EM&gt;. If on top of that we add relevant statements things complicate even more. Your survey has both! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; So here are some tips:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;EM&gt;Calculate&lt;/EM&gt; and &lt;EM&gt;hidden&lt;/EM&gt; questions always default to the text data type. This is why they always get stored as esriFieldTypeString and functions like sum think of them as text.&amp;nbsp; In your case, you want your calculate question to be treated as an integer and be stored as an integer. For this reason, you want to set the &lt;EM&gt;bind::esri:FieldType&lt;/EM&gt; to &lt;EM&gt;esriFieldTypeInteger&lt;/EM&gt; (stores values in your feature layer in an integer column) and the &lt;EM&gt;bind::type&lt;/EM&gt; as &lt;EM&gt;int&lt;/EM&gt; (so it gets treated as an integer for calculations within your XLSForm).&amp;nbsp; If you do this, you do not need to cast values to number in your XLSForm expressions and the sum function will sum numbers as opposed to strings.&lt;/LI&gt;&lt;LI&gt;The value of a non-relevant question is always set to &lt;EM&gt;null&lt;/EM&gt;. This causes problems when you try to use mathematical functions. For example 2 + null is null. If you sum the values of a relevant question and a non-relevant question, you get a null; it looks as if the sum function would do nothing.&amp;nbsp; The trick here is to use the &lt;EM&gt;coalesce&lt;/EM&gt; function. Coalesce takes two inputs and returns the first input that is not null. For example, &lt;EM&gt;coalesce(${plant_coverage_1},0)&lt;/EM&gt; will return the value on plant_coverage_1 if it is not &lt;EM&gt;null&lt;/EM&gt;, otherwise it will return 0.&amp;nbsp; Using this technique, you can safely add the ground cover of all the plants (even if some of them are non-present).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;With the above in mind, you can simplify your XLSForm quite a bit. I attached a new simplified version of your form. Hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 01 Dec 2019 02:14:58 GMT</pubDate>
    <dc:creator>IsmaelChivite</dc:creator>
    <dc:date>2019-12-01T02:14:58Z</dc:date>
    <item>
      <title>Summarizing the responses of a repeat question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875945#M29246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my Survey I am trying to analyze the ground cover of a few indicator plants at various points.&lt;/P&gt;&lt;P&gt;I am using a 'repeat' to collect the different coverage values for every point but upon calculating (using the 'sum' formular), Survey123 is concatenating the values instead of adding them. &lt;/P&gt;&lt;P&gt;See the attached xls. form for more details on how the repeat is structured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me out on this one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;PRE class="" data-placeholder="Übersetzung" style="text-align: left;"&gt;&lt;SPAN lang="en"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2019 18:44:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875945#M29246</guid>
      <dc:creator>SimonLange</dc:creator>
      <dc:date>2019-11-28T18:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing the responses of a repeat question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875946#M29247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Short answer: If you set the value of column &lt;EM&gt;bind::type&lt;/EM&gt; in row number 17 to &lt;EM&gt;int&lt;/EM&gt;, your &lt;EM&gt;sum&lt;/EM&gt; function in row 21 will return a &lt;EM&gt;sum&lt;/EM&gt; rather than a concatenation of strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Long answer: Working with &lt;EM&gt;calculate&lt;/EM&gt; and &lt;EM&gt;hidden&lt;/EM&gt; questions can get a bit tricky when working with functions like &lt;EM&gt;sum&lt;/EM&gt;. If on top of that we add relevant statements things complicate even more. Your survey has both! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt; So here are some tips:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;EM&gt;Calculate&lt;/EM&gt; and &lt;EM&gt;hidden&lt;/EM&gt; questions always default to the text data type. This is why they always get stored as esriFieldTypeString and functions like sum think of them as text.&amp;nbsp; In your case, you want your calculate question to be treated as an integer and be stored as an integer. For this reason, you want to set the &lt;EM&gt;bind::esri:FieldType&lt;/EM&gt; to &lt;EM&gt;esriFieldTypeInteger&lt;/EM&gt; (stores values in your feature layer in an integer column) and the &lt;EM&gt;bind::type&lt;/EM&gt; as &lt;EM&gt;int&lt;/EM&gt; (so it gets treated as an integer for calculations within your XLSForm).&amp;nbsp; If you do this, you do not need to cast values to number in your XLSForm expressions and the sum function will sum numbers as opposed to strings.&lt;/LI&gt;&lt;LI&gt;The value of a non-relevant question is always set to &lt;EM&gt;null&lt;/EM&gt;. This causes problems when you try to use mathematical functions. For example 2 + null is null. If you sum the values of a relevant question and a non-relevant question, you get a null; it looks as if the sum function would do nothing.&amp;nbsp; The trick here is to use the &lt;EM&gt;coalesce&lt;/EM&gt; function. Coalesce takes two inputs and returns the first input that is not null. For example, &lt;EM&gt;coalesce(${plant_coverage_1},0)&lt;/EM&gt; will return the value on plant_coverage_1 if it is not &lt;EM&gt;null&lt;/EM&gt;, otherwise it will return 0.&amp;nbsp; Using this technique, you can safely add the ground cover of all the plants (even if some of them are non-present).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;With the above in mind, you can simplify your XLSForm quite a bit. I attached a new simplified version of your form. Hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Dec 2019 02:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875946#M29247</guid>
      <dc:creator>IsmaelChivite</dc:creator>
      <dc:date>2019-12-01T02:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing the responses of a repeat question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875947#M29248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much - now it works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2019 12:31:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/875947#M29248</guid>
      <dc:creator>SimonLange</dc:creator>
      <dc:date>2019-12-02T12:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Summarizing the responses of a repeat question</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/1049217#M33997</link>
      <description>&lt;P&gt;Thanks Ismael!! The response you provided a couple years ago is still helping folks like me today!!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 16:21:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/summarizing-the-responses-of-a-repeat-question/m-p/1049217#M33997</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-04-20T16:21:16Z</dc:date>
    </item>
  </channel>
</rss>

