Select Layer By Attribute (Data Management Tools)
Summary
Adds, updates, or removes a selection based on an attribute query.
Usage
If the input is a feature class or dataset path, this tool will create and return a new layer with the result of the tool applied.
If a definition query is present on the input, only the features or rows matching the definition query will be used in the selection.
The number of selected records will be listed in the geoprocessing history. Click Parameters > Count to access them. Additionally, the Get Count tool can be used to count the number of selected records. From Python, the number of selected records can also be accessed from the tool's
Resultobject.When applying selections, a selection of zero records is possible. For example, selecting a field value that is not present, results in a selection of zero records. A geoprocessing tool using the layer as input will use no records from the input.
The field delimiters used in an SQL expression differ depending on the format of the queried data. For instance, file geodatabases and shapefiles use double quotes, and enterprise geodatabases don't use field delimiters. You can use the
AddFieldDelimitersfunction to help ensure that the field delimiters used with the SQL expression are correct.If the input's data source is a feature service, it is recommended that the underlying ArcGIS Server use standardized SQL queries.
Parameters
| Label | Explanation | Data type |
|---|---|---|
|
Input Rows |
The data to which the selection will be applied. |
Table View; Raster Layer; Mosaic Layer |
|
Selection Type (Optional) |
Specifies how the selection will be applied and what to do if a selection already exists.
|
String |
|
Expression (Optional) |
An SQL expression used to select a subset of records. |
SQL Expression |
|
Invert Where Clause (Optional) |
Specifies whether the expression will be used as is, or the opposite of the expression will be used.
|
Boolean |
Derived output
| Label | Explanation | Data type |
|---|---|---|
|
Updated Layer Or Table View |
The updated inputs with selections applied. |
Table View; Raster Layer; Feature Layer |
|
Count |
The number of selected records. |
Long |
Environments
This tool does not use any geoprocessing environments.
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes