IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Building mediation flows > Create XPath expressions

Example: Setting filters in Xpath expressions

This example shows how to apply a filter on a repeatable field using the XPath Expression Builder.

When a field is selected in the viewer, this section will be populated with default values if an array field exists. If no array fields are found based on the selected field in the viewer, this section will appear empty. It is important to note that this section of the XPath Expression Builder will reset whenever the selection changes in the field viewer.

The following example shows how each account element is selected:

As we would like to select each account element in the array, there is no need to specify filter information.

In situations where only a subset of account elements are needed, filters can be added to the array fields. The following example shows how to select only account elements which have the @opened attribute set to 'true':

When the account element is selected in the field viewer, the optional filter table pre-populates the 'Array Fields', 'Where', and 'Operator' columns. It is left to you to populate the 'Value' column. Once a value is entered, the filter is complete and the resulting expression is near the top of the window in the Expression field.

In situations where only a subset of account elements are needed based on an index value, the position() function can be used under the 'Where' column of the filter table. The following example shows how to only select the first account element using the position() function:

In more complex situations where multiple filters are needed, the optional and operator can be used in the filter table to create another filter. The following example shows how to select stock elements with a ticker of IBM and account elements with cash greater then 100:

Create XPath expressions