<?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: Index on nested repeat in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1708658#M66419</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/503111"&gt;@DouglasKnabe&lt;/a&gt;, I needed to do the same thing (track the cumulative number of records inside a nested repeat). I tried various approaches, but eventually came up with a method that seems pretty robust, even if you move backwards through repeats or delete records from the middle. It requires four separate questions and a JavaScript function.&lt;/P&gt;&lt;P&gt;Outer repeat:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Question that calculates the number of inner repeat records in the current outer repeat record. I usually do this with count() on a primary required question, so that records only count once that field has been populated.&lt;/LI&gt;&lt;LI&gt;Question that keeps a comma-separated list of the values from the first question (list of inner repeat totals within each outer repeat), with one entry for each outer repeat record. I use&amp;nbsp;join(", ", ${name of above question}).&lt;/LI&gt;&lt;LI&gt;Question that uses a JavaScript function to calculate the sum of values in the list generated by the previous question. This returns the desired global/cumulative index for the current inner repeat record, across all outer repeats.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Inner repeat:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Question indicating that a record should be included, used in the count() for the first question.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Adding "calculationMode=always" in the bids::esri:parameters field for the first two questions makes the third question less twitchy; your results may vary. I have attached a stripped-down testing survey.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jun 2026 16:54:47 GMT</pubDate>
    <dc:creator>EvanR</dc:creator>
    <dc:date>2026-06-17T16:54:47Z</dc:date>
    <item>
      <title>Index on nested repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1561891#M60231</link>
      <description>&lt;P&gt;I've got a nested repeat, and am trying to create an index on the inner repeat that rolls over from the previous outer repeat. (see table below) I've got a field ${repindex} using position(..) within the inner repeat, a field (${currMax}) equal to max(${repindex}) in the outer repeat, then a sum(${currMax}) outside the repeats, which is then referenced in the display of the inner repeat. It doesn't quite work as intended, especially when I cycle back to previous repeats. Any ideas?&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Outer repeat Value&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;Inner Repeat Value&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;P&gt;rollover index&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;a&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;6&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;3&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;b&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;2&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;c&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;c&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;7&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;c&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;8&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Ideally, the rollover index would recalculate if a record is added or deleted in the middle.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 21:23:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1561891#M60231</guid>
      <dc:creator>DouglasKnabe</dc:creator>
      <dc:date>2024-11-22T21:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Index on nested repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1561914#M60232</link>
      <description>&lt;P&gt;One trick to not recalc on you is once(position()).&amp;nbsp; But note position has issues when it is nested.&amp;nbsp; Check to make sure you are not getting a loop error at the top right on Connect.&amp;nbsp; If you do I had to go back to the old way of once(count(dummyfield of 1)).&lt;/P&gt;&lt;P&gt;To get the sum or max correct it has to be 1 level above what you want to count.&amp;nbsp; It does get tricky in nested.&amp;nbsp; But just roll up as you go.&lt;/P&gt;&lt;P&gt;But big note all of this falls apart if the user goes back a few records in the repeat and deletes a record.&amp;nbsp; Then you got a dup.&amp;nbsp; We mostly just stopped using indexes.&amp;nbsp; In an attribute table they order how they were added anyway so we just don't really need them anymore.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 23:21:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1561914#M60232</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-11-22T23:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Index on nested repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1562254#M60248</link>
      <description>&lt;P&gt;Thanks. The index is more for display to help line up with what is currently a paper form that we are transcribing via Survey123. The nested repeat is more to add convenience, so I may just give the end user group an either/or choice.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 16:14:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1562254#M60248</guid>
      <dc:creator>DouglasKnabe</dc:creator>
      <dc:date>2024-11-25T16:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Index on nested repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1562258#M60250</link>
      <description>&lt;P&gt;This &lt;EM&gt;could&lt;/EM&gt; also be a case of poorly formatted calculates. Once() would likely still help, but restructuring the calculates could be a better option. Any chance you can include the XLSX?&lt;/P&gt;&lt;P&gt;EDIT: Also, what is the &lt;U&gt;intent&lt;/U&gt; here?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2024 16:35:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1562258#M60250</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-11-25T16:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Index on nested repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1708658#M66419</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/503111"&gt;@DouglasKnabe&lt;/a&gt;, I needed to do the same thing (track the cumulative number of records inside a nested repeat). I tried various approaches, but eventually came up with a method that seems pretty robust, even if you move backwards through repeats or delete records from the middle. It requires four separate questions and a JavaScript function.&lt;/P&gt;&lt;P&gt;Outer repeat:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Question that calculates the number of inner repeat records in the current outer repeat record. I usually do this with count() on a primary required question, so that records only count once that field has been populated.&lt;/LI&gt;&lt;LI&gt;Question that keeps a comma-separated list of the values from the first question (list of inner repeat totals within each outer repeat), with one entry for each outer repeat record. I use&amp;nbsp;join(", ", ${name of above question}).&lt;/LI&gt;&lt;LI&gt;Question that uses a JavaScript function to calculate the sum of values in the list generated by the previous question. This returns the desired global/cumulative index for the current inner repeat record, across all outer repeats.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Inner repeat:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Question indicating that a record should be included, used in the count() for the first question.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Adding "calculationMode=always" in the bids::esri:parameters field for the first two questions makes the third question less twitchy; your results may vary. I have attached a stripped-down testing survey.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 16:54:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/index-on-nested-repeat/m-p/1708658#M66419</guid>
      <dc:creator>EvanR</dc:creator>
      <dc:date>2026-06-17T16:54:47Z</dc:date>
    </item>
  </channel>
</rss>

