I had a python script that I published to a service. I was calling that service as such below and everything was working great.
Now the job fails. Not sure why. I can manually run this from ArcCatalog but not when I call from JavaScript like I did in the past.
Do I have to do something differently now that this Feature Class I am trying to write too is a part of a Relationship Class?????
btnGISPush_Click: function () {
var dictstring = document.getElementById(JSONstring).value;
var params1 = {
request: dictstring
};
window.gpJSON.execute(params1).then(function (resultVal) {
console.log(resultVal.results[0].value);
var finalGPResults = resultVal.results[0].value;
},
function (err) {
console.log(err);
}
);
}
Solved! Go to Solution.
I have no idea what happened...I deleted everything including FC and tables and rebuilt everything moving forward....it works now....sometimes don't ask why...
This is the error I am getting.....funny though when I run it from the GP Tool in ArcCatalog it runs fine
I went in and removed the Relationship Class from the Database
Republished the Service and the GP Tool Service
Reran my code from JavaScript to send the GP Tool a parameter and everything worked perfect...
So it seems that the Relationship Class is causing the error....Not sure where or what I have to modify to get this to work with a Relationship class....
QUESTIONS:
Does the Python code need to change to handle the Relationship Class???
How would I write to the Feature Class as seen below and then write to the related table as well...
Say I am creating anew feature and pass it the geometry and fields as seen below.
Then I update a Field (Field1) in the related table with the 'UnqiueID'
OR
Is my issue on the JavaScript side??? I cant see how that would be the case but the Relationship Class is definitly causing the error...
workspace = r"E:/ArcGISProjects/CountySelection/cccc.sde"
edit = arcpy.da.Editor(workspace)
# Edit session is started without an undo/redo stack for versioned data
# (for second argument, use False for unversioned data)
edit.startEditing(False, False)
print "edit started"
# Create update cursor
with arcpy.da.InsertCursor(inputFeatureclass, ['SHAPE@', 'ADDRESSgeocode', 'DISTANCEparameter', 'UNIQUEIDparameter', 'COUNTYLIST', 'UnqiueID']) as cursor:
# Start an edit operation
edit.startOperation()
# Perform edits
## CREATE THE NEW MULTI PART POLYGON IN THE FC
cursor.insertRow([geometries[0], searchAddress, searchDistance, searchid, txt_list, validGuid])
## Delete cursor object
del cursor
# Stop the edit operation.
edit.stopOperation()
# Stop the edit session and save the changes
edit.stopEditing(True)
print "edit ended"
I have no idea what happened...I deleted everything including FC and tables and rebuilt everything moving forward....it works now....sometimes don't ask why...