<?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: Get result from asynchronous geoprocessing task in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2839#M52</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Q: Are you two event handlers [gp_jobCompleteHandler | gp_getResultDataCompleteHandler ] getting called at all?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Jun 2014 12:35:19 GMT</pubDate>
    <dc:creator>JordanBaumgardner</dc:creator>
    <dc:date>2014-06-16T12:35:19Z</dc:date>
    <item>
      <title>Get result from asynchronous geoprocessing task</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2838#M51</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using this asynchronous geoprocessing task example to rewrite an existing Flex widget to use a geoprocessing service instead of a non-ESRI REST service:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/flex/sample-code/asynchronous-geoprocessing.htm" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/flex/sample-code/asynchronous-geoprocessing.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The geoprocessing task submits successfully and according to Fiddler, the service returned the correct data in single output parameter named "myresults" which is a string (containing json data).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point, Flex just hangs with a busy cursor apparently in gp_getResultDataCompleteHandler() because everything I have tried using event.parameterValue to get the result from the service has failed. Even just a plain Alert.show with event.parameterValue seems to be ignored.&amp;nbsp; Can anyone tell me how to get the service result from the parameter and stuff it into an array so that I can then do something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results != null &amp;amp;&amp;amp; myresults.records != null) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var records:Array = results.records; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buildMyString(records); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var recordsList:ArrayList = new ArrayList(records); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dgResults.dataProvider = recordsList; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showStateResults(); &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;This was the URL of the last request : &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;servername&amp;gt;/arcgis/rest/services/Geoprocessing_Services/MyService/GPServer/MyScript/jobs/&amp;lt;jobid&amp;gt;/results/myresults?f=json&amp;amp;returnType=data&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The data returned by the service looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{"paramName":"myresults","dataType":"GPString","value":{"records": [{"layer": "Wolves", "value": "-999"}, {"layer": "Coyotes", "value": "-999"}, {"layer": "Dingos", "value": "5.44373945354"}]}}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The relevant portions of the code are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; &amp;lt;esri:Geoprocessor id="generateStatsGP" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url="{genURL}" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fault="gp_faultHandler(event)" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getResultDataComplete="gp_getResultDataCompleteHandler(event)" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jobComplete="gp_jobCompleteHandler(event)" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outSpatialReference="{map.spatialReference}" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; useAMF="false"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var params:Object = {"f":"json", "location":geomJSON, "locationtype":geomType,"units": distanceUnits.toUpperCase()}; &amp;nbsp;&amp;nbsp;&amp;nbsp; generateStatsGP.submitJob(params); &amp;nbsp;&amp;nbsp;&amp;nbsp; CursorManager.setBusyCursor();&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; private function gp_getResultDataCompleteHandler(event:GeoprocessorEvent):void &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Output = event.parameterValue.value; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (event.parameterValue.paramName == "myresults") &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Why doesn't this work? &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show("Yes Virginia, paramName is myresults!"); &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; if (event.parameterValue.value != null) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Why doesn't this work? &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show("parameterValue.value is not null"); &amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; CursorManager.removeBusyCursor(); &amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; private function gp_jobCompleteHandler(event:GeoprocessorEvent):void &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; generateStatsGP.getResultData(generateStatsGP.submitJobLastResult.jobId, "myresults"); &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; else &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show(event.jobInfo.jobStatus); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CursorManager.removeBusyCursor(); &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Jun 2014 05:48:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2838#M51</guid>
      <dc:creator>NeoGeo</dc:creator>
      <dc:date>2014-06-14T05:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get result from asynchronous geoprocessing task</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2839#M52</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Q: Are you two event handlers [gp_jobCompleteHandler | gp_getResultDataCompleteHandler ] getting called at all?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 12:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2839#M52</guid>
      <dc:creator>JordanBaumgardner</dc:creator>
      <dc:date>2014-06-16T12:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get result from asynchronous geoprocessing task</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2840#M53</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have confirmed that the getresultdata inside of the gp_jobCompleteHandler() executes, and see the gp results (the json string) when monitoring it in Fiddler.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also added a breakpoint inside of gp_getResultDataCompleteHandler() and confirmed that it also executes and all of the data is there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2014 18:30:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2840#M53</guid>
      <dc:creator>NeoGeo</dc:creator>
      <dc:date>2014-06-16T18:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get result from asynchronous geoprocessing task</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2841#M54</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I could not find anything in the ESRI docs past getting the job id, but using the debugger and breakpoints was able to see the object structure and figure it out.&amp;nbsp; There was still some weirdness that just suddenly disappeared when I started deleting some comments and junk almost like the problems you get when you end up with invisible characters in xml files, so I may never know what exactly caused that, but pretty much the same code worked.&amp;nbsp; This is what I ended up with to get the data from the parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp; private function gp_getResultDataCompleteHandler(event:GeoprocessorEvent):void &amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; if (event.parameterValue.value != null &amp;amp;&amp;amp; event.parameterValue.value.records !=null) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var records:Array = event.parameterValue.value.records; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buildMyString(records); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var recordsList:ArrayList = new ArrayList(records); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dgResults.dataProvider = recordsList; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showStateResults(); &amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; clearMessage(); &amp;nbsp;&amp;nbsp;&amp;nbsp; CursorManager.removeBusyCursor(); &amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 03:36:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/get-result-from-asynchronous-geoprocessing-task/m-p/2841#M54</guid>
      <dc:creator>NeoGeo</dc:creator>
      <dc:date>2014-06-17T03:36:07Z</dc:date>
    </item>
  </channel>
</rss>

