Data filtering

You can configure the content of lists shown on your windows to vary according to information that you have specified elsewhere on that window. For example, you can set a filter on a list so that the list displays only CIs that are associated with the selected user. Alternatively, you can set a filter on the category list, so that different categories are available for different configuration items.

You can create new object links that you can then use for data filtering. For more information, see Linking unlinked business objects.

Creating a filter rule

You can define filter rules that limit the results returned by one object based on the value of another object. You can use either a filter query on your filter rule, or you can specify a runtime value.

The following example shows how to display only those Configuration Items (CIs) that are associated with the selected user on the Incident window. Because we want to limit the CIs that are displayed on the Incident window, the filter rule is based on the Configuration Item attribute on the Incident object.

To create a filter rule:
  1. Start the Object Designer component, and navigate to the business object on which you want to impose filters.
    Following our example, Incident Management | Incident.
  2. On the Attributes list, select the attribute that you want to add the filter to.
    In this example, Configuration Item.
  3. In the Properties grid, alongside the Filter Selectors property, click .
    The Attribute Filter Selectors dialog appears.
  4. Click New Filter Rule.
    The Attribute Filter Selector dialog appears.

    You can choose to limit the records that are returned by the filter rule either with a filter query that contains criteria to select only the required values, or with a runtime value that sets the value to that specified elsewhere. For example, you could use a runtime value to set the group field on an assignment to match the primary group for the analyst who logged the incident.

For more information about using a runtime value, see Data filtering using a runtime value.

In our example, we are going to use a filter query that selects only CIs that are associated with the Raise User for the incident.

  1. Click the Select a filter query option button, then in the list, click [New].
    The New Filter dialog appears.

If there is already a suitable filter query, you can select it in the list.

For more information about creating filter queries, see Filters.

  1. Specify a Title for the filter.

Notice that the Module and Business Object for both the Based On group and the Filter By group are already defined. The Based On object is the related object for the attribute that you are setting up the filter selector for (in our example, Configuration Management\Configuration Item). The Filter By object is the object that the attribute for the filter selector is on (in our example, Incident Management\Incident). This means that when you add criteria to the filter query, you will be matching attributes on the Configuration Item with attributes on the Incident.

  1. Select the Everyone option button, then click OK.
    The Filter Builder appears.
  2. From the Attributes tree, drag Title onto the Selected Attributes list.

You can also add any attributes that you want to use on a complex list on a window design (for more information about complex lists, see Complex lists).

  1. When you have added the required attributes, click Next.
    The Criteria page appears. This is where we set the conditions that limit the results that are returned.

We want to specify a runtime value that selects the CIs that are associated with the Raise User for the incident. CI to User is a many-to-many link: a user may have many CIs (a computer, a monitor, a printer, and so on), and a CI may be associated with many users (for example, a networked printer). For this reason, there is a collection of User Configuration Items on the Configuration Item object. It is the User attribute on this collection that we want to filter by.

This means that we want a criterion of User Configuration Items.User Is Equal To (Raise User).

  1. From the Attributes tree, drag the attribute that you want to base the filter on onto the Current Criteria list.
    In our example, expand the User Configuration Items collection, and then drag User onto the Current Criteria list.
    The Criteria dialog appears, with the Attribute field already completed with User Configuration Items.User.
  2. In the Condition list, select Is Equal To.

In addition to specifying an absolute value or a runtime value for the criterion, you can select a Condition that sets the criterion in itself, such as Is Current User. Selecting Is Current User for our example would display all CIs associated with the current user, which is not what we want. We want the CIs that are associated with the user that the incident was raised for – the Raise User. To do this, we need to set a runtime value for the criterion.

  1. Click the Specify a runtime value option button.
    Further controls are added to the Criteria dialog:
  1. In the tree, select Raise User, then click OK.
    User Configuration Items.User Is Equal To (Raise User) is added to the Current Criteria list.
  2. On the Filter Builder window, click Finish, and then click Yes to save the changes you have made.
    The Filter Builder closes and the Attribute Filter Selector dialog contains the new filter.
  3. In the Select client type group box, select Any if you want the filter to apply to all clients, or select Web Access only if you want the filter to apply only to applications that are delivered through Web Access, such as Web Desk, then click OK.
    The filter appears in the Filter Rules list. Note that the Type is set to Query.
  4. Click OK.
    The filter rule is added to the attribute.
  5. Click to save the changes to the object.

To modify an existing filter rule, select it in the Filter Rules list, then click Modify.

You could create another filter rule so that only CIs that are of the CI Type selected on the incident are selected. You do this by matching the Class Type for the CI with the Configuration Item Type selected on the Incident, as a runtime value.
That is: AND Class Type Is Equal To (ConfigurationItemType)

Wherever possible, set a filter on an attribute that is specific to the relevant business object, rather than on an attribute that is inherited from another business object. If you must create a filter on an inherited business object (that is, if the attribute that it is filtered by is only available on the inherited business object), then when you create the filter rule, you need an extra condition so that it is applied only for a specific type of business object.
For example, on the Incident business object, an attribute filter on the Process/Raise User needs to filter the users by the Customers selected on the Incident window. This works correctly for the Incident. However, you cannot select a Raise User on the Change business object because the Raise User attribute is inherited from the Process business object, so it always tries to filter by Incident/Customer. Using this example, you cannot define this filter on the Process/Raise User attribute, because Customer is not part of the Process business object, but is native to the Incident business object. Therefore, the filter must remain on the Incident/Raise User, but must not be applied to other business objects. You can achieve this by adding a filter condition to apply the filter only if the Business Object is Incident.