<?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 Extract data from repeat in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/extract-data-from-repeat/m-p/1291188#M49398</link>
    <description>&lt;P&gt;I am pulling a blank here.&lt;/P&gt;&lt;P&gt;I have two repeats: &lt;STRONG&gt;Deploy&lt;/STRONG&gt;, &lt;STRONG&gt;Retrieve&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Deploy&lt;/STRONG&gt; has: UID plus a bunch of other fields.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Retrieve&lt;/STRONG&gt; has: UID plus a bunch of other fields.&lt;/P&gt;&lt;P&gt;What I need is: User enters a bunch of data into Deploy and submits. At a later date, they return to site, go to Inbox, grab the previous submission. User scans a barcode that enters a unique number into Retrieve's UID field which pulls data from the Deploy repeat.&lt;/P&gt;&lt;P&gt;How would I go about pulling data from this repeat?&lt;/P&gt;&lt;P&gt;I can do this by referencing position(..) quite easily; but this is too cumbersome. I can also do something similar pulling data from the Feature Layer; but the solution needs to work in an offline environment (This may also restrict us from using Java--users have accounts, but no internet in the field).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 17:53:34 GMT</pubDate>
    <dc:creator>abureaux</dc:creator>
    <dc:date>2023-05-19T17:53:34Z</dc:date>
    <item>
      <title>Extract data from repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/extract-data-from-repeat/m-p/1291188#M49398</link>
      <description>&lt;P&gt;I am pulling a blank here.&lt;/P&gt;&lt;P&gt;I have two repeats: &lt;STRONG&gt;Deploy&lt;/STRONG&gt;, &lt;STRONG&gt;Retrieve&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Deploy&lt;/STRONG&gt; has: UID plus a bunch of other fields.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Retrieve&lt;/STRONG&gt; has: UID plus a bunch of other fields.&lt;/P&gt;&lt;P&gt;What I need is: User enters a bunch of data into Deploy and submits. At a later date, they return to site, go to Inbox, grab the previous submission. User scans a barcode that enters a unique number into Retrieve's UID field which pulls data from the Deploy repeat.&lt;/P&gt;&lt;P&gt;How would I go about pulling data from this repeat?&lt;/P&gt;&lt;P&gt;I can do this by referencing position(..) quite easily; but this is too cumbersome. I can also do something similar pulling data from the Feature Layer; but the solution needs to work in an offline environment (This may also restrict us from using Java--users have accounts, but no internet in the field).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 17:53:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/extract-data-from-repeat/m-p/1291188#M49398</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-05-19T17:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from repeat</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/extract-data-from-repeat/m-p/1302481#M50217</link>
      <description>&lt;P&gt;I was able to use Javascript to achieve what I want here. I don't know if this can be completed without JS, and I am not claiming that this code is as efficient as it should be, but it gets results!&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function myfunction(f, ad) {
	let finder = f;	
	let dataset = ad.split(',');

	const myArray = dataset.indexOf(f) &amp;gt;= 0; 
	const position = dataset.indexOf(f);

	return position;
}&lt;/LI-CODE&gt;&lt;P&gt;Going off my repeats above, I use join() to create a comma separated list of UIDs for my&amp;nbsp;&lt;STRONG&gt;Deploy&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;repeat (for the sake of this example, lets name it&amp;nbsp;&lt;EM&gt;deploy_join&lt;/EM&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_0-1687533213283.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74043iB05397B634D00A31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_0-1687533213283.png" alt="abureaux_0-1687533213283.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then, I created two calculates: &lt;EM&gt;index_js&lt;/EM&gt;, and &lt;EM&gt;index_js1&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;index_js&lt;/STRONG&gt; uses the pulldate() generated by S123:&amp;nbsp;pulldata("@javascript", "functions.js", "myfunction", ${&amp;lt;f&amp;gt;}, ${&amp;lt;ad&amp;gt;})&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;${&amp;lt;f&amp;gt;} = A barcode question in my &lt;STRONG&gt;Retrieve&lt;/STRONG&gt; repeat (Let's call it &lt;EM&gt;rtv_barcode&lt;/EM&gt;)&lt;/LI&gt;&lt;LI&gt;${&amp;lt;ad&amp;gt;} = &lt;SPAN&gt;&lt;EM&gt;deploy_join&lt;/EM&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;At this point, the JS is working. If you scan a barcode, it will search the join() for that number, and return the index of that number in the string. The problem is, when JS starts counting, it starts at 0. But for the final step, I needed it to start counting at 1.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;index_js1&lt;/STRONG&gt; is simply&amp;nbsp;&lt;EM&gt;index_js + 1&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_1-1687533267789.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74044i44598D999F314540/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_1-1687533267789.png" alt="abureaux_1-1687533267789.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now I have an index that S123 can use. I extract all of the information I want from the previous repeat with the built in indexed-repeat() function:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_2-1687533684107.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74048i66E7657C05296721/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_2-1687533684107.png" alt="abureaux_2-1687533684107.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 15:21:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/extract-data-from-repeat/m-p/1302481#M50217</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2023-06-23T15:21:50Z</dc:date>
    </item>
  </channel>
</rss>

