Select to view content in your preferred language

Getting results from submitJob

727
1
07-09-2011 02:07 AM
francescodi_vito
Deactivated User
hy guys
i have to help.
I have more problems to get results from submitJob for my Asynchronous GP that i configured in a custom widget of FlexViewer.
I post here a code with URL of my GP Service so if you want to see and try it
<fx:Script>
  <![CDATA[
   import com.esri.ags.FeatureSet;
   import com.esri.ags.Graphic;
   import com.esri.ags.SpatialReference;
   import com.esri.ags.events.GeoprocessorEvent;
   import com.esri.ags.events.GraphicsLayerEvent;
   import com.esri.ags.events.MapMouseEvent;
   import com.esri.ags.geometry.Geometry;
   import com.esri.ags.symbols.SimpleFillSymbol;
   import com.esri.ags.symbols.SimpleLineSymbol;
   import com.esri.ags.symbols.SimpleMarkerSymbol;
   import com.esri.ags.tasks.Geoprocessor;
   import com.esri.ags.tasks.supportClasses.ParameterValue;
   
   import mx.controls.Alert;
   import mx.rpc.AsyncResponder;
   import mx.rpc.events.FaultEvent;

   
   private function startGeoProcess(event:MouseEvent):void
   {
    
    
    var parms:Object = new Object();
    parms.valore = String(numberOfDays.text);
    
    
    var geoprocessTask:Geoprocessor = new Geoprocessor();
    geoprocessTask.outSpatialReference = map.spatialReference;
    geoprocessTask.showBusyCursor = true;
    geoprocessTask.url = "http://193.204.163.134/ArcGIS/rest/services/ENEA_Sondaggi_iniziali/Ricerca_Lito_Carg/GPServer/RicercaCarg";
    geoprocessTask.useAMF = false;
    geoprocessTask.submitJob(parms);
    geoprocessTask.addEventListener(GeoprocessorEvent.JOB_COMPLETE, onJobComplete);
    
   }
   
   private function onFault(fe:FaultEvent, token:Object = null):void
   {
    Alert.show(fe.toString());
   }
   
   private function onJobComplete(event:GeoprocessorEvent):void
   { 
    var geoprocessTask:Geoprocessor = new Geoprocessor();
    geoprocessTask.addEventListener(GeoprocessorEvent.GET_RESULT_DATA_COMPLETE, onGetResult);
    geoprocessTask.getResultData(event.jobInfo.jobId, "jd26fbe9c6f97470592e698b05067865e");
    
     
   }

   
   private function onGetResult(event:GeoprocessorEvent):void
   {
    var myGraphicsLayer:GraphicsLayer = new GraphicsLayer();
    var myPointSymbol:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, 0x1AA1D3, 0.2);
    var pv:ParameterValue = event.parameterValue;
    var fs:FeatureSet = pv.value as FeatureSet;
    
     for each(var graphic:Graphic in fs.features)
     {
      
      myGraphicsLayer.add(graphic);
      graphic.symbol = myPointSymbol;
      graphicsLayer.add(graphic);
      map.addLayer(graphicsLayer);
     }
     
   
    
   
  
   }
  ]]>
 </fx:Script>
 
 <fx:Declarations>
  <esri:GraphicsLayer id="graphicsLayer"/>
 </fx:Declarations>
 
 
 <viewer:WidgetTemplate id="helloWorld"
         width="351" height="170">
  
  <s:Label text="RICERCA LITOLOGIA INTERPRETATA SECONDO VDI" y="10" horizontalCenter="0"/>
  
  <s:TextInput id="numberOfDays"
      width="228"
      paddingLeft="0"
      paddingRight="0"
      text="'SABBIA SATURA'" horizontalCenter="0" textAlign="center" y="50"/>
  <s:Label text="inserisci litologia" y="30" horizontalCenter="0"/>
  <s:Button 
   label="Ricerca" 
   click="startGeoProcess(event)"
   bottom="5" left="10" cornerRadius="7"/>
  <s:Button 
   label="Clear" 
   click="graphicsLayer.clear()"
   bottom="5" right="9" cornerRadius="7"/>
  
 </viewer:WidgetTemplate>
</viewer:BaseWidget>

Robert Scheitlin say me that my result is a Image but i don't try to configure the script for the result.
Please help me it's very important
Tags (2)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus
Francesco,

   It does not have anything to go with the flex portion of the code. You need to look at the model or script that you are publishing that is where the output is determined.
0 Kudos