Select to view content in your preferred language

Field OID does not exist within table - PLEASE HELP!

2285
1
10-10-2013 01:15 PM
ionarawilson1
Deactivated User
If I run the geoprocessing service to the point before the Identity Analysis, it works fine, but if I add the Identity Analysis, the server gives me an error saying the OID field does not exist. Please help! I have no idea why it is doing this. The script tool has two parameters as feature sets that represent the data that is referenced by the variable Input_polygons and Counties.

Note: there are no errors if I run the script in ArcMap and the OID field was created today, many weeks after I created the database (in SDE)

Here is the error

  line 60, in arcpy.CalculateField_management(Input_Polygons, g_ESRI_variable_2, g_ESRI_variable_3, "PYTHON") File "c:\program files\arcgis\server\arcpy\arcpy\management.py", line 3129, in CalculateField raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000728: Field OID does not exist within table Failed to execute (CalculateField). Failed to execute (CalcFeaturesStewardship3). Failed to execute (CalcFeaturesStewardshipOneParameter).

Here is the script

# Import arcpy module
import os, sys, arcpy, traceback, arcgisscripting
#arcpy.env.workspace = "Database Connections\\sars.sde\\"


# Script arguments

#Selecting_Features = arcpy.GetParameterAsText(0)

Input_Polygons = "Stewardship"
Counties = "Counties"
#Final_Output = value
arcpy.env.scratchWorkspace = "d:\\ArcGISData\\SARS\\Python_10April2013\\SARS.gdb"


# create output feature for spatial join
outstewardshipcounties = os.path.join(arcpy.env.scratchGDB, "StewardshipCounties")


with arcpy.da.UpdateCursor(Input_Polygons, ("DateStart", "PlanID", "FFY")) as rows:


      
    for row in rows:

        if not (row[1] or "").strip(): #covers blank, one blank space, or Null

           Datestarstr1 = row[0]

           Datestarstr2 = str(Datestarstr1)
      


           yearonly = Datestarstr2[0:4]

                
           row[2] = yearonly


           rows.updateRow(row)  


#run spatial join tool
arcpy.CalculateField_management(Input_Polygons, "OID", '!OBJECTID!', "PYTHON")

arcpy.Identity_analysis(Input_Polygons, Counties, outstewardshipcounties)
Tags (2)
0 Kudos
1 Reply
ionarawilson1
Deactivated User
I figured ArcGIS server was confused as to where the data was. Once I changed the variable values to parameters it does not give me an error but the gp does not change anything

Input_Polygons = arcpy.GetParameterAsText(0)
Counties = arcpy.GetParameterAsText(1)
0 Kudos