I'm trying to make a simple script tool that allows the user to search a for a specific polygon in a feature class using a unique number.
Using the python window in ArcGisPro I run arcpy.management.SelectLayerByAttribute
setting the where
clause to state_parcel_id = '840723200011000007'
and the tool works, selects the appropriate polygon, and I get message saying <Result 'Parcel Boundaries of Indiana With DLGF Tables 2022\Parcel_Boundaries'>
However when I try replace 840723200011000007
with param0
and run it, I only get the same message back of
<Result 'Parcel Boundaries of Indiana With DLGF Tables 2022\Parcel_Boundaries'>
It doesn't select anything or doesn't give any errors. I've search around the web and tried to play around with it but no luck.
This doesn't select anything and doesn't give an error:
param0 = 840723200011000007
arcpy.management.SelectLayerByAttribute(
r"Parcel Boundaries of Indiana With DLGF Tables 2022\Parcel_Boundaries",
"NEW_SELECTION",
"state_parcel_id = 'param0'",
None)
This selects the right polygon:
arcpy.management.SelectLayerByAttribute(
r"Parcel Boundaries of Indiana With DLGF Tables 2022\Parcel_Boundaries",
"NEW_SELECTION",
"state_parcel_id = '840723200011000007'",
None)