Hi,
I'm attempting to publish a toolbox to ArcGIS Server. The toolbox contains a model and a custom python script. The model calls the script. It runs fine in the desktop but when I publish as a service I'm given a code 500 Error Executing Task. Error executing tool.
My model takes a featureset as a parameter which can have different fields each time. My end goal is to run an intersect against this featureset and add up the values of a field for all intersecting features.
My model works as follows:
Make a feature layer from the featureset -> select features that intersect with another layer -> save the selection to my scratchworkspace > run summary statistics using my python script
I need the script because I don't know what the field is going to be called. The field name is also a parameter to the model. My script does the following:
Input_features = arcpy.GetParameterAsText(0)
Input_metric = arcpy.GetParameterAsText(1)
Output_table = "GetFieldValue.dbf"
arcpy.Statistics_analysis(Input_features, Output_table, [[Input_metric, "SUM"]])
arcpy.SetParameterAsText(1, Output_table)
As i say this works fun in ArcGIS desktop. My script has 3 parameters:
Input_features - FeatureSet
Input_metric - String
Output_table - Table or String - fails either way!
I'm dubious about this last output as appreciate I declare Output_table as a string above.
Anyhow, I publish the whole lot storing relative path names for both model and script. I set it to run synchronously and to run python script in progress.
My js code calls the service as follows:
var metric = "METRIC_1"
// setup params and execute
var params = {
"Buffers" : bufferFeatureSet,
"Metrics" : metricsFeatureSet,
"Input_metric": metric
};
gpIntersects.execute(params, handleGpIntersectSuccess, handleQueryError);
I land at handleQueryError every time!
Has anyone got any suggestions or advice as I'm struggling....