Select layer by hundreds of attributes?

667
5
Jump to solution
07-30-2020 01:27 PM
RachelMassa
New Contributor II

I am querying a feature class that has thousands of objects using Select Layer by Attribute. I need to include almost 400 attributes, is there an easier way to write this besides selecting/typing out the name of each attribute?? For example: There are thousands of objects in a feature class each associated with one of hundreds of projects (already identified) and I need to select the objects only associated with a subgroup of 400 of those projects. Select Object where the Project_Name is equal to project A or Project b...x400. The selected subgroup will then be exported into a new feature class specifically for that group of projects. What is the easiest way to do this? 

0 Kudos
1 Solution

Accepted Solutions
JayJohnsonWashoeCounty
Occasional Contributor III

You could also create a table that has those hundreds of values that you want to select on, then join this new table to the original table using the field of interest.   Then you can do a pretty simple Select by Attributes to get anything that doesn't have NULL in the joined table.

Jay
Washoe County GIS

View solution in original post

0 Kudos
5 Replies
DanPatterson
MVP Esteemed Contributor

If the identifying attribute is in a field... then

Split By Attributes (Analysis)—ArcGIS Pro | Documentation 


... sort of retired...
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

See SQL reference for query expressions used in ArcGIS—ArcGIS Pro | Documentation , you will want to use SQL IN operator:

Comparison operators

You use comparison operators to compare one expression to another.

OperatorDescription

[NOT] IN

Selects a record if it has one of several strings or values in a field. When preceded by NOT, it selects a record if it doesn't have one of several strings or values in a field. For example, this expression searches for four different state names:

STATE_NAME IN ('Alabama', 'Alaska', 'California', 'Florida')
0 Kudos
RachelMassa
New Contributor II

What would be the easiest way to list the 400 values that the Project_Name could be IN? 

0 Kudos
JayJohnsonWashoeCounty
Occasional Contributor III

You could also create a table that has those hundreds of values that you want to select on, then join this new table to the original table using the field of interest.   Then you can do a pretty simple Select by Attributes to get anything that doesn't have NULL in the joined table.

Jay
Washoe County GIS
0 Kudos
JoeBorgione
MVP Emeritus

400 attributes?  To quote the late, great Walter Becker of Steely Dan: 'All I can say is ouch'

That should just about do it....
0 Kudos