The AccuWork Query Editor

The AccuWork Query Editor is a tool for creating and revising AccuWork queries.

Opening the Query Editor

You can create or revise an AccuWork query in these contexts:

  • In a Queries tab, click the New Query or Edit Query button. This opens a separate Edit Query window.
  • In the Change Packages subtab of the Schema Editor, click the New Trigger or Edit Trigger button to open a separate Promote Trigger window. The Query Editor runs in the bottom pane of this window.

Back to top

Query Editor Layout

The Query Editor displays the contents of one query. The query appears as a hierarchy, which you navigate using familiar expand/collapse controls. The hierarchical organization is a natural fit, because each query is, itself, a hierarchy of simple clauses and compound clauses:

  • The first hierarchy level contains the query's name, if the Query Editor was invoked from the Queries Tab.
  • A simple clause, such as value of the assignedTo field is dfoster, can live at any level.
  • A "compound AND" or "compound OR" clause consists of:

    • The operator AND or OR at one hierarchy level
    • Any number of clauses (simple or compound) at the next hierarchy level.

For example, this query can be expressed as:

"Retrieve each issue record that is (1) numbered at or above 2300, (2) is not documented, or (3) is assigned to user dfoster."

The context menu of a query's name in the Query Editor includes the option In English, which produces a sentence like the one above.

Back to top

Working in the Query Editor

The following sections describe the details of working in the Query Editor.

Naming a New Query / Renaming an Existing Query

When you click the New Query button to create an empty query, AccuWork assigns it a placeholder name ("New Query nnn"). You can edit the name now: click the name once to select it, then press function key F2 (or click it a second time) to begin editing it. Don't double-click — that's equivalent to using the expand/collapse control.

You can change a query's name at any time while Query Editor is still active. Or you can change it later, in the Query List pane.

Creating a Simple Clause

Every query consists at least one simple clause . A simple clause has three parts:

<field-name><comparison-operator><value>  

The point-and-click interface makes creating a simple clause easy and (almost) foolproof. Start by clicking one of the "Click here to add ..." placeholders in the query:

First, you must select the <field-name> part of the clause from the list-box containing all the field-names. When you select a field-name, the query editor automatically adjusts the <comparison-operator> and <value> parts of the clause, based on the selected field. In the example below, the user has selected field-name productType, whose value must be one of these names: ColorStar, Mixer, Publisher.

The table below shows all the AccuWork data types, along with the corresponding choices for the <comparison-operator> and <value> parts of a simple clause. As you "fill in the blanks" to create simple clauses, you'll notice that AccuWork allocates new "Click here to add ..." placeholders, so that one is always available at each level of the query.

Field Type Comparison Operator Value
Text contains
matches
does not contain
does not match
equal to
not equal to
less than
less than or equal to
greater than
greater than or equal to
Any character string. (Do not enclose it in quotes.) The value is always interpreted as a string literal; there is no way to specify the value of some other field here.

The comparison is always a case-insensitive string comparison, never a numeric comparison. For example, the value 3 is greater than the value 25.

The contains and does not contain operators perform a simple substring search (case-insensitive), with no pattern matching.

The matches and does not match operators perform pattern matching (case-insensitive), using these wildcards:

*  matches 0 or more characters
?  matches any 1 character
[aekz]  matches a, e, k, or z
[a-e]
 matches a, b, c, d, or e (Note: Don’t mix uppercase and lowercase; neither [E–k] nor [e–K] matches any character]
{one,two,seven}  matches one, two, or seven
\ or /  Matches any directory-separator character, even if it’s the "wrong one" for the client machine. For example, src/do_*.java matches src\do_something.java on a Windows client.

Examples:

Rls 4* matches Rls 4 and Rls 4.01, but not Rls 4.2 or Rls 5

Rls [2-5]* matches Rls 2, Rls3.04, and Rls 5.3, but not Rls 1.02

the -? option matches the -X option and the -4 option, but not the -Op option

cop{y,ies} matches copy and copies, but not copy(s)

Timespan equal to
not equal to
less than
less than or equal to
greater than
greater than or equal to

A numeric value, representing an amount of time. For a calculated timespan field, the value is interpreted as a number of days. For an editable timespan field, the value is interpreted as a number of hours.

Note: An XML-format dump of the issue record created by Export reports the value as a number of minutes (e.g. 450)

Choose is
is not

One of the strings specified in the definition of this field in the Schema Editor.

List is
is not

One of the strings specified in the definition of a particular named list in the Schema Editor.

User

is
is not
is member of
is not member of

One of the principal-names in the user registry maintained by the AccuRev server. Alternatively, a user-group defined in the registry.

Timestamp

is
is not
is before
is after
is before or equal to
is after or equal to

An AccuRev timestamp.

Attachments contains

Any character string. This string is compared to the Name of each of an issue record's attachments. See .

internal

equal to
not equal to
less than
less than or equal to
greater than
greater than or equal to

An integer, identifying a particular AccuWork issue record ( issueNum field) or a particular AccuRev transaction ( transNum field).

Creating a Compound Clause

A compound clause combines any number of subclauses together, using the same logical operator: AND or OR. (The NOT operator is not supported.) The subclauses to be combined can, themselves, be either simple or compound.

Example 1: simple AND simple

Example 2: simple AND compound

Example 3: simple OR compound OR simple

Example 4: Compound clause with a single subclause

A compound clause can contain a single subclause. This is logically equivalent to using the subclause by itself. In fact, the standard "one-line" query contain an AND clause with one simple subclause.

The query editor automatically creates placeholders for simple clauses. But you must explicitly insert a compound-clause placeholder yourself, then fill in the subclauses.

Following are guidelines for adding placeholders to a query:

  • You cannot add a compound clause at the top level (directly beneath the query name). This level contains a single compound clause — initially AND, but changeable to OR
  • To create a compound clause below a particular operator, right-click it, and select the type of clause from the context menu.

To change any AND clause to an OR clause (or vice-versa), select the operator and press function key F2 (or click it a second time). This opens a listbox with the values AND and OR.

Viewing an English-Language Rendition of the Query

The query name's context menu includes the option In English, which renders the query in everyday language, displaying the results in a separate window.

Ending the Query Editor Session

Whether you're composing a new query or revising an existing one, you end by saving your work (Ok button) or discarding it (Cancel button). If you didn't cancel the Query Editor session, AccuWork automatically executes the query and displays the results in the Query Results pane. Note: Closing the window using its title bar controls is equivalent to Cancel.

Back to top