The following snippet works fine if there are no null values for the SequenceNumber field on the table, but it crashes if there are any. Is there any way to change this query? I am thinking that null values cannot be used as strings? Is there any way to create this selection query keeping the maxValue4 an integer? Thank you!
Code:
if result > 1:
maxValue4 = arcpy.SearchCursor("TMP", "", "", "", "SequenceNumber D").next().getValue("SequenceNumber")
arcpy.AddMessage(str(maxValue4))
query = "SequenceNumber = "
arcpy.SelectLayerByAttribute_management("TMP", "SUBSET_SELECTION", "SequenceNumber = " + str(maxValue4))
result = int(arcpy.GetCount_management("TMP").getOutput(0))