Unable to pass value to GPRecordSet object.
Hi , I have a gp task which requires input as a GPREcordset object .
Details for input parameter from rest end point
Parameter: record_set
Data Type: GPRecordSet
Display Name: record_set
Direction: esriGPParameterDirectionInput
Default Value:
Fields:
OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
Add_line (Type: esriFieldTypeString, Alias: Add_line)
state (Type: esriFieldTypeString, Alias: state)
city (Type: esriFieldTypeString, Alias: city)
zip (Type: esriFieldTypeString, Alias: zip)
zip_4 (Type: esriFieldTypeString, Alias: zip_4)
Parameter Type: esriGPParameterTypeRequired
I need to create this GPRecordset object in javascript to pass it to the GP task
Code snipplet
I tried
feature_set = {
"features" :
[
{
"attributes" : {"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}
},
{
"attributes" : {"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}
}
]
};
var featureSet = new esri.tasks.FeatureSet(feature_set);
var params = {"record_set":featureSet};
gp.submitJob(params, completeUploadCallback , statusUploadCallback,errorAlert);
The job is successfully submitted , but as soon as it goes to the arcgis server , it fails . I m able to run the geoprocessing service thru ArcMap by passing the features interactively but I m not able to properly set the FeatureSet object in javascript.
How can a GPRecordSet object be created for an input to geoprocessing service and passed through Javascript ?
Look at the ESRI sample: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/gp_clipasync.html. The only difference is that the GPRecordSet is equivalent to JS API FeatureSet without geometry. For example, if you do a querytask with Query.retureGeometry =false, the result is equivalent to GPRecordSet.
Hi ,
Thnx for your help . i saw the sample and understand GPRecordSet is a featureset object without geometry. My challenge is , i read a file and am trying to create featureset object with the data from the file .
i.e Manually creating featureset object . Saw the featureSet API and that is what i m trying to create
feature_set = {
"features" :
[
{
"attributes" : {"OBJECTID":1,"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}
},
{
"attributes" : {"OBJECTID":2,"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}
}
]
};
var featureSet = new esri.tasks.FeatureSet(feature_set);
i just need some help in knowing whether what i m doing is correct way to create a FeatureSet object or if i m missing something?
var features =[]; var feature1=new Graphic(); feature2.setAttributes({"OBJECTID":1,"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}); features.push(feature1); var feature1=new Graphic(); feature2.setAttributes {"OBJECTID":2,"Add_line":"303 Kulana St","state":"HI","city":"Hilo","zip":"96720","zip_4":"2266"}); features.push(feature2); var featureSet = new esri.tasks.FeatureSet(); featureSet.features = features;