nameDict = {} errorDict = [] i = 0 searchRows = arcpy.SearchCursor("testtab") for searchRow in searchRows: i = i + 1 tlegal = row.WHSE_TANTALIS_TA_INTERESTED_PARTIES_LEGAL_NAME tfirst = row.WHSE_TANTALIS_TA_INTERESTED_PARTIES_FIRST_NAME tlast = row.WHSE_TANTALIS_TA_INTERESTED_PARTIES_LAST_NAME if tlegal != None: nameDict = str(tlegal) elif tfirst != None and tlast != None: nameDict = str(tfirst) + " " + str(tlast) else: print "Error in row #" + str(i) nameDict = "FUBAR" errorDict = [tlegal, tfirst, tlast] del searchRow, searchRows print errorDict
So the None type is a Python thing, and how Null values are interpreted in a cursor statement. For example:searchRows = arcpy.SearchCursor(myTableView) for searchRow in searchRows: if searchRow.getValue(myFieldName) == None: print "Null Value!" del searchRow, searchRows Not sure what the added utility is exacltly, but there is also a new .isNull cursor method in v10.0searchRows = arcpy.SearchCursor(myTableView) for searchRow in searchRows: if searchRow.isNull(myFieldName): print "Null Value!" del searchRow, searchRowsSo is your error occuring in the MakeQueryTable part or the cursor part? More specifically, what line # is your code bombing on?
searchRows = arcpy.SearchCursor(myTableView) for searchRow in searchRows: if searchRow.getValue(myFieldName) == None: print "Null Value!" del searchRow, searchRows
searchRows = arcpy.SearchCursor(myTableView) for searchRow in searchRows: if searchRow.isNull(myFieldName): print "Null Value!" del searchRow, searchRows
print "legal:" + legal
Can't you specify this as part of the query???For example, something like:"PARCEL_ID = PARCEL_ID AND LEGAL_NAME IS NOT NULL"Are you using this tool as a simply query or as part of a many-to-one or many-to-many sort of thing?Typically I use this tool only for many-to-one relates. For example, if I have many records in a table each describing the height of the trees in a particular polygon over time, where:POLYGON_ID,DECADE,TREE_HEIGHT1,1,101,2,151,3,301,4,601,5,1001,6,1101,7,1151,8,120and I want to return a polygon for each match record in the table.
As for the nulls, if I was able to select them programatically then I wouldn't have this problem in the first place
A typical ESRI analysis work flow:1. Copy all data local (aka: Don't do anything over a network connection).2. Clean up the data as to avoid anything that might make ESRI software throw a rod (getting rid of nulls in your case!)3. Do the analysis
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.