Return value from Python-Tool to geoprocessor.getResultData

08-09-2017 05:31 AM
New Contributor


A js-api-script is calling an asynchronous ArcGis-Server-Geoprocessing-Service:

           gp = new Geoprocessor(<url>/GPServer/...");
           gp.submitJob(params, completeCallback, statusCallback, jobFailed);

The Geoprocessing-Service executes the Tool "Calculate Value", which contains a Python script.

What is the way to send the return-value (String) of the Python-Script back to the completeCallback-Function on Client?

gp.getResultData seems to be the wrong way.

Or is there any other posibility to get Access to the return-value in the js ?

Thanks, Chris


0 Kudos
1 Reply
New Contributor III

You probably have the answer already, but for those who have run into this problem, before you publish the ArcPy script as a geoprocessing service, in the parameter section where you set up the different data values as input, you also need to add parameters and set them up as outputs.

When you have values that you want to pass them to the geoprocessor tax in your web app, set the output parameters using arcpy.SetParameterAsText(index, value).

Once you publish the geoprocessing service, the outputs will be saved as part of the geoprocessing job which can then be accessed by .getResultData().