Creating AccuWork Queries

An AccuWork query retrieves a set of records according to user-defined selection criteria. AccuWork has a point-and-click interface for creating and editing queries; it enables you to create simple queries quickly, and to create sophisticated queries in a straightforward, reliable way.

By default, the queries that you create are private queries, which cannot be seen by other users. You can declare any query to be a public query. Such queries are visible to all users, who can use and copy them, but cannot modify your original.

Opening a Queries Tab

Choose the Issues > View Issue Queries option from the GUI main menu, or click the View Issue Queries button in the GUI main toolbar.

AccuRev prompts you to choose a depot, and then displays the Queries tab.

Back to top

Query Tab Layout

The Query tab contains three panes, each with its own toolbar:

  • The Query List pane lists the names of all your existing private queries, along with public queries available to all users. Using the toolbar in this pane, you compose new queries, view/revise/rearrange/execute existing queries, and delete queries.
  • When you execute a query, the set of issue records selected by the query are displayed as a results table in the Query Results pane. If you've set a default query for this depot, it's executed automatically when you open the Queries tab.
  • If you click the Show Issue Details button in the toolbar of the Query Results pane, an Issue form pane appears below it. This pane is a fully functional Issue form, which you can use to view and modify the issue record currently selected in the Query Results pane. A user preference (Tools > Preferences) configures this pane to appear automatically when you open a Queries tab.

Query List Pane Layout

The Query List pane contains a list of the private queries you've defined for the current depot, along with any public queries defined by you and/or other users.

The listing is not alphabetical — whenever you create a new query, it's simply added to the end of the list.

Your queries (both private and public) are always listed above other users' public queries.

See Working in the Query List Pane.

Query Results Pane Layout

The Query Results pane contains a table that displays the results of a query.

Each row of the table displays one issue record; each column displays a particular issue-record field.

Each query has its own results-table design: a set of columns (fields), in a particular order and with particular column-widths. The results table’s design can also include a single-level or multiple-level sort order for the rows (issue records).

When you create a new query, AccuWork automatically starts off the results table with a couple of columns, including Issue (issueNum field). You can add more columns at any time. You can also remove the Issue column from the table. Note: "Issue" is the default label for the issueNum field, but the edit-form designer can change the label.

See Working in the Query Results Pane.

IssueForm Pane Layout

The Issue form pane is just like the "full size" Issue form, except that it occupies a pane within the Queries tab, instead of having an entire tab to itself. This pane displays the entire contents of the issue record that's currently selected in the Query Results pane. In addition, browse arrows are enabled in the Issue form pane's toolbar, making it easy to view some or all of the records selected by a query. There is also a Change Package History button ( ) that displays all the modifications that have been made to the change package for this issue.

See Working in the Issue Form Pane.

Back to top

Working with Issues

Here's a typical procedure for working with issues in AccuWork:

  1. In the Query List pane, create a new query (or select an existing one), then execute the query.
  2. In the Query Results pane, view selected fields from the issue records selected by the query.
  3. Open the Issue form pane to view the entire contents of one of the selected issue records (and perhaps modify it).

The following sections describe working in each of the Queries tab's panes.

Working in the Query List Pane

You can invoke the following options in the Query List pane, using context menus or the Query List toolbar.

Most options operate on the currently selected query.

Run query

(equivalent: double-click the query name) Executes (or re-executes) the selected query, displaying the results in the Query Results pane. You don't need to run this option when you revise a query in the Edit Query window — AccuWork automatically executes the revised query and updates the results table.

Save

Save all your private queries. (There is no way to save a single query.) Your private queries are stored in the AccuRev repository within the depot directory, in an XML-format file:

.../storage/<depot-name>/dispatch/config/user/<username>/query.xml

Notes:

  • Each user's private queries are stored separately

    The <username> directory in the query storage pathname causes the private queries for each user to be stored separately.

  • Queries are not version-controlled

    Although your queries are stored in the depot, they are not version-controlled in the way AccuRev files are. For example, there is no option that displays or reinstates your queries as you saved them two days ago.

  • Automatic save-on-close feature

    If you try to close a Queries tab in which you've made changes to one or more queries, but haven't run Save all queries, AccuWork offers to perform the save.

New query
Edit query

Create a new query or revise an existing one, using the Edit Query window.

Clone query

(Context menu only) Create a private query that is a copy of the selected private or public query. The new query is initially named "Copy of ...", but you can change the name.

Move query up
Move query down

(Context menu only) Change the position of the selected query in the Query List pane. Note that your own queries (both private and public) are always listed above other users' public queries.

Delete query

(Context menu only) Remove the currently selected query. The deletion does not take effect until you run Save all queries. If you close the Queries tab without saving your queries, the "deleted" query will still exist the next time you open the Queries tab. This may or may not be the right thing to do: closing the Queries tab without saving also discards changes you've made to other queries since the most recent save.

Set as Default
Disable as Default

(Context menu only) Designates one of your private queries to be — or to stop being — your default query for this depot. (This is your default query — another user can set one of his own private queries to be his default query.)

The query name is redisplayed in bold-italic to indicate that it is the default query.

Your default query is executed:

  • Whenever you open a new Queries tab.
  • When you execute Send to Issue (see see Send to Issue: Associating Changes with an Issue).
  • A query loses its status as your default query when you run Disable as Default on it, or when you select another query as the default.

Set as Private
Set as Public

Changes a query that you created from public to private, or vice-versa.

Additional Operations in the Query List Pane

  • Renaming a Query — You can rename any of your private queries in the Query List pane, without having to open an Edit Query window:

    1. Select the query.
    2. Press function key F2 or click the query name again. (Be careful not to double-click; that runs the query.)
  • Revisiting the Results of a Query — Whenever you select a particular query in the Query List pane, the Query Results pane displays that query's most recent results. The cache of previous query results is cleared when you close the Queries tab.

Working in the Query Results Pane

In many cases, browsing the results table produced by running a query may be all you need to do. But in other cases, you may want to see a selected issue record in the context of its Issue form. Why?

  • The results table is read-only. To modify an issue record, you must access it through its Issue form.
  • The data you need may be in a field that is not included in the results table. Instead of adding a column to the results table, you can use the Issue form to display all the fields.

You can use a "full-size" or "reduced-size" Issue form to view a issue record:

  • Invoke Open Issue to open a separate Issue form for the currently selected issue record.
  • Invoke Show Issue Details to make an Issue form pane appear within the Queries tab.

With either tool, browse arrows in the Issue form's toolbar make it easy to view some or all of the records in the results table.

Options Available in the Query Results Pane

The following options are available in the Query Results pane:

Open Issue

Open a separate Issue form to view/revise the currently selected issue record.

Setup Columns

Open a Columns window, in which you can change which columns (fields) appear in the table, and also change their order.

Remove Column

(appears only in the context menu of an individual column) Removes the column you right-clicked from the results table. (This is a shortcut, eliminating the need to invoke Setup Columns.)

Export Table

Open a File Chooser window, in which you specify a file to store the entire contents of the results table using an HTML, XML, or CSV format:

Show Issue Details

Toggles the Issue form pane, displaying the complete contents of the currently selected record in the Query Results pane.

See also: Working with Tables.

Working in the Issue Form Pane

Using a "reduced-size" Issue form within a pane of the Queries tab is virtually the same as using a "full-size" Issue form in its own tab. Here are some notes on the few differences:

  • The browse buttons in the Query Issue form pane's toolbar makes it easy to visit all the records in the Query Results pane table.

  • After modifying a record and invoking Save, you may want to rerun the query in order to update the table in the Query Results pane. This doesn't occur automatically.

Back to top