Creating Queries
This topic describes how to create various types of queries.
Creating Simple and Complex Queries
You can write simple queries that have only one condition, or complex queries that use several conditions and one or more logical operators.
- Select a folder from the folder tree.
- Click a component tab.
-
Choose Filters > Queries.
The Queries dialog box opens.
-
Click New.
The New Query dialog box opens.
- Type a name for the query in the Query Name field.
- Select the Public check box to add this query to the project (and the server configuration), allowing anyone with the appropriate access rights to use it. If you do not check the Public check box, the query will be private, that is, available only to your user ID.
- Select a
Field and
Operator, type or select a
Value, and click
Add to place this condition in the
Query tree.
By default, the Query tree contains the AND operator as the root of the tree, which you cannot delete. If there is only one condition, StarTeam ignores the logical operator.
- Click View as Text to view the query in text format. Notice that the default logical AND operator was not included in your query. Click OK.
- Optionally, click one of the following
Logical Node
buttons to create a new
Query tree node:
AND,
OR, or
NOT.
Tip: You can change an existing operator in a condition by toggling the AND->OR->NOT button. Keep clicking the btton until the operator that appears is the one you want to use.
- Select the fields for this new condition and click Add.
- Add any other conditions, then click
Save.
The Queries dialog box now contains your new query enabling you to select it for querying data.
Note: If this is a public query, you might want to set access rights for it.
Tip: When creating a query condition, it is best to use the condition or logical operation that will result in the fewest matches as the first condition or logical operation.
Creating "Me" Queries
StarTeam has the capability of creating "Me" queries that allow a query to be set up which is evaluated against the currently logged in user ("Me"), rather than having to specify a specific username at the time of query creation.
To create a "Me" query, do the following:
- Select a folder from the folder tree.
- Click a component tab.
-
Choose Filters > Queries.
The Queries dialog box opens.
-
Click New.
The New Query dialog box opens.
- Type a name for the query in the Query Name field.
- Select the Public check box to add this query to the project (and the server configuration), allowing anyone with the appropriate access rights to use it. If you do not check the Public check box, the query will be private, that is, available only to your user ID.
-
Select Created By for the Field in the Condition Node area. Select Equals for the Operator, and select
Me
in the Value list. Click Add to place this condition in the Query tree.By default, the Query tree contains the AND operator as the root of the tree, which you cannot delete. If there is only one condition, StarTeam ignores the logical operator.
-
Click Save.
The Queries dialog box now contains your new query enabling you to select it for querying data.