Creating and running queries

Create queries to retrieve records in a user database. You can create a query for any record type that is defined in HCL Compass Web.

About this task

Creating the query involves several steps: selecting the record type, adding the filters and defining their properties, moving and grouping filters, formatting the results set, and saving and running the query.

Selecting the record type

Procedure

  1. On the HCL Compass Web toolbar, click New Query.
  2. On the Create New Query window, select a record type from the list.
    Only records of this record type are selected when the query runs.
  3. Optional: To use the design of an existing query as the basis for the new query, on the same Create New Query window select the Copy the design from an existing query check box and select a query from the list.
  4. Select a record type and click OK.
    The New Query is opened as a new tab on the page. Type a query name. There are several panes with information for fields, filters, and the presentation layout for the query. If you selected an existing query in step 3, its filters and presentation layout are added to the new query. You can change these by following the instructions in Adding filters and defining their properties.

What to do next

You can also create a query from the HCL Compass Navigator tree section in the Navigation pane. Right-click in the Navigation pane and click New Query.

Adding filters and defining their properties

Procedure

  1. In the Fields pane, select a field and click the right arrow next to the Filters pane to add it.
    Note that if you add more than one field, they are grouped together with an AND operator. You can switch operators by right-clicking on the operator node and selecting AND or OR.
  2. In the Filters pane, select the field and the Define Query Filter pane opens.
  3. Specify the filter criteria for any fields you added.
    • If you select Dynamic Filter, you are prompted to select the filter criteria when you run the query. Type the text for the message in the field.
    • If you do not specify the filter criteria, the filter is not used when the query runs.
  4. Optional: If you want to group your fields with additional AND and OR operators, click the AND and OR buttons to add the operators to the query, and then right-click on the fields to copy, cut, and paste them into the AND and OR operators.
  5. To save these filter criteria as the default values for new queries based on this record type, select the Use this filter criteria as the default for new queries check box.

Moving filters

Procedure

  1. Select the filter, right-click to display the pop-up menu and click Cut or Copy to either remove it from the current location or copy it to a new location.
  2. Select the new location, right-click to display the pop-up menu and click Paste to move it to the new location.

Grouping filters

About this task

You can group filters in any combination to create a complex filter. You can use the logical operators AND and OR to create the groups.

Procedure

  1. At the top of the Filters pane, click AND or OR.
  2. In the Fields pane, click the right arrow to add fields under the AND or OR groups in the Filters pane.
  3. You can add logical operators only as the root or children of another operator.

What to do next

Note: You can change or delete the existing operator within the Filter pane. Select the operator, right-click to display the pop-up menu and click the operator or Delete to remove it.

Formatting the results set

Procedure

  1. In the Fields pane, select the field to add from the list and click the right arrow next to the Query Presentation pane to create the columns displayed in the result set.
  2. In the Query Presentation pane, you can change the default properties and format for the fields.
    • To change the display order of a field, click the up arrow or down arrow to change the display order of a field.
    • To change the title of a field, click on the title name in the title column and type the new name.
    • To change the sort order of all the fields for a column, click on the column title and the arrow shows the sort order as either ascending or descending.
    • To show and sort the fields, select the Show check box. Clearing this check box still sorts the item, but does not display the item.
    • To configure the properties of a column for a field, select a sort type from the Sort list (No Sort, Ascending, or Descending), and select a sort order from the Sort Order list sorting indicated by a number from 0 to the total number of display fields minus one.
    • To remove a field from the Query Presentation pane, select the field and click the left arrow.
  3. Optional: To use this display layout as the default format for all new queries based on this record type, select the Use this display layout as the default for new queries check box.

Running and saving the query

About this task

When you save a query to your Personal Queries folder, this information is stored in the Compass database. You can access the saved query by logging on to the database with any supported client.

Procedure

  1. Click Run to run the new query without saving it.
    The result set opens in the upper right pane.
  2. Click Save to save the query under a new name.

    On the Save Query As window, type a query name and select a folder in which to save the query or create a new folder.

    The name under which you saved the query appears at the top of the page and a save confirmation message appears.

  3. Optional: After saving your query, it is added to the Navigator tree in the Navigation Pane. To run the query, right-click on the query name and click Run.
  4. Optional: You can choose to run the query at startup. In the HCL Compass Navigator tree, locate the query, right-click to display the pop-up menu and click Run at Startup. An arrow icon is placed over the query icon next to the query name. To remove this option, locate the query, right-click and select Remove from Startup. The arrow icon is removed.