AnsweredAssumed Answered

Where clause in da Cursor

Question asked by jborgion Champion on Dec 4, 2018
Latest reply on Dec 4, 2018 by jborgion

For the life of me I cannot get a where clause to work in a cursor (search or update):

fields = ['SampleDate','SampleID','OBJECTID']
where = 'SampleDate is null' # do where clauses really work in a cursor?  not for me.
with arcpy.da.SearchCursor(fc,fields,where) as cursor:
    for row in cursor:
        s_date = str(row[0]).split(' ')[0]
        mnth = s_date.split('-')[1]
        day = s_date.split('-')[2]
        yr = s_date.split('-')[0]
        newdate = '{}{}{}'.format(yr,mnth,day)
        pre = 'FP'
        exp = "'{} {} {}'".format(pre,newdate,new_time)
        print '{}  {}  {}'.format(row[1],exp,row[2])

When I include the where clause as shown I get no returns with my print.  I've capitalized IS NULL, same result; I have used the same 'where' in an ArcMap interactive selection just fine.  I gotta be missing something slight....