If statement for particular column (ArcGIS Online)

597
1
03-22-2017 06:00 AM
DominikVisca1
New Contributor
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.
0 Kudos
1 Reply
RebeccaStrauch__GISP
MVP Esteemed Contributor

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)
0 Kudos