<?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: Prepopulate answers in a repeat with last values in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098646#M37199</link>
    <description>&lt;P&gt;No it would just be position(..)&amp;nbsp; the .. just tells it to use the repeat the question is in.&amp;nbsp; If you are outside the repeat you may need the repeat name.&amp;nbsp; Not sure where you are getting the 1 part?&lt;/P&gt;&lt;P&gt;I retested my form and this does all work so something else is up.&amp;nbsp; Did you say you are using this on a geopoint?&amp;nbsp; I am not sure that would work as javascript has no idea what a geopoint is.&amp;nbsp; May have to send lat/long then return that as a string like you would for URL passing.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Sep 2021 20:00:28 GMT</pubDate>
    <dc:creator>DougBrowning</dc:creator>
    <dc:date>2021-09-15T20:00:28Z</dc:date>
    <item>
      <title>Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1093928#M36840</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I can't seem to create a Survey where the repeat values are prepopulated with the same values as the last record inserted in the repeat (I'm also using the Inbox option).&lt;/P&gt;&lt;P&gt;Let me explain:&lt;BR /&gt;I have a form with a geopoint and a repeat that contains two values: date and note&lt;/P&gt;&lt;P&gt;Geopoint&lt;BR /&gt;Repeat&lt;BR /&gt;-date&lt;BR /&gt;-note&lt;BR /&gt;end repeat&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image1.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22067i161BE58CC4AE6EF2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image1.JPG" alt="Image1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The surveyor has to find the nearest point to him (use Inbox) and has to insert a new repeat record with the date calculated automatically (I know how to do it) and a new note whose value must not be empty but must be prepopulated by the value of the previous note (I don't know how to do it).&lt;/P&gt;&lt;P&gt;I tried using the indexed-repeat () function but I get a cyclic error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Image2.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/22068i34F0023117CC9029/image-size/large?v=v2&amp;amp;px=999" role="button" title="Image2.JPG" alt="Image2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions?&lt;/P&gt;&lt;P&gt;Thank you in advance for your attention,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 09:40:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1093928#M36840</guid>
      <dc:creator>PaoloBasile_ST</dc:creator>
      <dc:date>2021-08-31T09:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1093987#M36843</link>
      <description>&lt;P&gt;I have been working on this for over 3 years now and have posted on this a bunch of times.&amp;nbsp; The way you posted will never work as it is a loop.&amp;nbsp; When 123 displays a page each element has a name so you can't just say give Field A the value of Field A.&amp;nbsp; I was really hoping when indexed-repeat came out it was smart enough to handle this but no.&amp;nbsp; indexed-repeat above you can get the value in a different field but not the same field.&lt;/P&gt;&lt;P&gt;The only one I got to work was with javascript.&amp;nbsp; For me my repeat is too big and so this crashed the tablet.&amp;nbsp; But it may work for you.&lt;/P&gt;&lt;P&gt;pulldata is&amp;nbsp;&lt;/P&gt;&lt;P&gt;pulldata("@javascript", "functions.js", "sameaslast", ${repeat name here}, current repeat number here, "field name")&lt;/P&gt;&lt;P&gt;javascript is&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function sameaslast(repeat, position, fieldname) {
	if (position &amp;gt; 1){
		return repeat[position - 2][fieldname];

	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My crews ask me for this every single year repeatedly.&amp;nbsp; I have prob tried 10 diff ways.&amp;nbsp; Then this one broke for a diff reason.&amp;nbsp; If anyone has got anything else to try I would really love to hear it!&lt;/P&gt;&lt;P&gt;For you I would also consider using Field Maps for the main point then have each new visit a form.&amp;nbsp; Use a relationship to tie them all together.&amp;nbsp; This way they get all the spatial info.&amp;nbsp; Then you can just pass the note from Field Maps to 123 using the URL parms.&amp;nbsp; This also gives you full spatial, editor tracking, etc for each visit not just the last one.&amp;nbsp; It also protects the main point for accidental changes.&amp;nbsp; This is what we do and it works great.&amp;nbsp; We can see if they say logged it under the wrong point once since I can see where they were standing for example.&lt;/P&gt;&lt;P&gt;Just an idea.&amp;nbsp; Let me know if this works.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 14:05:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1093987#M36843</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-08-31T14:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1094292#M36876</link>
      <description>&lt;P&gt;Thanks Doug,&lt;/P&gt;&lt;P&gt;I suspected that index-repeat wasn't refined enough to understand that even if the field was the same, you were going to copy values from another record.&lt;/P&gt;&lt;P&gt;We are also pondering your suggestions with javascript and Field Map and will let you know if we use them.&lt;/P&gt;&lt;P&gt;We may have come up with a more low-level and much "dirtier" solution that has advantages and a big disadvantage.&lt;/P&gt;&lt;P&gt;Instead of making a model like:&lt;/P&gt;&lt;P&gt;Geopoint&lt;BR /&gt;Repeat&lt;BR /&gt;-date&lt;BR /&gt;-note&lt;BR /&gt;end repeat&lt;/P&gt;&lt;P&gt;We were thinking of doing a model like this:&lt;/P&gt;&lt;P&gt;-Geopoint&lt;/P&gt;&lt;P&gt;-lastDate&lt;/P&gt;&lt;P&gt;-lastNote&lt;/P&gt;&lt;P&gt;Repeat&lt;BR /&gt;-date (hidden, calculate from lastDate)&lt;BR /&gt;-note (hidden, calculate from lastNote)&lt;BR /&gt;-image* (required)&lt;/P&gt;&lt;P&gt;end repeat&lt;/P&gt;&lt;P&gt;(actually we have many more fields to fill in, mine was just an example to simplify the problem).&lt;/P&gt;&lt;P&gt;Basically, the table structure of the Repeat is almost reproduced on the geographical table which is the one that is compiled on 123.&lt;/P&gt;&lt;P&gt;The fields in the Repeat are automatically calculated by 123 from those in the geographic table.&lt;/P&gt;&lt;P&gt;Therefore, the geographic table becomes a sort of "copy" of the last survey made, and with the Repeat the historicity of the surveys is maintained.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Advantages:&lt;/P&gt;&lt;P&gt;-fields are pre-filled with the last set value&lt;/P&gt;&lt;P&gt;-filters and queries can be made directly on the geographical table within the ArcGIS Online/Enterprise WebApps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Disadvantage:&lt;/P&gt;&lt;P&gt;-management of value changes on the Web App becomes more difficult: for example, if you need to change a field value from the Web App, you have to do it twice: once for the geographic table and once for the related Repeat table. That is unless you find an automatic mechanism on the Web App.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was this one of your possible 10 solutions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 07:52:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1094292#M36876</guid>
      <dc:creator>PaoloBasile_ST</dc:creator>
      <dc:date>2021-09-01T07:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1094366#M36880</link>
      <description>&lt;P&gt;I think if you try to put the last value in the main form and then read it back to the repeat it is still a loop, just a longer one.&amp;nbsp; Pretty sure I tried that.&amp;nbsp; The only way I ever got last value to work was javascript.&amp;nbsp; It is really easy to use actually.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not love the idea of repeating the values of the last repeat in the parent - that is double storing data really.&amp;nbsp; Also what can happen is someone may review the webmap, see an issue and fix it right there.&amp;nbsp; If they do that the form is skipped so none of the calcs run.&amp;nbsp; I still always like 1 visit one form.&amp;nbsp; You can use Arcade to display any values from the repeat in the parent if you need it.&amp;nbsp; The main issue with this can be symbolizing.&amp;nbsp; We had luck with using dashboards instead for this.&lt;/P&gt;&lt;P&gt;Another idea that is coming this yearish to AGOL (already in SDE) is attribute rules that may work to roll up to the parent.&lt;/P&gt;&lt;P&gt;Either way I would add location to the repeat. Always good to see if they went to the correct spot.&amp;nbsp; Plus then you can map all failed inspections for example.&lt;/P&gt;&lt;P&gt;Let me know what you come up with.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 13:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1094366#M36880</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-09-01T13:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1095706#M36970</link>
      <description>&lt;P&gt;Hi Doug,&lt;/P&gt;&lt;P&gt;thank you that you are so kind to always respond to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll try to answer you point by point:&lt;/P&gt;&lt;P&gt;“I think if you try to put the last value in the main form and then read it back to the repeat it is still a loop, just a longer one.&amp;nbsp; Pretty sure I tried that.&amp;nbsp; The only way I ever got last value to work was javascript.&amp;nbsp; It is really easy to use actually.&amp;nbsp;“&lt;/P&gt;&lt;P&gt;We actually managed to achieve what I was writing to you.&lt;/P&gt;&lt;P&gt;On Survey123 the operator fills the parent table while the child table values (hidden) are automatically filled by the copy formulas in the calculate ($Namefield).&lt;/P&gt;&lt;P&gt;We force the operator to create the record of the child table by putting on it the photo fields, one of which is mandatory.&lt;/P&gt;&lt;P&gt;There are of course many limitations to this solution: an important limitation concerns the Survey123 Web on which you cannot use the calculate formulas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;“I do not love the idea of repeating the values of the last repeat in the parent - that is double storing data really.&amp;nbsp; Also what can happen is someone may review the webmap, see an issue and fix it right there.&amp;nbsp; If they do that the form is skipped so none of the calcs run.&amp;nbsp; I still always like 1 visit one form.&amp;nbsp; You can use Arcade to display any values from the repeat in the parent if you need it.&amp;nbsp; The main issue with this can be symbolizing.&amp;nbsp; We had luck with using dashboards instead for this.”&lt;/P&gt;&lt;P&gt;You're right, this is the other real limitation! Duplicating information if you use a web app, you are forced to enter/edit from two sides, unless you come up with some automation to align the database.&lt;/P&gt;&lt;P&gt;(I had never considered the Dashboard for symbology. I'll try to study the topic, thanks.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;“Another idea that is coming this yearish to AGOL (already in SDE) is attribute rules that may work to roll up to the parent.”&lt;/P&gt;&lt;P&gt;We are working on Enterprise (without SDE) and as you know updates always arrive a bit late.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;“Either way I would add location to the repeat. Always good to see if they went to the correct spot.&amp;nbsp; Plus then you can map all failed inspections for example.”&lt;/P&gt;&lt;P&gt;For our specific case this is a solution that we cannot take. However I will keep it in mind for future Surveys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for now,&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 07:59:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1095706#M36970</guid>
      <dc:creator>PaoloBasile_ST</dc:creator>
      <dc:date>2021-09-06T07:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098490#M37192</link>
      <description>&lt;P&gt;Hi Doug,&lt;/P&gt;&lt;P&gt;I too, am trying to create a Survey where the repeat values are prepopulated with the same values as the last record inserted in the repeat.&lt;/P&gt;&lt;P&gt;I have a form with a repeat that contains a text value (Site_Addr) I would like to have available for entry, and upon the second repeat entry, be prepopulated by the value of the previous text value entered.&amp;nbsp; I also tried to use the indexed-repeat () function but get the expected cyclical error.&amp;nbsp; I was hoping your workaround using Javascript would work here as an alternative, but I am not having success and wondered if you could help me troublshoot what I might be doing wrong.&amp;nbsp; I am new to using the pulldata function with Javascript and not familiar enough with Javascript to recognize what is not working; I'll give you the basics of what I have:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;begin repeat&lt;/STRONG&gt; (Dev_CaseInfo)&lt;BR /&gt;-Site_Addr -Calculation:&amp;nbsp;pulldata("@javascript", "RepeatAdd.js", "sameaslast", ${Dev_CaseInfo}, position, "Site_Addr")&lt;BR /&gt;&lt;STRONG&gt;end repeat&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Javascript is (RepeatAdd.js):&amp;nbsp;&lt;/P&gt;&lt;P&gt;function sameaslast(Dev_CaseInfo,position, Site_Addr) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (position &amp;gt; 1){&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return repeat[position - 2][Site_Addr];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if I am misusing "position" in the function. Is this something indented in the original commenters function because of the geopoint?&lt;/P&gt;&lt;P&gt;I've also attached the survey and js file.&lt;/P&gt;&lt;P&gt;Any help you can offer is greatly appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Leah Sperduto&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 15:13:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098490#M37192</guid>
      <dc:creator>LeahSperduto1</dc:creator>
      <dc:date>2021-09-15T15:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098499#M37193</link>
      <description>&lt;P&gt;In your pulldata call you just have position.&amp;nbsp; It is a function so you need to do position(..) or if you have nested repeats use the name of the repeat position(${repeatname}).&lt;/P&gt;&lt;P&gt;Then in my code I wrapped it in number() so it may need that also I forget.&lt;/P&gt;&lt;P&gt;So change line 22 to&lt;/P&gt;&lt;P&gt;pulldata("@javascript", "RepeatAdd.js", "sameaslast", ${Dev_CaseInfo}, number(position(${Dev_CaseInfo})), "Site_Addr")&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 15:27:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098499#M37193</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-09-15T15:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098644#M37198</link>
      <description>&lt;P&gt;Thank you for the prompt reply Doug!&lt;/P&gt;&lt;P&gt;I tried what you suggested and it did not work.&amp;nbsp; If I do not have a nested repeat, but just a basic repeat, would it look like this?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;pulldata("@javascript", "RepeatAdd.js", "sameaslast", ${Dev_CaseInfo}, number(position(..1)), "Site_Addr")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in connect, the error it gives me upon testing it is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;@javascript error:ReferenceError: repeat is not defined in RepeatAdd.js:sameaslast&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 19:58:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098644#M37198</guid>
      <dc:creator>LeahSperduto1</dc:creator>
      <dc:date>2021-09-15T19:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098646#M37199</link>
      <description>&lt;P&gt;No it would just be position(..)&amp;nbsp; the .. just tells it to use the repeat the question is in.&amp;nbsp; If you are outside the repeat you may need the repeat name.&amp;nbsp; Not sure where you are getting the 1 part?&lt;/P&gt;&lt;P&gt;I retested my form and this does all work so something else is up.&amp;nbsp; Did you say you are using this on a geopoint?&amp;nbsp; I am not sure that would work as javascript has no idea what a geopoint is.&amp;nbsp; May have to send lat/long then return that as a string like you would for URL passing.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 20:00:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098646#M37199</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-09-15T20:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098657#M37200</link>
      <description>&lt;P&gt;This error shows up in the Site_Addr when I attempt to add the 2nd repeat:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;@javascript error:ReferenceError: repeat is not defined in RepeatAdd.js:sameaslast&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 20:20:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098657#M37200</guid>
      <dc:creator>LeahSperduto1</dc:creator>
      <dc:date>2021-09-15T20:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098659#M37201</link>
      <description>&lt;P&gt;Oh now I see it you changed the name of the variable at the top of the function but then kept using the word repeat in the code.&amp;nbsp; May want to read up on how functions work.&lt;/P&gt;&lt;P&gt;Change the code back to use repeat.&amp;nbsp; You did that with fieldname also.&amp;nbsp; You change what to send to the function in the pulldata you do not change the names used inside the function.&lt;/P&gt;&lt;P&gt;Change back to my code in the .js file&amp;nbsp; See how the name repeat is in the first line then used in the function?&amp;nbsp; See how fieldname is in line 1 then used in the function.&amp;nbsp; You changed line 1 but not the other code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function sameaslast(repeat, position, fieldname) {
	if (position &amp;gt; 1){
		return repeat[position - 2][fieldname];

	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that makes more sense now.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 20:31:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098659#M37201</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-09-15T20:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098667#M37202</link>
      <description>&lt;P&gt;So that definitely helped. After publishing, however, it doesn't work when using it in the applications.&lt;/P&gt;&lt;P&gt;Is it intended to work in both the native app (using new collection and/or inbox) and also as a web app survey?&lt;/P&gt;&lt;P&gt;When demo'ing in Connect, I get the Site_Addr field to repeat the original entry as desired/expected.&lt;/P&gt;&lt;P&gt;Upon publishing:&lt;/P&gt;&lt;P&gt;In the native app I still get the error in the Site_Addr field.&lt;/P&gt;&lt;P&gt;In the web app I get nothing in the Site_Addr field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 20:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098667#M37202</guid>
      <dc:creator>LeahSperduto1</dc:creator>
      <dc:date>2021-09-15T20:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098675#M37203</link>
      <description>&lt;P&gt;Make sure you have the latest version of the app.&amp;nbsp; Note JS cannot be used in public surveys or across Orgs.&lt;/P&gt;&lt;P&gt;The app error seems like it maybe the form is out of date.&amp;nbsp; Maybe delete and redownload.&lt;/P&gt;&lt;P&gt;Looks like the web app may need some config stuff&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-survey123-blog/introducing-the-survey123-web-app-javascript-api/ba-p/896667" target="_blank"&gt;https://community.esri.com/t5/arcgis-survey123-blog/introducing-the-survey123-web-app-javascript-api/ba-p/896667&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Not sure I never use the web as my forms are too complicated.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 21:19:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1098675#M37203</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2021-09-15T21:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1211816#M44794</link>
      <description>&lt;P&gt;Thanks for sharing this Doug!&lt;/P&gt;&lt;P&gt;The only issue I was having using this script is it was overwriting manual entries (with the value from the previous repeat) when users were scrolling back through the repeats to review their entries.&lt;BR /&gt;&lt;BR /&gt;To get around this, I put the pulldata in a once() function. Seems to be working smoothly now.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;Ross&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 21:32:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1211816#M44794</guid>
      <dc:creator>RossCampbell3</dc:creator>
      <dc:date>2022-09-12T21:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1261482#M47641</link>
      <description>&lt;P&gt;Hi Ross,&lt;/P&gt;&lt;P&gt;I am looking into doing this as well. I have most of it from reading this thread, but something is still off. Could you post your completed code here?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 24 Feb 2023 17:06:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1261482#M47641</guid>
      <dc:creator>AndrewThompson_SCE</dc:creator>
      <dc:date>2023-02-24T17:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1325084#M51524</link>
      <description>&lt;P&gt;Thanks for sharing this solution &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/16421"&gt;@DougBrowning&lt;/a&gt; ! In my particular situation I needed to calculate the same field for every repeat record in such a way that each value would be unique. Your JS function allows me to look up the previous values without getting stuck in a dependency cycle.&lt;/P&gt;&lt;P&gt;I'm currently using your code as is to get the previous value for every repeat record and then I'm merging these with the XLSForm join function in another field outside of the repeat. Although this works fine, I imagine your function could be adjusted so it does both of these separate actions in one JS function. I haven't had the time to test this yet but calling slice (0, (position-2)) on the fieldname array and then using a join in JS might return the desired result in this case.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2023 14:29:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1325084#M51524</guid>
      <dc:creator>TimeonSchot</dc:creator>
      <dc:date>2023-09-02T14:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1397412#M55568</link>
      <description>&lt;P&gt;Hello! I've gotten this function working for text and integer type questions (it's been a lifesaver), but encounter a glitch when I try to use it on select_one questions. Here is a screenshot of my xlsx setup:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="S123_Error_input.PNG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98342iCC17CF9FFBA07CEF/image-size/large?v=v2&amp;amp;px=999" role="button" title="S123_Error_input.PNG" alt="S123_Error_input.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;Row 36 shows the select_one type question. Although the integer and text questions work correctly (rows 33 and 34), this is what I see when I attempt to select a transponder:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S123_Error.gif" style="width: 649px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/98341i183D1BC17D405C49/image-size/large?v=v2&amp;amp;px=999" role="button" title="S123_Error.gif" alt="S123_Error.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can see that, after clicking several times, the drop-down will appear very quickly, then disappear. Has anyone else encountered this, or am I trying to use the function incorrectly here? Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 17:42:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1397412#M55568</guid>
      <dc:creator>lkline</dc:creator>
      <dc:date>2024-03-18T17:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1408683#M56150</link>
      <description>&lt;P&gt;I am also experiencing this issue! Doug posted it here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-survey123-questions/using-a-javascript-pulldata-in-a-calculate-breaks/m-p/1347394" target="_blank"&gt;Using a JavaScript pulldata in a calculate breaks ... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 18:33:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1408683#M56150</guid>
      <dc:creator>BrookeHehr</dc:creator>
      <dc:date>2024-04-11T18:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1408685#M56151</link>
      <description>&lt;P&gt;I have been trying dozens of ways to get a same as last type button like our old app had for 6 years now and have still not found anything that works.&amp;nbsp; I even have been bugging the team on it but still no solution.&amp;nbsp; So sorry I have no answers for you.&lt;/P&gt;&lt;P&gt;Overall our main complaint from users has been that it is really slow and clunky to collect data in 123.&amp;nbsp; And I agree it is 123s biggest downfall and it just does not seem to have importance in the development.&amp;nbsp; As we seen often in Esri apps is they tend to focus on new shiny things instead of really dialing in the core functions.&amp;nbsp; I hope the next gen really concentrates on data entry speed and true smart forms that can predict the next answer.&amp;nbsp; For example another idea is to have the tablet SQL Lite db track number of times a drop down list item is chosen and sorts by frequency.&amp;nbsp; Would be pretty easy to implement.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Testing out in the field or adding team members that have in the field experience would really help I think.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 18:50:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1408685#M56151</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-04-11T18:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Prepopulate answers in a repeat with last values</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1567247#M60454</link>
      <description>&lt;P&gt;Hi Doug,&lt;/P&gt;&lt;P&gt;I've implemented the function you provided in my own survey (thank you). I am more curious than anything-- why is it [position - 2] and not [position - 1]?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 14:02:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-values/m-p/1567247#M60454</guid>
      <dc:creator>MelDop</dc:creator>
      <dc:date>2024-12-11T14:02:33Z</dc:date>
    </item>
  </channel>
</rss>

