Open the Attribute Table of a layer with multiple features.
The simplest way to search for a word (or string) is:
- Type the search term in the LOOK FOR box
- From the drop-down menu, select the FIELD NAME you want to search in
- Click SEARCH
In this example, the term "Campo" was searched for in the NAME_3 field. Three matching features were found, and they are highlighted in the MAP VIEW. By default if there are matching results of any query, the features are set to SELECTED status.
Note on encodings: the sample layer is encoded in ISO-8859-1. If you search for the string "Leon" in field NAME_2 you will find NO matching results! The search will strictly match only "León" including the accent.
One way to search for specific strings, including accents, or for multi-byte characters, is to copy a string from the Attribute Table itself, then paste the copied term into the LOOK FOR box. Note that the Attribute Table by default will NOT allow you to copy and paste. To copy and paste and search a term from the table, follow these steps:
- Click on the TOGGLE EDITING MODE button
- Double-click on the cell you wish to copy from
- Select the string you want to copy and Control-C or Command-C to copy
- Turn OFF the TOGGLE EDITING MODE
- Paste the string to be searched in the LOOK FOR box, with Control-V or Command-V
- From the drop-down box, select which FIELD to search within
- Click SEARCH
In this example, the term "León" was searched, 11 features were found. Click on the MOVE UP button to see the selected rows at the top of the table.
Before moving to the next step, click on the UNSELECT button and make sure the TOGGLE EDITING MODE is set to OFF.
Click the ADVANCED SEARCH button at the bottom right of the Attribute Table window. With the SEARCH QUERY BUILDER, we can run SQL or other calculated queries. The window has several sections:
- The FIELDS section lists all fields in the Attribute Table that can be searched.
- The VALUES section that shows samples or lists all values for a particular field
- The OPERATORS section that provides buttons for common SQL query functions
- The SEQUEL WHERE CLAUSE where the active query is composed
Let's run a test query using the SEARCH QUERY BUILDER. First we'll run the same query on "León."
- Double-click in Fields: NAME_2 [NAME_2 will appear in the SQL Where Clause section]
- Click on LIKE in the OPERATORS section [LIKE will appear in the SQL Where Clause section]
- Click on ALL in the Values section, then scroll down to find "León." Double-click on "León."
- You should now have [NAME_2 LIKE 'León'] in the SQL Where Clause section.
Click the TEST button to see if the Query clause is valid and if it finds results. Click the OK button to run the query. In this case the results should be the same as the previous query on "León."
Now let's try a query that filters a range of numerical values. For simplicity we will select a range of ID numbers from the current table.
- Click the CLEAR button to start a fresh query clause.
- Double-click in Fields: ID_2
- Click on <= in the OPERATORS section
- Click on ALL in the Values section to see some values. Pick a range of five numbers in the the list.
- From the ALL list, double-click on HIGHEST number you want to search for.
- Click on AND in the OPERATORS section
- Double-click in Fields: ID_2
- Click on >= in the OPERATORS section
- From the ALL list, double-click on LOWEST number you want to search for.
- You should now have something like [ID_2 <= 13619 AND ID_2 >= 13614]
Click the TEST button to see if the Query clause is valid and if it finds results. Click the OK button to run the query.
Complex AND / OR statements can be used in the SQL where clause, by combining parameters for multiple FIELDs, etc.