The Map Tools | Layer Tools | Query Objects command selects, deselects, moves, copies, or exports objects that satisfy a user-defined query. Queries are performed on the objects in a single base layer.
Click the Map Tools | Layer Tools | Query Objects command or the button or right-click the base layer and click Query Objects to open the Query dialog and perform a query.
Click the Query Objects command to create a query in the Query dialog. Create the query by selecting object types and specifying conditions using the controls in the dialog or by typing a query into the Query field. The controls and the Query field are synchronized, so control selections are reflected in the Query field. When possible, changes in the Query field are reflected in the controls. The controls and options are discussed in detail below.
Create a query with the Query dialog by selecting object types and applying conditions or by typing a query into the Query field. Select options for text comparisons and the desired Operation for the objects returned by the query.
Specify the objects to query in the Select objects of type list. If you wish to query all object types, do not make any selections in the Select objects of type list. Click the check box next to an object type to add the object type to the Query field. When selecting multiple object types, the objects are combined with "or" and enclosed in parenthesis. The Select objects by type list contains the objects in the selected base layer. The base layer can contain one or more of the following object types: Point, Polyline, Polygon, Spline Polyline , Rectangle, Rounded Rectangle, Ellipse, Text, Metafile, and Image. Any number and combination of object types can be selected.
Each of the five lines in the where all of the following conditions are met section is an independent control clause. Use the control clauses to further refine the object selection returned by the Query Objects command. Each clause consists of a Field, Operator, and Value from left to right. Specify a control clause by making a selection in the Field and Operator lists and typing a value into the Value field. By default multiple clauses are combined with the "and" logical operator. You can manually change the AND operator to another logical operator, such as OR, by typing into the Query field.
The Field list contains items and attributes that can be queried, and it includes: Type, ID, Length, Area, VertexCount, RingCount, and all attributes in the Attribute Table. Length is the length of a polyline or perimeter of a polygon. Select --None-- to clear the Operator and Value fields, and remove the clause from the query. The selection is added to the Query field when it is clicked in theField list.
The Operator compares the values returned by the Field selection and the specified Value. Choose equals (=), does not equal (!=), less than (<), less than or equal to (<=), greater than (>), or greater than or equal to (>=) from the Operator list. The selected Operator is added to the Query field.
The Value is the user-specified number or text to used in the query constraints. Mathematical Functions can also be used in the Value field. Numbers and text typed in the Value field are added to the Query field. Text is added with double quotes, so enclosing text with quotes in the Value field is not necessary.
Specify up to five constraints for the query using the control clauses. If more than five constraints are needed, or if more complex comparisons need to be performed, generate the query by typing directly into the Query field.
The Query field contains the query used to return objects and perform the specified Operation. Click the arrow to view or select one of the last ten queries. Typing a query updates the Select objects of type and where all of the following conditions are met selections, when available. Complex queries and queries requiring more than 5 constraints must be created by typing in the Query field. Also, AND operators generated by the control clauses can be changed manually in the Query field. Mathematical Functions can be used in queries. The following list explains the syntax rules for queries:
- Text must be enclosed in double quotes. For example, type="Ellipse" or ID="Denver"
- User-defined attributes must be enclosed in square brackets. For example, [dip]=60
- The application-defined attributes Type, ID, Length, Area, VertexCount, and RingCount are not enclosed in square brackets.
The Case sensitive compares and Allow ? and * wildcard in text compares options control how text is compared in the query.
- When the Case sensitive compares check box is checked, the text returned by the Field selection and the specified text in the Value field must have the same case.
- When the Allow ? and * wildcard in text compares check box is checked, a ? can be used to represent any single character and an * can be used to represent a group of characters.
Select the desired action for the objects returned by the query in the Operation list.
- Create a new selection selects only the objects returned by the query.
- Add to current selection adds the objects returned by the query to the currently selected objects.
- Remove from current selection removes the returned objects from the current selection.
- Select from current selection selects the objects returned by the query that are part of the current selection. Objects not included in the current selection will not be selected with Select from current selection, even if the objects outside the current selection satisfy the query.
- Copy to new layer copies the objects returned by the query to a new empty base layer. A warning is displayed and no layer is created if no objects are returned by the query.
- Move to new layer moves the objects returned by the query to a new empty base layer. A warning is displayed and no layer is created if no objects are returned by the query.
- Export to file exports the objects returned by the query to a new file. Specify the path, file name, and file type in the Export Query Results dialog. A warning is displayed and no file is created if no objects are returned by the query. To maintain the spatial references for the objects, change the Scaling source to the map in the Export Options dialog Scaling page when saving the file.
OK and Cancel Buttons
Click OK to perform the query. Click Cancel to close the Query dialog without performing the query.