AnsweredAssumed Answered

Search Cursor against date field and using date with python

Question asked by armein01 on May 16, 2014
Latest reply on May 17, 2014 by armein01
Good Afternoon ArcPy Wizards!

I would love some input on my code.
I am trying to capture the earliest positive in a grid and then count  the negative sample that were required before the positive.

The Code:

 for grid in grids:         dates = []         arcpy.SelectLayerByLocation_management("cwdpts4Anlys", "WITHIN", grid.shape, "NEW_SELECTION")         positives = arcpy.SearchCursor("cwdpts4Anlys",' "ELISALYMPHNODE" = \'Positive\' ' , "", "SAMPLE_ DATE" ')          for positive in positives:             dates.append(row[0])                  earliest = min(dates)         arcpy.SelectLayerByLocation_management("cwdpts4Anlys", "WITHIN", grid.shape, "NEW_SELECTION")         arcpy.SelectLayerByAttribute_management("cwdpts4Anlys", "SUBSET_SELECTION", ' "ELISALYMPHNODE" = \'Negative\' ')         arcpy.SelectLayerByAttribute_management("cwdpts4Anlys","SUBSET_SELECTION",'"SAMPLE_DATE" <= date earliest ' )         negatives = int(arcpy.GetCount_management("cwdpts4Anlys").getOutput(0))         grid.setValue('NegPrior2Pos', negatives)         grids.updateRow(grid)         

I get a syntax error at
positives = arcpy.SearchCursor("cwdpts4Anlys",' "ELISALYMPHNODE" = \'Positive\' ' , "", "SAMPLE_ DATE" ')

Ive tried adding the keyword date before "SAMPLE_DATE" and many other ways.