I am building an addin that will create a selection of multiple features that fit within the scope of multiple 'where' statements. All fields will be within the same layer, the layer will always be named "ParcelsWslivers" and will always have a field named "acres" and "VPA". Currently, when I run my script it returns the following error.
My code currently is
import arcpy
import os
class CreateLayerOfPotentialSlivers(object):
"""Implementation for Test2_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
# Get the current map document and the first data frame.
mxd = arcpy.mapping.MapDocument("CURRENT")
lyr = arcpy.mapping.Layer("ParcelsWslivers")
field = 'Sliver'
# select parcels with acres less than 0.01 acres
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", '[acres] <= 0.01')
# select parcels with greater than 100,000,000 VPA
arcpy.SelectLayerByAttribute_management(lyr, "ADD_TO_SELECTION", '"VPA" >= 100000000')
I feel that my issue may be that I'm not being specific with the code about my workspace. However I want it to be conditional so that it does'nt matter which computer this is opened on it will still work within the current document.
query="{0} <= 0.01".format(arcpy.AddFieldDelimiters(lyr, 'acres')"