I was able to get what I need with the following. My only other question is how do I get the counter to on top of the OBJECTID rows?
fields = ["OBJECTID", "PN1"]
where = "PN1 = ' ' OR PN1 IS NULL"
counter = 0
with arcpy.da.SearchCursor(fc, fields, where) as cursor:
for row in cursor:
if row[1]in ["", " ", None]:
counter += 1
print ("OBJECTID {0}".format(row[0]) + "has a NULL value in field")
print ("{} {} records have blank/empty or NULL records".format(row[0],counter))
Results;
OBJECTID 44has a NULL value in field
OBJECTID 47has a NULL value in field
OBJECTID 88has a NULL value in field
OBJECTID 106has a NULL value in field
OBJECTID 108has a NULL value in field
OBJECTID 121has a NULL value in field
OBJECTID 130has a NULL value in field
OBJECTID 182has a NULL value in field
OBJECTID 210has a NULL value in field
210 9 records have blank/empty or NULL records
How do i put the "210 9 records have blank/empty or NULL records" on top like so
210 9 records have blank/empty or NULL records.
OBJECTID 44has a NULL value in field
OBJECTID 47has a NULL value in field
OBJECTID 88has a NULL value in field
OBJECTID 106has a NULL value in field
OBJECTID 108has a NULL value in field
OBJECTID 121has a NULL value in field
OBJECTID 130has a NULL value in field
OBJECTID 182has a NULL value in field
OBJECTID 210has a NULL value in field