Hi Everyone, I am trying to write a query that selects by attribute, looping through different files, but have run into a snag because the variable is numeric and I wish to select values less than that number. If I convert the number to string, it is not a valid query. Code below:
while row:
FromVar = str(row.Fromage)
Fromcommand = "'" + "FROMAGE" + "<" + "FromVar" + "'"
print Fromcommand
row = rows.next()
arcpy.SelectLayerByAttribute_management("Multipoint Yellowstone plus a little Shatsky", "SUBSET_SELECTION", Fromcommand)
"\"FROMAGE\" < {}".format(1) as in...
>>> for i in range(3): print("\"FROMAGE\" < {}".format(i))
...
"FROMAGE" < 0
"FROMAGE" < 1
"FROMAGE" < 2
the trick is in the escape encoding and the format formatter