Filter Recurring Nodes

By specifying an XPath predicate to filter against during run time, you can limit the recurring nodes returned by a mapping activity.

About this task

Filtering using a predicate directly in the mapping panes of activities eliminates the need for the following activities:
  • A While Loop or For Each activity that loops through the recurring structures
  • An If...Then activity to test for values.
Eliminating the looping and If..Then activities improves orchestration performance.
For example, you can limit the books processed by the BatchOrderProcessingSample orchestration to only return book titles that start with the letter B using either of the following methods:
  • After the Read Flat File activity which converts flat file data to XML, you can add a While Loop activity that contains an If..Then activity that tests for all book titles that start with the letter B. When the While Loop activity completes at run time, it returns the set of recurring BookOrder nodes that have titles beginning with the letter B.
  • Filter by specifying a predicate directly in the To Orchestration pane of the Map Outputs task of the Read Flat File activity that converts flat file data to XML. This is the preferred method because it reduces the processing during run time - improving orchestration performance.  For example, you can specify the following predicate on the recurring BookOrder node to limit the Bookorder nodes returned during run time to only those titles that begin with the letter B:*:title/starts-with(.,'B')
This example predicate is explained in the following table:
Predicate Characters Description
*: Specifies this predicate applies to any namespace of the source node.
title/ Specifies to apply this predicate against the title node of the current source node.
starts-with(.,'B') Specifies this predicate returns only nodes that have title nodes that start with the letter B. The starts-with function is a built-in XPath function.

For more information about the BookOrder sample, see the Getting Started Guide. If you accepted the defaults during the installation of Studio, you can find the reference implementation of the sample in the following directory:C:\Program Files\IBM\WebSphere Cast Iron Studio 3.X\Samples\BookOrder

To specify a predicate on a recurring node:

Procedure

  1. You can only apply a filter on a recurring destination node which is mapped to a recurring source node in the mapping panes of activities, as shown in the following Map Outputs pane of the Read Flat File activity in the BatchOrderProcessingSample orchestration:
  2. Right-click on the destination occurrence node (in this example BookOrder/occurrence) and select Filter Recurring Nodes from the menu. The Filter Recurring Nodes dialog box opens.
  3. Enter the XPath predicate. For this example, enter the predicate shown in the following figure:
  4. Click OK. The predicate is evaluated to determine if it is valid:
    • If the predicate is invalid, an error message is reported.
    • If the predicate is valid, the filter icon (Recurring Node icon) shows next to the destination occurrence node.



Feedback | Notices


Timestamp icon Last updated: Thursday, December 17, 2015


http://pic.dhe.ibm.com/infocenter/wci/v7r0m0/topic/com.ibm.wci.doc/map_Filter_Recurring_Nodes.html