Hi All,I have a custom GP Service. It returns two results (esriGPParameterDirectionOutput) a FeatureSet of points (GPFeatureRecordSetLayer) and a RecordSet (GPRecordSet) of summary statistics about those points. I am successfully able to access and symbolize the points and bring the attributes into a datagrid. I'm not sure, though, how to access the second result. (which will go into a separate datagrid) Here's what I have working so far -- just accessing the point results and displaying them. I left out the code to put the attributes into a datagrid, but that's working, too. protected function gp_jobCompleteHandler(event:GeoprocessorEvent):void
{
if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED)
{
gp.addEventListener(GeoprocessorEvent.GET_RESULT_DATA_COMPLETE, onGetResult);
gp.getResultData(gp.submitJobLastResult.jobId, "Result");
var messages:Array = event.jobInfo.messages;
var count:int = messages.length;
var index:int = count-2;
var message:String = messages[index].description;
statusArea.appendText(message + "\n");
statusArea.appendText("Drawing result graphics..." + "\n");
}
else
{
var messages1:Array = event.jobInfo.messages;
var count1:int = messages1.length;
var index1:int = count1-4;
var message1:String = messages1[index1].description;
statusArea.appendText(message + "\n");
Alert.show("Geoprocessing Error:\n" + message1);
}
}and then: protected function onGetResult(event : GeoprocessorEvent) : void
{
myGraphicsLayer.renderer = ResultRenderer();
var pv:ParameterValue = event.parameterValue;
fs = new FeatureSet;
fs = pv.value as FeatureSet;
for each(var graphic:Graphic in fs.features)
{
graphic.addEventListener(MouseEvent.CLICK, graphic_clickHandler);
graphic.addEventListener(MouseEvent.DOUBLE_CLICK, graphic_doubleClickHandler)
myGraphicsLayer.add(graphic);
}
map.addLayer(myGraphicsLayer);
var resultAttribute:Array = fs.attributes;
resultAttributes= new ArrayCollection(resultAttribute);
CursorManager.removeBusyCursor();
}Here's what I'm trying to do: protected function gp_jobCompleteHandler(event:GeoprocessorEvent):void
{
if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED)
{
gp.addEventListener(GeoprocessorEvent.GET_RESULT_DATA_COMPLETE, onGetResult);
gp.getResultData(gp.submitJobLastResult.jobId, "Result");
gp.getResultData(gp.submitJobLastResult.jobId, "SummaryStats");
var messages:Array = event.jobInfo.messages;
var count:int = messages.length;
var index:int = count-2;
var message:String = messages[index].description;
statusArea.appendText(message + "\n");
statusArea.appendText("Drawing result graphics..." + "\n");
}
else
{
var messages1:Array = event.jobInfo.messages;
var count1:int = messages1.length;
var index1:int = count1-4;
var message1:String = messages1[index1].description;
statusArea.appendText(message + "\n");
Alert.show("Geoprocessing Error:\n" + message1);
}
}and then: protected function onGetResult(event : GeoprocessorEvent) : void
{
myGraphicsLayer.renderer = ResultRenderer();
var pv:ParameterValue = event.parameterValue;
var pv2:ParameterValue = event.parameterValue; // This seems wrong -- how do I tell it to take the second of the output parameters?
fs = new FeatureSet;
fs = pv.value as FeatureSet;
rs = new RecordSet; // This doesn't work. "RecordSet" isn't an option
rs = pv2.value as RecordSet; // This obviously doesn't work either
for each(var graphic:Graphic in fs.features)
{
graphic.addEventListener(MouseEvent.CLICK, graphic_clickHandler);
graphic.addEventListener(MouseEvent.DOUBLE_CLICK, graphic_doubleClickHandler)
myGraphicsLayer.add(graphic);
}
map.addLayer(myGraphicsLayer);
var resultAttribute:Array = fs.attributes;
resultAttributes= new ArrayCollection(resultAttribute);
var sumStatsAttribute = rs.attributes; // This obviously isn't working since 'rs' isn't working
sumStatsAttributes = new ArrayCollection(sumStatsAttribute);
CursorManager.removeBusyCursor();
}Do I need a separate event listener for the SummaryStats table? As always, any advice would be greatly appreciated.Thanks,-Erik