Save and share queries

Commonly needed queries can be saved and reused. Saved queries can be global in scope (that is accessible to all portal users), limited to one Project (accessible only to users who have a project role assigned), or limited to access by you only.

Save the current query in the Visual Query Builder:

  1. Click the drop-down arrow at the right-hand end of the Visual Query Builder, and click Save Current Query.

  2. In the Save Query dialog box, enter a descriptive name, and select whether the saved query should be accessible globally by all portal users (Global), project locally by users having a project role (Project), or only by you (User).

Run a saved query

You can rerun any saved query to which you have access.

  1. Click the drop-down arrow at the right-hand end of the Visual Query Builder.

  2. In the pop-up bubble listing available saved queries, click on the name of the query you want to run.

    Tip:

    You can copy the command-line syntax of a saved query to your clipboard by pressing your Ctrl or Cmd key, and then clicking the saved query name.

Create a personal default query

By default, Polarion runs a system default query specified in the system configuration whenever you access the Work Items table. You can override that default and set any query as your personal default query, to be run whenever you access the Work Items table. Your personal default query is also used wherever the system default query is normally run.

You can create different personal default queries for different scopes. For example, you can create one default query that runs when you are working in the scope of a project, and a different one when you are working in the scope of a project group or the Repository. If you switch to a project or project group for which you have not defined a personal default query, the system default query is applied.

  1. Use the Visual Query Builder tool to construct the query you want.

  2. Click the drop-down control on the right-hand side of the query builder, and in the pop-up panel, click Save as Default (see the screenshot in the Construct queries graphically section).

  3. Confirm the action in the dialog box that appears.

You can change your personal default query any time by repeating these steps with a different query.

Preference when switching contexts

Suppose you expand the Work Items topic in Navigation, and then select one of the types, for example, Requirement. Then, suppose you specify a query like Status: Draft, which filters the table to show only Requirements items with Draft status. If you now select a different type in Navigation, for example, Test Case, by default your query Status: Draft is preserved and the table is filtered to show Test Case items with Draft status. This may or may not be what you want when you switch the context.

The same is true in a larger context switch. For example, you might be looking at the table showing Requirements with Draft status, and then switch to a different project. Or you might be looking at the Table view of a Document, and switch to a different Document. In all cases, your current query is preserved and the table in the new context is still filtered to show Requirements with Draft status. In the new context, the query results might not be what you need.

Whenever you switch to a context in which the current query's result may no longer be valid, a warning icon appears in the Visual Query builder. Clicking the icon displays a dialog box in which you can specify the behavior you prefer when switching contexts.

Shows the selected Type.

Type changes, user's query is preserved.

The dialog title and text vary depending upon the context switch (switching between Work Item types as opposed to switching to a different Document, for example), but the options are the same.

  • Always Use Default Query: When you switch to a different context, the default system query for the context is always executed. For example, when switching to a different Work Item type, the Work Items table always shows only Work Items of the selected type in the table. Any user-defined query present in the Visual Query Builder before the switch is deleted.

  • Always Keep Current Query: The system preserves any user-defined query present in the Visual Query Builder before the switch. Be sure you are aware of the effect of the preserved query. You may want to modify or remove it after the context switch.