I want to select multiple values within a field and I am trying the following method: "xyz" in (1,2,3). I am including several values that may not exist in the attributes table, but I would like to cut and paste the formula into multiple shapes to select the values that may or may not exist in the attributes table for each shape. Since I am including values that don't exist the statement is invalid. Is there a way to enter this "blanket" formula for the shapes that would be acceptable?
closed as unclear what you're asking by PolyGeo♦ Feb 9 '17 at 18:34
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Solution mentioned in comment seems to be good for few values. If you have a lot of numbers try something like this:
column IN (value_1, value_2, ..., value_n)
EDIT: Maybe it's not straightforward but try that (ArcGIS):
Add new field in attribute table eg. new_column
use calculate field tool to calculate new column with expression (expression type - python)
and code block
values = [value_1, value_2, ..., value_n] def Reclass(column): if column in values: return 1 else: return 0
Now you have new column with 1 if your value exists in attribute table, 0 otherwise
- select only that row where
new_column = 1
You can combine that steps in ModelBuilder thus whole process will be faster.
Some more details would be useful to answer this question. Are you asking about ArcGIS selection by attributes or using other software? Do you have a screenshot of your attempt?
What format is your data in? Different data sources require different syntax - perhaps you're using syntax that is not appropriate for the format your data is in?
Same goes for data types, numeric values don't need quotes around them, strings do
Using the query builder (clicking on the calculator buttons and double clicking on fieldnames) should result in syntax appropriate for your data types and format.