Creating Queries

You can write simple queries that have only one condition, or complex queries that use several conditions and one or more logical operators.

  1. Select a folder from the folder tree.
  2. Click a component tab.
  3. Choose Filters > Queries .
    The Queries dialog box opens.
  4. Click New.
    The New Query dialog box opens.
  5. Type a name for the query in the Query Name field.
  6. 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.
  7. 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.

  8. 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.
  9. 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 button until the operator that appears is the one you want to use.
  10. Select the fields for this new condition and click Add.
  11. 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.