AnsweredAssumed Answered

SpatialJoin_analysis help with Join

Question asked by cindykerns on Jul 23, 2015
Latest reply on Jul 23, 2015 by iamurray


Hi I am very new to ArcGis and Python

 

I recently had a data change that broke SpatialJoin line in a script we run to compile ArcGIS data for a database import.

The data in the ORD_NUM field can now get to be longer than 25 characters long.

 

arcpy.SpatialJoin_analysis(

     parcel, ConditionalUse, parcel_conuse, "JOIN_ONE_TO_ONE", "KEEP_ALL", "PARCEL_ID \"PARCEL_ID\" true true false 50 Text 0 0 ,First,#,"

    +vars.path_to_database+"/Parcel.mdb/Parcel/PARCEL_Limits,PARCEL_ID,-1,-1;ORD_NUM \"ORD_NUM\" true true false 25 Text 0 0 ,Join,\",\","

    +vars.path_to_database+"/CommDev.mdb/CommDev/ConditionalUse,ORD_NUM,-1,-1", "INTERSECT", "-1 Feet", "")

 

 

My original answer to this issue was to change the field length here to 50. However that broke the database process and unfortunately I can not change that process right now.

So instead I would like to change this line so it truncates the data to 25 characters for the ORD_NUM field instead of failing like it does now.

 

This is a temporary fix until the database process can be adjust to handle the longer data. I tried setting the -1, -1 to 0, 25 but that didn't fix the issue. It still errored. 

Is there anything else I can do to this line to force it to truncate the data at 25 characters instead of failing?

 

Thank you!!

 

 

 

Outcomes