Hello, I am currently working on a script that gets data from a hosted
ArcGIS Online feature class. The plan is to go from top to bottom in a particular
column, and for every value X to execute a print command. I've already managed
this with local files:
fc = r'C:/...'
fields = ['F_03']
with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
if row[0] == "X":
print("Yes")
Which will only work with ArcMap and not as standalone script I think.
Also I've already established the "connection" to my hosted feature class with
requests.get(URL). But I can't figure out, how to put those two snippets
together so it will actually work.
Just in case this is the reason, use arcpy.AddMessage("Yes") and maybe a option to print something for the else: That may help debug.
On a side note, because I switch often between the python window and scripts, I have a function that I use that will handle it in either environment (sometimes it will duplicate the message). fwiw
# shows messages for python window or tool
def myMsgs(message):
arcpy.AddMessage(message)
print(message)