<?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: Problem with JavaScript PullData function and web form in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303736#M50296</link>
    <description>&lt;P&gt;Hi. Sorry to inform: This is a known limitation of the web app. &lt;A href="https://doc.arcgis.com/en/survey123/desktop/create-surveys/pulldatajavascript.htm#ESRI_SECTION1_8A776E388E3047BAA705F2ADC5E5F0D5" target="_blank" rel="noopener"&gt;Read this help topic for details&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IsmaelChivite_0-1687925092046.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74331i2E48A3663CC5D0CF/image-size/large?v=v2&amp;amp;px=999" role="button" title="IsmaelChivite_0-1687925092046.png" alt="IsmaelChivite_0-1687925092046.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2023 04:05:12 GMT</pubDate>
    <dc:creator>IsmaelChivite</dc:creator>
    <dc:date>2023-06-28T04:05:12Z</dc:date>
    <item>
      <title>Problem with JavaScript PullData function and web form</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303369#M50277</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a JavaScript script/function that identifies which record within a repeat has the most recent date and returns the 'number' of that repeat.&amp;nbsp; That number is then used elsewhere to bring back another date value from that repeat record to populate a field in the survey's main table.&lt;/P&gt;&lt;P&gt;In the field app this all works perfectly, but when I view it in the web form version it doesn't.&amp;nbsp; From what I can see it it returns the number of the repeat as '6' or '9' (depending on the date value) even when there aren't anywhere near that number of records with the repeat.&lt;/P&gt;&lt;P&gt;I know there are limitations with using JavaScript within the web form, so I was wondering:&lt;/P&gt;&lt;P&gt;1) Is this one of the limitations (and if so what actual is the nature of the limitation I'm seeing)?&lt;/P&gt;&lt;P&gt;2) If it isn't one of the limitations, what am I doing wrong?&amp;nbsp; Is there a solution/better way to do this?&lt;/P&gt;&lt;P&gt;I've attached a version of my .xlsx and the script is as below.&amp;nbsp; I'm logged in when I'm running this and I'm also a beginner with using JavaScript so may not be understanding things properly.&lt;/P&gt;&lt;P&gt;Any help anyone can offer would be hugely appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*&lt;/P&gt;&lt;P&gt;* JavaScript functions for Survey123&lt;/P&gt;&lt;P&gt;*/&lt;/P&gt;&lt;P&gt;function indexMax(fieldname){&lt;/P&gt;&lt;P&gt;var maxValue = fieldname[0];&lt;/P&gt;&lt;P&gt;var maxIndex = 0;&lt;/P&gt;&lt;P&gt;for (var i =1; i&amp;lt;fieldname.length; i++){&lt;/P&gt;&lt;P&gt;if (fieldname[i]&amp;gt;maxValue){&lt;/P&gt;&lt;P&gt;maxIndex = i;&lt;/P&gt;&lt;P&gt;maxValue = fieldname[i];&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return maxIndex;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 13:33:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303369#M50277</guid>
      <dc:creator>ColinCampbell1</dc:creator>
      <dc:date>2023-06-27T13:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JavaScript PullData function and web form</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303736#M50296</link>
      <description>&lt;P&gt;Hi. Sorry to inform: This is a known limitation of the web app. &lt;A href="https://doc.arcgis.com/en/survey123/desktop/create-surveys/pulldatajavascript.htm#ESRI_SECTION1_8A776E388E3047BAA705F2ADC5E5F0D5" target="_blank" rel="noopener"&gt;Read this help topic for details&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IsmaelChivite_0-1687925092046.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/74331i2E48A3663CC5D0CF/image-size/large?v=v2&amp;amp;px=999" role="button" title="IsmaelChivite_0-1687925092046.png" alt="IsmaelChivite_0-1687925092046.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 04:05:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303736#M50296</guid>
      <dc:creator>IsmaelChivite</dc:creator>
      <dc:date>2023-06-28T04:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JavaScript PullData function and web form</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303799#M50301</link>
      <description>&lt;P&gt;Ah that's good to know.&amp;nbsp; Many thanks for replying - and all your hard work on Survey123 - it's much appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 07:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-javascript-pulldata-function-and-web/m-p/1303799#M50301</guid>
      <dc:creator>ColinCampbell1</dc:creator>
      <dc:date>2023-06-28T07:44:02Z</dc:date>
    </item>
  </channel>
</rss>

