I'm charged with maintaining QA logs embedded in a feature on ArcGIS Online.

Basically I just have to change some fields in the feature.

The problem is that I wrote scripts using cursors to update the feature, but whenever I run the script, though it says it worked fine (no errors reported from the script and the temporary copy successfully reflects the edits I want) the edits all disappear whenever I sync my edits to the service.

I've been talking with ESRI tech support, but still can't figure it out.

I thought I'd post the question here to see if anyone else is working with ArcGIS Online.

Note: of the fields I am changing one has geodatabse level domains enforced. I copied those domains to my working feature which I store all of my edits in, so I wouldn't think that would be a problem.

Also, I can successfully do this manually, however I have too little time to do it that way, and I need a solution moving forward.

Here's the code, but I've already verified that the code works on local copies of the data:

            import arcpy
            from arcpy import env
            from arcpy.sa import *

            # Set environment settings===============
            arcpy.env.workspace = "C:/workspace_filepath"
            featureClassToUpdate = r'path_to_AGOL_feature_class_in_temp_geodatabase'
            joinFile = r'file_with_formatted_edits'

            #create an array of values from the crossing scores csv file:
            updateData = [] #create an empty array that will be populated shortly:

            fields1 = ['SADES_ID', 'REVIEW_LEV', 'DES_REVIEW']
            with arcpy.da.SearchCursor(joinFile, field_names = fields1) as toSearchCursor:
            #with arcpy.da.SearchCursor(joinFile, ['SADES_ID', 'REVIEW_LEVEL', 'DES_REVIEW', 'QA_Comments']) as toSearchCursor:
                            #^Edit formats here; QA_Tracking_Format
                            for row in toSearchCursor:
                                            templist =[row[0], row[1], row[2]]
                                            #^put the table to join into an array in temp memory (this shouldn't be too big for python to handle, but I wouldn't throw the whole database at it... (actually it handles the whole database just fine.)

            #with arcpy.da.UpdateCursor(featureClassToUpdate,['SADES_ID', 'REVIEW_LEVEL', 'DES_REVIEW', 'UPDATE_COMMENTS']) as toUpdateCursor: 
            #^Currently no fields are large enough to handle our update comments.
            fields2 = ['SADES_ID', 'REVIEW_LEV', 'DES_REVIEW']

            with arcpy.da.UpdateCursor(featureClassToUpdate,fields2) as toUpdateCursor: 
                            #^Edit field formats here: SADES2; Also, if QA comments ever becomes implemented then it can be added here.
                            #open up an update cursor on this file, and activate only fields in brackets^ - like a python array
                            for row in toUpdateCursor:
                                            for x in updateData:
                                                            if row[0] == x[0] and row[0] is not None and row[0] != 0:# and x[0]>250: #if both rows have the same SADES_ID (which is in teh 0 position), and SADES_ID isn't <Null> or 0:
                                                                                            row[1] = x[1] #update row[1] with ReviewLevel
                                                                                            row[2] = x[2] #update row[2] with DES_REVIEW
                                                                                            #row[3] = x[3] # Update_COMMENTS
                                                                                            print row[0]
                                                                                            print "... updating... " #inform user for debugging...
                                                                                            toUpdateCursor.updateRow(row) #actually enforces the updates that are entered above
            print "Scores copied from table. Routine Complete."
  • Can you show the code? – alexGIS Apr 21 '16 at 17:36
  • I've put it up there, but I don't think that's the issue. – J. Nic Apr 21 '16 at 18:58
  • How are you syncing the edits back to agol? If your updates are being committed successfully to your gdb, likely your issue is there. If script mediates, post that. – Ben S Nadler Apr 22 '16 at 1:31
  • I'm running this script on a "downloaded copy for local edits," then syncing these edits with AGOL – J. Nic Apr 22 '16 at 15:04
  • You seem to be saying that everything in the local processing of your file geodatabase is working but that "syncing ... edits to the service." is not. However, your question only contains details of the former. If this is still an issue I think you should focus it on that "syncing ... edits to the service." – PolyGeo Feb 22 '17 at 22:40