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:https://developers.arcgis.com/flex/sample-code/asynchronous-geoprocessing.htmThe 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).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. 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: if (results != null && myresults.records != null) { var records:Array = results.records; buildMyString(records); var recordsList:ArrayList = new ArrayList(records); dgResults.dataProvider = recordsList; showStateResults(); }
This was the URL of the last request : http://<servername>/arcgis/rest/services/Geoprocessing_Services/MyService/GPServer/MyScript/jobs/<jobid>/results/myresults?f=json&returnType=dataThe data returned by the service looks like this:{"paramName":"myresults","dataType":"GPString","value":{"records": [{"layer": "Wolves", "value": "-999"}, {"layer": "Coyotes", "value": "-999"}, {"layer": "Dingos", "value": "5.44373945354"}]}}The relevant portions of the code are: <esri:Geoprocessor id="generateStatsGP" url="{genURL}" fault="gp_faultHandler(event)" getResultDataComplete="gp_getResultDataCompleteHandler(event)" jobComplete="gp_jobCompleteHandler(event)" outSpatialReference="{map.spatialReference}" useAMF="false"/> var params:Object = {"f":"json", "location":geomJSON, "locationtype":geomType,"units": distanceUnits.toUpperCase()}; generateStatsGP.submitJob(params); CursorManager.setBusyCursor(); private function gp_getResultDataCompleteHandler(event:GeoprocessorEvent):void { Output = event.parameterValue.value; if (event.parameterValue.paramName == "myresults") { //Why doesn't this work? Alert.show("Yes Virginia, paramName is myresults!"); } if (event.parameterValue.value != null) { //Why doesn't this work? Alert.show("parameterValue.value is not null"); } CursorManager.removeBusyCursor(); } private function gp_jobCompleteHandler(event:GeoprocessorEvent):void { if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED) { generateStatsGP.getResultData(generateStatsGP.submitJobLastResult.jobId, "myresults"); } else { Alert.show(event.jobInfo.jobStatus); CursorManager.removeBusyCursor(); } }
Thanks!!