Defining an XPath conditional expression for a structural transform (ForEach)

Configure the Filter Inputs section in the Properties view of the ForEach transform to define the conditional expression that determines whether the transform is applied in a graphical data map.

The ForEach transform can only have one primary input connection. Additional connections to the ForEach transform must be of type Supplement.

Complete the following steps to define a conditional expression on a ForEach transform:

The input element is evaluated against the condition. If the condition evaluates to true, the transform is applied to the input element.

This example shows how to define an XPath expression that checks the value of a string element:
  • The ForEach transform has a primary connection wired from the repeating element Address.
  • The ForEach transform has a secondary connection wired from the mandatory element BusinessUnit. This element can be set to nil. This element is not used to calculate the value of the output element.
  • The ForEach transform should only execute if the BusinessUnit element is not empty.

The XML schema for the mandatory element is the following:

<element name="BusinessUnit" type="string" nillable="true"></element>

The XML schema for the repeating element is the following:

<xsd:element form="qualified" name="Address" type="mqsistr:Address" maxOccurs="unbounded" minOccurs="0" />

This figure shows the transform with the primary and supplementary connections from the input elements.

The XPath expression that you define is the following:

$BusinessUnit != ''

Deploy and test the graphical data map. For more information, see Troubleshooting a graphical data map.

Copyright IBM Corporation 2013Copyright IBM Corporation 2012.

Task topicTask topic | Version 1.0 | cm28860_