18.104.22.168. Select by attributes
The Select by Attributes tool is located on the main menu in Selection > Select by Attributes, or also within the attribute table of each layer: Right-click layer > Open Attribute Table > Table Options > Select by Attributes. This tool allows the user to select a set of data from a layer based on the attribute properties of the layer. In the following example, all the communes within the canton of Fribourg, Switzerland, will be selected because all of the honey bee colonies are within that canton.
- From the main menu, go to Selection.
- Click Select by Attributes.
- The input layer is the layer from which data will be selected. In this
case, choose the commune_boundary_FR layer as input.
There are multiple methods available:
a. Create new selection,
b. Add to current selection,
c. Remove from current selection,
d. Select from current selection.
- Choose Create new selection.
In the next section there is a list of attributes corresponding to those of the input layer.
- Select the KANTONSNR attribute by double-clicking on the name.
- Click the equals = button.
- Click the Get Unique Values button to see all the values in that attribute field. In this case, the values represent two cantons in Switzerland.
- Double-click the 10 to add it to the equation. In this example, 10 was clicked because that is the canton number for Fribourg.
- Now the SQL equation looks like this: SELECT * FROM commune_boundary_FR WHERE: “KANTONSNR” = 10 (Fig. 19).
- Click OK
- Open the attribute table of the layer from which data were selected (Right-click > Open attribute table).
- Click the Show selected records button to view the records corresponding to the selection .
- The selected records (49 out of 51) in the table match those selected on the map (Fig. 20).
- Now the selection can be cleared using the icon to begin a new selection in the next section.
Fig. 19. The Select by Attributes dialog box with the commune boundary as the input and the SQL builder and resulting equation shown. In this example, the equation will select all records in the table with the canton number of 10.
Fig. 20. The results of the Select by Attributes query (Fig. 19) are shown on the map and in the attribute table of the commune boundary layer. The turquoise highlights represent all the selected data which represent all communes in the canton of Fribourg.