I have created a simple Geoprocessing tool using a Python script that works fine in my ArcMap 10.5.1 session, but when I publish it to a Geoprocessing Service on our ArcGIS Server and bring it back in as Tool in ArcMap, it runs, but doesn't calculate the field of the selected features. Any thoughts would be great. Thanks
This is the Python code:
import arcpy
fc = arcpy.GetParameterAsText(0)
Shift = arcpy.GetParameterAsText(1)
arcpy.AddMessage("Calculating Shift")
output = arcpy.CalculateField_management(in_table=fc, field="SHIFT", expression='"{}"'.format(Shift), expression_type="PYTHON")
This is a screenshot of the Geoprocessing Tool I have created. I have also tried Feature Set as a Data Type.
This is a screenshot of the Server Messages:
Solved! Go to Solution.
Geoprocessing services are not going to directly manipulate data on your client.
Most, but not all, geoprocessing tools take input data and return newly created output data. These geoprocessing tools lend themselves to geoprocessing services because data is uploaded to the service, it is processed, and then a new data set is returned to the client. For geoprocessing tools that operate on data directly, additional steps are required to get the data back to the client.
Regardless of which kind of geoprocessing tools are being used in a script or model and published as a geoprocessing service, the script needs to be configured and written to have output parameters just like input parameters. From your screenshots, you don't appear to have any output parameters, so there is no way for the geoprocessing service to return the updated table back to your client.
I think it is calculating on a temporary feature layer in memory. Not updating a feature class in a db.
Yes, I just don't know how to make it update the FC.
Surely the data type should be a feature class
From the look of your screenshot, the geoprocessing service is getting the data and updating it, but the data isn't being returned back to you because your geoprocessing tool isn't configured to supply an output data source.
Hi Joshua, thanks for your reply. The output data source is always just the same as the input data source for Calculate Fields. I am not sure how to do this.
Geoprocessing services are not going to directly manipulate data on your client.
Most, but not all, geoprocessing tools take input data and return newly created output data. These geoprocessing tools lend themselves to geoprocessing services because data is uploaded to the service, it is processed, and then a new data set is returned to the client. For geoprocessing tools that operate on data directly, additional steps are required to get the data back to the client.
Regardless of which kind of geoprocessing tools are being used in a script or model and published as a geoprocessing service, the script needs to be configured and written to have output parameters just like input parameters. From your screenshots, you don't appear to have any output parameters, so there is no way for the geoprocessing service to return the updated table back to your client.