I have a very simple python script that has been published as a geoprocessing service and is meant to be consumed in an ArcGIS Online web application. The python script was added as a script in a toolbox before being published to our ArcGIS Server. The script works perfectly when run in ArcMap, but I am having a problem when I attempt to run it in the ArcGIS Online web app. Please see below for the steps performed in the script.
- Request a user-defined input parameter, which is a DBF that will always have the same schema
- Connects to a enterprise geodatabase, and clears all the existing records in a geodatabase table
- Appends the user-defined input parameter into the empty enterprise geodatabase table
When run in the web app, the service successfully clears the existing records in the geodatabase table. The service also appends the correct number of new records into the table, however, all the values are missing with the exception of the
objectID. Please see below the script as well as a screenshot of the resulting table. We are operating with ArcGIS 10.3.1 within a 2008 R2 SQL database.
#THIS SCRIPT DELETES ALL THE RECORDS IN THE EXISTING SDE CUSTOMER TABLE AND REPLACES THEM WITH THE NEW CUSTOMER DBF
import arcpy, os, shutil
from shutil import copyfile
#REQUEST NEW TABLE
Customer_New = arcpy.GetParameterAsText(0)
#DELETE RECORDS IN CURRENT CUSTOMER TABLE
Current_Customer = "Database Connections\DEVELOPMENT_SERVICES.sde\CLSDGEO.CLSD_OWN.Customer"
arcpy.AddMessage('-Old customer table successfully cleared')
arcpy.AddMessage('-Old customer table already empty')
#APPEND NEW CUSTOMER TABLE TO SDE CUSTOMER TABLE
arcpy.Append_management(Customer_New, Current_Customer, "NO_TEST", "ACCT \"Account\" true true false 8 Double 0 10 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,ACCT,-1,-1;IAWPREM \"Premise\" true true false 15 Text 0 0 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,IAWPREM,-1,-1;NAMF \"First Name\" true true false 15 Text 0 0 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,NAMF,-1,-1;NAML \"Last Name\" true true false 30 Text 0 0 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,NAML,-1,-1;SVNO \"Street Number\" true true false 9 Text 0 0 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,SVNO,-1,-1;SVDR \"Street Direction\" true true false 2 Text 0 0 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,SVDR,-1,-1;SVCADD \"Address\" true true false 25 Text 0 0 ,First,#,V:\\Files for Jacob\\CustomerTable\\2017\\03_March\\customer.dbf,SVCADD,-1,-1", "")
arcpy.AddMessage('-New customer table successfully imported to SDE')
arcpy.AddMessage('-Could not append new customer table into SDE, contact GIS Administrator')
arcpy.AddMessage(' -Tool complete')