<?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 Issue with callbacks while uploading multiple graphics to &amp;quot;apply edits&amp;quot; inside of For Loop in JS API 3.23 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/issue-with-callbacks-while-uploading-multiple/m-p/588576#M55004</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have 2 feature layers added in my map:1 point layer(coming from Mapservice) and 1 polygon feature layer(Which is coming from feature service). I would like to upload the polygon geometries build up from Json to associated point feature. so Point ID will be stored in associated polygon geometries and it will get passed to apply edits call. I am following below mentioned steps:&lt;/P&gt;&lt;P&gt;1. build featureset from input JSON&lt;/P&gt;&lt;P&gt;2.Loop featureset ,Inside of "for loop", taking one feature at a time, checking if it's geometry is associated with point geometry which is selected on map(checking if point geometry is inside of polygon geometry)&lt;/P&gt;&lt;P&gt;3. if step&amp;nbsp;2 is successful, pass that feature to "apple edit" BUT Apply edit is async call and taking it's own time and loop is not getting executed for all the feature geometries &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;4. If I put break point at Callback function from "apply edit calls" is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Relevant code:--------------&lt;/P&gt;&lt;P&gt;if (featureSet &amp;amp;&amp;amp; featureSet.features &amp;amp;&amp;amp; selectedResource) {&lt;BR /&gt; //To-do:check if resource point is inside of outline geometry&lt;BR /&gt; &lt;BR /&gt; for (var i = 0; i &amp;lt; featureSet.features.length; i++) {&lt;BR /&gt; featureSet.features&lt;I&gt;.attributes["additionalinformation"] = selectedResourceID;&lt;BR /&gt; var attribs = featureSet.features&lt;I&gt;.attributes;&lt;BR /&gt; &lt;BR /&gt; featureSet.features&lt;I&gt;.spatialReference = featureSet.spatialReference;&lt;BR /&gt;boolContains = IfContains(featureSet.features&lt;I&gt;, selectedResource)&lt;BR /&gt; if (boolContains) {&lt;BR /&gt; var wgs84 = new esri.geometry.Polygon(featureSet.features&lt;I&gt;.geometry);&lt;BR /&gt; var graphic = new esri.Graphic(wgs84, symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,&lt;BR /&gt; new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,&lt;BR /&gt; new Color([112, 112, 112]), 1), new Color([136, 136, 136, 0.25])), attribs);&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;if (graphic.geometry == null) {&lt;BR /&gt; console.log("Graphic geometry is null");&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//Apply Edit call&lt;BR /&gt; OutlineLayer.applyEdits([graphic], null, null).&lt;EM&gt;&lt;STRONG&gt;then(function (addResults, updateResults, deleteResults)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt; { alert('Addsuccess', addResults); }).then(function (error)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt; { console.log('error: '+ error); });&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt; OutlineLayer.on("edits-complete", onComplete);&lt;BR /&gt; featureSet.features.clear();&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt; alert("Browsed Outline is not associated with the selected resource geometry");&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;in above code, I have formatted(Bold and Italic) the callback function with addResults, update and.. How to ensure in this function that loop is getting honored and one by one feature will get uploaded via apply edits?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with ArcGIS JS API 3.23.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Apr 2018 06:06:29 GMT</pubDate>
    <dc:creator>AmrutaBildikar</dc:creator>
    <dc:date>2018-04-18T06:06:29Z</dc:date>
    <item>
      <title>Issue with callbacks while uploading multiple graphics to "apply edits" inside of For Loop in JS API 3.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/issue-with-callbacks-while-uploading-multiple/m-p/588576#M55004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have 2 feature layers added in my map:1 point layer(coming from Mapservice) and 1 polygon feature layer(Which is coming from feature service). I would like to upload the polygon geometries build up from Json to associated point feature. so Point ID will be stored in associated polygon geometries and it will get passed to apply edits call. I am following below mentioned steps:&lt;/P&gt;&lt;P&gt;1. build featureset from input JSON&lt;/P&gt;&lt;P&gt;2.Loop featureset ,Inside of "for loop", taking one feature at a time, checking if it's geometry is associated with point geometry which is selected on map(checking if point geometry is inside of polygon geometry)&lt;/P&gt;&lt;P&gt;3. if step&amp;nbsp;2 is successful, pass that feature to "apple edit" BUT Apply edit is async call and taking it's own time and loop is not getting executed for all the feature geometries &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;4. If I put break point at Callback function from "apply edit calls" is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Relevant code:--------------&lt;/P&gt;&lt;P&gt;if (featureSet &amp;amp;&amp;amp; featureSet.features &amp;amp;&amp;amp; selectedResource) {&lt;BR /&gt; //To-do:check if resource point is inside of outline geometry&lt;BR /&gt; &lt;BR /&gt; for (var i = 0; i &amp;lt; featureSet.features.length; i++) {&lt;BR /&gt; featureSet.features&lt;I&gt;.attributes["additionalinformation"] = selectedResourceID;&lt;BR /&gt; var attribs = featureSet.features&lt;I&gt;.attributes;&lt;BR /&gt; &lt;BR /&gt; featureSet.features&lt;I&gt;.spatialReference = featureSet.spatialReference;&lt;BR /&gt;boolContains = IfContains(featureSet.features&lt;I&gt;, selectedResource)&lt;BR /&gt; if (boolContains) {&lt;BR /&gt; var wgs84 = new esri.geometry.Polygon(featureSet.features&lt;I&gt;.geometry);&lt;BR /&gt; var graphic = new esri.Graphic(wgs84, symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,&lt;BR /&gt; new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,&lt;BR /&gt; new Color([112, 112, 112]), 1), new Color([136, 136, 136, 0.25])), attribs);&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;if (graphic.geometry == null) {&lt;BR /&gt; console.log("Graphic geometry is null");&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//Apply Edit call&lt;BR /&gt; OutlineLayer.applyEdits([graphic], null, null).&lt;EM&gt;&lt;STRONG&gt;then(function (addResults, updateResults, deleteResults)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt; { alert('Addsuccess', addResults); }).then(function (error)&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt; { console.log('error: '+ error); });&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt; OutlineLayer.on("edits-complete", onComplete);&lt;BR /&gt; featureSet.features.clear();&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt; alert("Browsed Outline is not associated with the selected resource geometry");&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;---------------------------&lt;/P&gt;&lt;P&gt;in above code, I have formatted(Bold and Italic) the callback function with addResults, update and.. How to ensure in this function that loop is getting honored and one by one feature will get uploaded via apply edits?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with ArcGIS JS API 3.23.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2018 06:06:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/issue-with-callbacks-while-uploading-multiple/m-p/588576#M55004</guid>
      <dc:creator>AmrutaBildikar</dc:creator>
      <dc:date>2018-04-18T06:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with callbacks while uploading multiple graphics to "apply edits" inside of For Loop in JS API 3.23</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/issue-with-callbacks-while-uploading-multiple/m-p/588577#M55005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way I've worked with applyEdits, I've used the callback and errback as parameters in the call itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;OutlineLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;applyEdits&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;graphic&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;addResults&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; updateResults&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; deleteResults&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;alert&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Addsuccess'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; addResults&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; 
&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'error: '&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; 
&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:17:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/issue-with-callbacks-while-uploading-multiple/m-p/588577#M55005</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-12T01:17:08Z</dc:date>
    </item>
  </channel>
</rss>

