I need to use
arcpy.Select_analysis() in my arcpy script, but I have problem with using variables. When I use hard coded values in where_clause, it is working.
where_clause = '"Area" > 20' arcpy.Select_analysis("input", "output", where_clause)
When I try to use variables in where_clause because user of toolbox will enter name of field and value of minimimum area, there is always problem with invalid expression. I tried lots of types of expressions, but nothing is working.
field_area = "Area" minimum_area = 20 where_clause = 'field_area > minimum_area' arcpy.Select_analysis("input", "output", where_clause)
Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\analysis.py", line 98, in Select raise e ExecuteError: ERROR 000358: Invalid expression field_area > minimum_area Failed to execute (Select).
I work in ArcMap 10.2.