Select to view content in your preferred language

Published Geoprocessing tool not calculating field

1118
6
Jump to solution
11-22-2018 03:53 PM
DarrylKlassen1
Frequent Contributor

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:

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

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.

View solution in original post

6 Replies
NeilAyres
MVP Alum

I think it is calculating on a temporary feature layer in memory. Not updating a feature class in a db.

0 Kudos
DarrylKlassen1
Frequent Contributor

Yes, I just don't know how to  make it update the FC.

0 Kudos
NeilAyres
MVP Alum

Surely the data type should be a feature class

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

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.

0 Kudos
DarrylKlassen1
Frequent Contributor

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.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

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.