AnsweredAssumed Answered

select by attribute python script, greater than integer variable, cannot concatenate with string

Question asked by michaelflet on Apr 18, 2017
Latest reply on Apr 18, 2017 by Dan_Patterson

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)

Outcomes