The Selection Query is a powerful selection functionality found in the Advanced Selection Tool (Alt + S) that allows you to set your own parameters beyond what the basic Selection Criteria can set. You can type in criteria and decide if you want your selection to equal a certain value, NOT equal a certain value, and more. Let's talk about some terms, then walk through the steps to use it, and finally we can look at a couple of examples.
When creating a query, you are stringing together a series of criteria, or expressions. An expression is made up of three things:
A parameter determines what type of restriction you would like to place. The operator in the expression dictates how the parameter will relate to the value. The value is the property that you want to include, exclude, or relate in some way to the parameter.
Category = Accessories
Category is the parameter, saying what type of constraint you want to place on your selection. The operator is = (equals), meaning that the value should be exactly equal to the category of objects in the drawing.
There are actually two types of operators: Relational and Logical. Relational operators allow you to specify how your value will relate to the parameter. Logical operators will let you add stipulations to your query to make it more precise. In other words, logical operators string multiple expressions together.
All these terms will make more sense as we talk through the steps and look at a few cases where this will be useful!
To begin, open the Advanced Selection tool, either from the Tools drop-down menu or by using the shortcut Alt + S. Then hover over Query in the Advanced Selection Tool. A cell expands where you can begin to type. You will see a drop-down menu automatically suggesting parameters that you can use.
There are three ways you can choose one of the suggestions:
- Begin typing. The list will filter so that only suggestions matching what you type will show. You can type the whole word, or press Enter when the suggestion you're looking for is at the top of the list.
- Use your arrow keys to move down through the list. Press Enter when the suggestion you want is highlighted.
- Scroll through the list and left-click on the suggestion you want.
After selecting your first parameter, the Query tool will auto-suggest certain relational operators. Remember, relational operators determine how you want your value to relate to the parameter.
|≠||Not equal to|
|≥||Greater than or equal to|
|≤||Less than or equal to|
|IN||Criteria must match one of the values in the list|
|NOT IN||Criteria must not match any values in the list|
|IN RANGE||Value can be found between a range of numbers|
|NOT IN RANGE||Value should not be found between a range of numbers|
|AND||Create additional constraints to a query that require objects to meet multiple criteria to be selected.|
|OR||Create additional constraints to expand the query so that objects only need to meet one of your criteria to be selected.|
Now that we know what the words mean and how it works, let's actually dig into some realistic scenarios!
Example 1: Getting the basics
Let's say that you have several types of seating in your drawing, and you need to select all task chairs with arms that have pink upholstery.
Rather than going around the drawing to find them all and HOPING you haven't missed one, you can use the Query tool to set the parameters needed to select all of them. You will want to start by specifying the chair's part number and then narrowing down the query with properties like Upholstery material and Arm Rest.
- To begin the query, open the Advanced Selection tool, either from the Tools drop-down menu or by using the shortcut Alt + S.
- Hover over Query and begin typing Part Number as the first parameter.
- Once Part Number is highlighted, press Enter to auto-complete the first part of the expression.
- The tool now suggests specific relational operators that can be used with Part Number:
- In this case, you want to select objects that all have the exact same part number that you enter as the value, so select = . You can use the down arrow key to select the first line, then press Enter again.
- Now you see a full list of all the part numbers that exist in the drawing. You can use the arrow keys again, or use the mouse to scroll through the list and click on the part number of the chair. If you already know the part number, you can start typing to make the list smaller.
- Once you choose the part number, you will see logical operators so that you can continue to refine your query. Pick AND so that objects must meet the previous and the next criteria to be added to the selection.
- Continue to input more criteria to narrow the selection. Type the following additional expressions:
Upholstery = pink
Arm Rest = Arm Rest
The Arm Rest = Arm Rest expression may sound redundant, but it is referring to this value from the quick properties box for my chair:
The name of the property is Arm Rest, and the selected option is to have an Arm Rest.
- The tool continues to suggest more refining operators indefinitely, but as soon as you have added all of the constraints you need, press Enter or click the green arrow.
- Now that you completed the query, it will show up in the Query history. The history stores queries that have been done in the current session of the open drawing. This means that it won't show in another open drawing, and that if you close and reopen the drawing, the history will be cleared.
To view your query history, just hover over Query history and previous queries will show. Click one to re-load it in the query search field and you can either press Enter to run it again, or start typing to further refine the it.
Example 2: Taking it up a notch
Let's contrive a slightly more complicated scenario. Imagine you have a pretty large layout with lots of workstations. The layout is Part Tagged representing three different departments - Sales, Design, and Admin.
As you work together with your clients, you realize that the Sales department doesn't need the same amount of desk space and storage as the Design and Admin teams do. To save on costs and unnecessary space, you would like to be able to select and remove just the shorter worksurfaces and the pedestals underneath them, but only in the Sales area, all at once.
Here's how you can accomplish the query you need:
- Now for this query, you want to start with Categories since you need to include multiple objects from more than one category. Begin to type Category and press Enter once it is the top option.
- Next (and this is where it gets a little more exciting than our last example), instead of typing =, type or select IN. The IN operator allows you to set multiple values at once instead of turning them into several phrases, which saves a lot of time. So in this case, you can type Category IN (Worksurfaces, Storage) instead of Category = Worksurfaces OR Category = Storage.
- After you type IN, the punctuation is automatically inserted (the parentheses and commas), so all you have to do is type or choose the end parenthesis when you're done setting the values.
- Next, you need to make sure that you're not selecting the longer worksurfaces as well - just the shorter ones. To do that, you can specify that you only want objects whose width is less than the longer worksurface. So add the parameter Width, and use the "less than" symbol: <. (Are you having flashbacks to algebra class yet?)
- Lastly, you only want to remove the short worksurfaces and pedestals in the Sales area, but the Design and Admin areas need to keep them. So the final parameter should be to set the Part Tag to equal Sales.
- Now that you've got all your parameters set, press Enter or left-click the green arrow, and voila! The short worksurfaces and pedestals in the Sales area are selected. Just press the Delete key to get rid of them!
You can see how the Query tool can help you save large amounts of time in making precise selections instead of searching through the drawing or scrolling through the Calculation to find the line with the part number to select objects in the drawing.