<?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 Bug with calculations on repeats in Survey123 Connect? in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/bug-with-calculations-on-repeats-in-survey123/m-p/864939#M26757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on an irrigation schedule form in Survey123 and I have a section where I'm stumped because my calculations are coming out wrong but I can't determine why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The basic calculation data entry goes as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Number of days per month the schedule runs (${existing_prog_a_run_days_month})&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Number of start times per day from 1 repeat (count(${existing_prog_a_start}))&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; A 2nd repeat that asks for a station name, number of minutes (${existing_prog_a_run_minutes}), and number of gallons per minute (${existing_prog_a_run_gal_min}).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The total calculation for amount of water used per month should be the number of days per month * the number of start times * the sum of the water used in each station (which is the number of minutes * the gallons per minute).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I've verified that I can't use the aggregate repeat functions to sum arithmetic calculations so I can't do sum(${existing_prog_a_run_minutes} * ${existing_prog_a_run_gal_min}) because that just doesn't work. To get around this, I created a calculate field inside the repeat (${existing_prog_a_run_calculation}) that has a calculation value of ${existing_prog_a_run_minutes} * ${existing_prog_a_run_gal_min} and then am using sum(${existing_prog_a_run_calculation}) to get the totals from the repeat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the issue:&amp;nbsp; I'm testing with some basic numbers to simplify the calculation and I'm getting what seems to be a concatenated result instead of a sum.&amp;nbsp; So, I'm using 10 days, 1 start time, and 2 stations that both are set to the same values of 10 minutes at 15 gallons per minute.&amp;nbsp; This should boil down to 10 days * 1 start time * (2 * (10 minutes * 15 minutes)).&amp;nbsp; If I set this as a calculate field in the XLSForm, the result that shows up is '1501500' which doesn't even seem like a proper concatenation.&amp;nbsp; If I set it as an integer field (or even decimal), I get the result of '3000' which is what I expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the past, working with calculate fields, I guess I assumed that they were just hidden versions of integer/decimal fields. This little experiment seems to suggest that something else is going on. I've even tried wrapping my calculation with the number() and int() functions to try and force a numeral, just in case, but that doesn't fix the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I missing here?&amp;nbsp; Is this a bug or am I unintentionally missing something that explains the incorrect concatenation instead of the addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that, in the attached worksheet, this will be duplicated for a Program A, B, and C but I'm only working on Program A right now.&amp;nbsp; If anyone imports and/or tests this, you only need to fill in the fields marked "Existing&amp;gt;Program A&amp;gt;Start Time, Run Days/Month", and then 2 "Station Run Times&amp;gt;Minutes, Gal/Min" to get the error. The other fields are optional and don't affect the calculation. The correct/incorrect resulting total shows up in "Total Gallons".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Dec 2019 18:37:04 GMT</pubDate>
    <dc:creator>DerekKonofalski</dc:creator>
    <dc:date>2019-12-11T18:37:04Z</dc:date>
    <item>
      <title>Bug with calculations on repeats in Survey123 Connect?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/bug-with-calculations-on-repeats-in-survey123/m-p/864939#M26757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on an irrigation schedule form in Survey123 and I have a section where I'm stumped because my calculations are coming out wrong but I can't determine why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The basic calculation data entry goes as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Number of days per month the schedule runs (${existing_prog_a_run_days_month})&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Number of start times per day from 1 repeat (count(${existing_prog_a_start}))&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; A 2nd repeat that asks for a station name, number of minutes (${existing_prog_a_run_minutes}), and number of gallons per minute (${existing_prog_a_run_gal_min}).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The total calculation for amount of water used per month should be the number of days per month * the number of start times * the sum of the water used in each station (which is the number of minutes * the gallons per minute).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I've verified that I can't use the aggregate repeat functions to sum arithmetic calculations so I can't do sum(${existing_prog_a_run_minutes} * ${existing_prog_a_run_gal_min}) because that just doesn't work. To get around this, I created a calculate field inside the repeat (${existing_prog_a_run_calculation}) that has a calculation value of ${existing_prog_a_run_minutes} * ${existing_prog_a_run_gal_min} and then am using sum(${existing_prog_a_run_calculation}) to get the totals from the repeat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the issue:&amp;nbsp; I'm testing with some basic numbers to simplify the calculation and I'm getting what seems to be a concatenated result instead of a sum.&amp;nbsp; So, I'm using 10 days, 1 start time, and 2 stations that both are set to the same values of 10 minutes at 15 gallons per minute.&amp;nbsp; This should boil down to 10 days * 1 start time * (2 * (10 minutes * 15 minutes)).&amp;nbsp; If I set this as a calculate field in the XLSForm, the result that shows up is '1501500' which doesn't even seem like a proper concatenation.&amp;nbsp; If I set it as an integer field (or even decimal), I get the result of '3000' which is what I expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the past, working with calculate fields, I guess I assumed that they were just hidden versions of integer/decimal fields. This little experiment seems to suggest that something else is going on. I've even tried wrapping my calculation with the number() and int() functions to try and force a numeral, just in case, but that doesn't fix the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I missing here?&amp;nbsp; Is this a bug or am I unintentionally missing something that explains the incorrect concatenation instead of the addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that, in the attached worksheet, this will be duplicated for a Program A, B, and C but I'm only working on Program A right now.&amp;nbsp; If anyone imports and/or tests this, you only need to fill in the fields marked "Existing&amp;gt;Program A&amp;gt;Start Time, Run Days/Month", and then 2 "Station Run Times&amp;gt;Minutes, Gal/Min" to get the error. The other fields are optional and don't affect the calculation. The correct/incorrect resulting total shows up in "Total Gallons".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 18:37:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/bug-with-calculations-on-repeats-in-survey123/m-p/864939#M26757</guid>
      <dc:creator>DerekKonofalski</dc:creator>
      <dc:date>2019-12-11T18:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Bug with calculations on repeats in Survey123 Connect?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/bug-with-calculations-on-repeats-in-survey123/m-p/864940#M26758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the line &lt;STRONG&gt;existing_prog_a_run_calculation&lt;/STRONG&gt;, set the column &lt;STRONG&gt;bind::type&lt;/STRONG&gt; to &lt;EM&gt;int&lt;/EM&gt;. That tells the survey to treat that question as an integer, allowing your next calculation to correctly add its values instead of concatenating them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2019 22:39:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/bug-with-calculations-on-repeats-in-survey123/m-p/864940#M26758</guid>
      <dc:creator>NickDierks1</dc:creator>
      <dc:date>2019-12-11T22:39:41Z</dc:date>
    </item>
  </channel>
</rss>

