Select to view content in your preferred language

Geoprocessing Parameters from a feature layer

2684
2
Jump to solution
01-31-2014 12:21 PM
ionarawilson1
Deactivated User
My gp has two inputs that are two features. One is a selected of a feature layer and the other is all features of the same feature layer.  A similar gp works fine in javascript but I get an error in Flex. Can anybody tell me how to get the parameters from a feature layer? Thanks

This is the error I got when I select the feature and then click the button to run the gp:


[RPC Fault faultString="Error performing execute operation" faultCode="500" faultDetail=""

 private function calculalteplanind():void     {      var  SelectingFeature:FeatureSet = new FeatureSet();   SelectingFeature.features = myFeatureLayerstewardship.selectedFeatures    var features:ArrayCollection = ArrayCollection(myFeatureLayerstewardship.graphicProvider);   var featureSet:FeatureSet = new FeatureSet(features.source);      Alert.show ("GP RUNNING")   var params:Object  = {    "Selecting_Features": SelectingFeature,    "Stewardship": featureSet   }         gp.execute(params, new AsyncResponder( onResult, onFault ));   function onResult(gpResult:ExecuteResult = null, token:Object = null):void   {     Alert.show("YAY")   }   function onFault(info:Object, token:Object = null):void   {    Alert.show(info.toString());      }    }                     <esri:Geoprocessor id="gp"      useAMF="false"     outSpatialReference="{myMap.spatialReference}"    processSpatialReference="{myMap.spatialReference}"      url="http://tfsgis-iisd01:6080/arcgis/rest/services/TwoParametersWithSelection2/GPServer/CalcFeaturesStewardshipOneParameterSelection"  />       
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ionarawilson1
Deactivated User
I got it working:

   private function calculalteplanid():void     {      var  SelectingFeature:FeatureSet = new FeatureSet();   SelectingFeature.features = myFeatureLayerstewardship.selectedFeatures  SelectingFeature.fields = myFeatureLayerstewardship.layerDetails.fields      var features:ArrayCollection = ArrayCollection(myFeatureLayerstewardship.graphicProvider);   var featureSet:FeatureSet = new FeatureSet(features.source);  // var featureSet:FeatureSet = new FeatureSet(features.toArray())     featureSet.fields = myFeatureLayerstewardship.layerDetails.fields    var params:Object  = {    "Selecting_Features": SelectingFeature,    "Stewardship": featureSet   }       var geoprocessTask:Geoprocessor = new Geoprocessor();   geoprocessTask.outSpatialReference = myMap.spatialReference;         geoprocessTask.url = "http://tfsgis-iisd01:6080/arcgis/rest/services/TwoParametersWithSelection2/GPServer/CalcFeaturesStewardshipOneParameterSelection";      geoprocessTask.submitJob(params, null, null);      geoprocessTask.addEventListener(GeoprocessorEvent.JOB_COMPLETE,jobCompleteHandler);      geoprocessTask.addEventListener(FaultEvent.FAULT, faultHandler2);    }    

View solution in original post

0 Kudos
2 Replies
ionarawilson1
Deactivated User
Can anybody help me? I think the problem is with the entire feature layer, this part:

var featureSet:FeatureSet = new FeatureSet(myFeatureLayerstewardship.featureCollection.featureSet.attributes)

As nothing is executed after this line. How can I obtain the features of the feature layer?

private function calculalteplanind():void
  
 {
  
    var  SelectingFeature:FeatureSet =  new FeatureSet(myFeatureLayerstewardship.selectedFeatures);
   
    var featureSet:FeatureSet = new FeatureSet(myFeatureLayerstewardship.featureCollection.featureSet.attributes);
  
    var params:Object = {
     "Selecting_Features": SelectingFeature,
     "Stewardship": featureSet
    };
   
    gp.submitJob(params, new AsyncResponder( onResult, onFault ));
   
    function onResult(gpResult:ExecuteResult = null, token:Object = null):void
    {
     
    }
    function onFault(info:Object, token:Object = null):void
    {
     
     
    }
   
 
 }
0 Kudos
ionarawilson1
Deactivated User
I got it working:

   private function calculalteplanid():void     {      var  SelectingFeature:FeatureSet = new FeatureSet();   SelectingFeature.features = myFeatureLayerstewardship.selectedFeatures  SelectingFeature.fields = myFeatureLayerstewardship.layerDetails.fields      var features:ArrayCollection = ArrayCollection(myFeatureLayerstewardship.graphicProvider);   var featureSet:FeatureSet = new FeatureSet(features.source);  // var featureSet:FeatureSet = new FeatureSet(features.toArray())     featureSet.fields = myFeatureLayerstewardship.layerDetails.fields    var params:Object  = {    "Selecting_Features": SelectingFeature,    "Stewardship": featureSet   }       var geoprocessTask:Geoprocessor = new Geoprocessor();   geoprocessTask.outSpatialReference = myMap.spatialReference;         geoprocessTask.url = "http://tfsgis-iisd01:6080/arcgis/rest/services/TwoParametersWithSelection2/GPServer/CalcFeaturesStewardshipOneParameterSelection";      geoprocessTask.submitJob(params, null, null);      geoprocessTask.addEventListener(GeoprocessorEvent.JOB_COMPLETE,jobCompleteHandler);      geoprocessTask.addEventListener(FaultEvent.FAULT, faultHandler2);    }    
0 Kudos