Specifying Pre-defined Filters

Pre-defined filters are those available to the user from a drop-down list in the Event Viewer.

For example:

Pre-defined filters can be specified in two different areas of events:

  • Links - When links are defined with <link/> elements in the eventLinks.xml file, a <filters/> element is included with one or more subordinate <filter/> elements, each one representing a selection from the pre-defined filter drop-down list for the event list created by that <link/> element.
  • Templates - When templates are defined with <template/> elements in the eventViewTemplates.xml file, a <filters/> element is included with one or more subordinate <filter/> elements, each one representing a selection from the pre-defined filter drop-down list for the event list created by that <template/> element.

Each <filter/> element contains a query string that is used to include or exclude certain event types from the event list when that pre-defined filter is selected.

Both the eventLinks.xml and the eventViewTemplates.xml files contain default pre-defined filters for each link and template, respectively, which you are free to modify, remove, or add to.

For example, the following specifies three pre-defined filters that are available from an event list created via a work item contextual link (messageId = WorkItem_WorkspaceContext”) when the “This work item” link is selected:

<links messageId="WorkItem_WorkspaceContext">
  <link name="eventLinks.name.workItem"
        menuText="eventLinks.menuText.thisWorkItem"
        image="JSXAPPS/base/application/images/WorkView.gif"
        defaultFilterId="eventLinks.id.summary"
        defaultEventDescription="summary">
        <filters>
          <!-- Show all events, including BX user task related events -->
          <filter id="eventLinks.id.all"
             query="applicationActivityInstanceId='{ActivityID}'"
             description="eventLinks.description.allEventsForItemOfInstanceApp"/>
          <!-- Don't show BX related user task events -->
          <filter id="eventLinks.id.summary"
              query="applicationActivityInstanceId='{ActivityID}' AND
                      messageId &lt;&gt; 'BX_INSTANCE_TASKS*'"
              description="eventLinks.description.summaryEventsForItemApp"/>
          <!-- Only show BRM workitem open and complete events -->
          <filter id="eventLinks.id.openedCompletedOnly"
               query="applicationActivityInstanceId='{ActivityID}' AND
                     (messageId='BRM_WORKITEM_OPENED' OR
                      messageId='BRM_WORKITEM_EX_COMPLETE_WORK_ITEM')"
               description="eventLinks.description.openedCompletedForItemApp"/>
         </filters>
</link>

The three <filter/> elements cause the “All”, “Summary”, and “Open and completed only” selections to be displayed in the pre-defined filter drop-down list when the event list defined by the <link/> element is displayed.

Note that you can specify which of these filters to use by default by configuring the defaultFilterId attribute under the <link/> element (see defaultFilterId Attribute) or the <template/> element (see defaultFilterId Attribute).

The <filter/> element provides the following attributes to define each of the filters:

id Attribute

This attribute identifies the text that is displayed in the pre-defined filter drop-down list to identify the filter.

The id attribute contains a key that points to the text string in the eventLocale.xml file—for more information, see Event-Related Text.

query Attribute

This attribute is a string value used to query the event collector database for events. All events that satisfy the filter string specified in this attribute are returned from the event collector database and displayed in the Event Viewer when the pre-defined filter is selected.

For more information about the filter string in this attribute, see Event Filter String.

description Attribute

This attribute specifies the description to display when the pre-defined filter is selected.

The description is displayed in two locations, as shown in the example below. In this example, when the “Summary” pre-defined filter is selected, it results in the description being displayed in the Description column in the event view list, as well as above the toolbar in the Event Viewer:

The description attribute contains a key that points to the text string in the eventLocale.xml file—for more information, see Event-Related Text.