Using python string wild cards within the field calculator ArcGIS 10.3.1

المشرف العام

Administrator
طاقم الإدارة
I have two fields. One field has an ID. The other field has a list of ID's. Using the Field Calculator I with to calculate 1 or 0 if either field contain the same ID number. I was successful at writing an arcpy row by row query, but there's millions or records and a linear test of rows is not efficient. I need to calculate it in one hit.

I need to take a field and make it's value a wild card and test the other field for that value. I have tried the "*" and "in" methods. But it's not returning the correct value. What noob thing have I done wrong?



Code One:

def myCal(reportnumber,spatialjoin): reportnumbercheck = ('*'+(str(reportnumber))+'*') if (reportnumbercheck in spatialjoin): return 1 else: return 0

أكثر...
 
أعلى