Filter Expression Examples

Basic filter expressions are very easy to specify in Workspace. Showing how easy it is to create a filter expression is best done with a couple of examples, then if you need more information, you can read the rest of this chapter.

Example 1

This example shows how to display all work items that have a work item ID that is less than “2000”, AND whose priority is set to 1.

Note: Note that this same example can also be used if you need to filter on only a single criteria. In which case, just skip steps 4 and 5.
  1. Display the work item Filter dialog by clicking the Filter button on the work item list.
  2. From the Grouping section on the Filter dialog, double-click the AND (All Of) entry:

    The AND (All Of) entry is added to the Filter section:

    AND (All Of indicates that if “all of” the filter criteria that is specified below that icon is true for a work item, the work item is returned from the server and displayed in the work item list.

    The filter expression defaults to an “all of” expression. Therefore, this step is technically not necessary for this type of expression. It is being added here for completeness.

  3. From the Attributes section on the Filter dialog, double-click the Work Item ID attribute:

    Note that you can also “drag and drop” the Work Item ID attribute into the Filter section, or right click and select Insert Item.

    The Work Item ID data-entry dialog is displayed in the Filter section. This is the first criteria that must be true for the work item to be displayed in the list.

  4. In the Work Item ID data-entry dialog, select “LessThan” from the drop-down list, enter “2000” in the second field (without the quotes), then click the Add button:

  5. From the Attributes section on the Filter dialog, double-click the Priority attribute:

    The Priority data-entry dialog is displayed in the Filter section. This is the second criteria that must be true for the work item to be displayed in the list.

  6. In the Priority data-entry dialog, leave “Equal” selected from the drop-down list, enter “1” (without the quotes) in the data-entry field, then click the Add button:

    The “filter expression” for the two criteria you entered is now shown in a graphical format in the Filter section:

    This specifies that the work items that satisfy “all of” the filter criteria (that is, have a work item ID of less than 2000 AND have a priority of 1) are returned from the server and displayed in the list.

  7. Click the Apply button. The “# items will be returned” text in the upper left part of the Filter section tells you how many work items satisfied the filter expression.
  8. Click OK to display the work item list.

Example 2

This example shows how to display all process instances that were started on or before May 1, 2009, OR that have been suspended (i.e., Status = Suspended).

  1. Display the process instance Filter dialog by clicking the Filter button on the process instance list.
  2. From the Grouping section on the Filter dialog, double-click the OR (Any Of) entry:

    The OR (Any Of) entry is added to the Filter section:

    The OR (Any Of) icon indicates that if “any of” the filter criteria that is specified below that icon are true for a process instance, the process instance is returned from the server and displayed in the process instance list.

  3. From the Attributes section on the Filter dialog, double-click the Start Date attribute:

    Note that you can also "drag and drop" the Start Date attribute into the Filter section, or right click and select Insert Item.

    The Start Date data-entry dialog is displayed in the Filter section. This is the first criteria that can be true for the process instance to be displayed in the list.

  4. In the Start Date data-entry dialog, select “LessOrEqualTo” from the drop-down list, click the "date picker" icon to the right of the date field and select May 1, 2009 from the calendar that is displayed, then click the Add button:

    The “filter expression” for what you have entered so far is added to the Filter section:

  5. From the Attributes section on the Filter dialog, double-click the Status attribute:

    The Status data-entry dialog is displayed in the Filter section. This is the second criteria that can be true for the process instance to be displayed in the list.

  6. In the Status data-entry dialog, leave “Equal” selected in the first drop-down list, select "Suspended" from the second drop-down list, then click the Add button:

    The “filter expression” for the two criteria you entered is now shown in a graphical format in the Filter section:

    This specifies that the process instances that satisfy “any of” the filter criteria (that is, has a start date on or before May 1, 2009 OR has an instance status of "Suspended") are returned from the server and displayed in the list.

  7. Click the Apply button. The “# item will be returned” text in the upper left part of the Filter section tells you how many work items satisfied the filter expression.
  8. Click OK to display the work item list.
    Note: The two preceding examples are considered simple examples because they specify either “All Of” or “Any Of”, but not both. You can construct filter expressions that are a mixture of “All Of” and “Any Of”. This is described in Combining “AND (All Of)” and “OR (Any Of)”.